簡體   English   中英

Vagrant - 如何安裝virtualbox共享文件夾? (“vboxsf”不可用)

[英]Vagrant - How can I mount the virtualbox shared folder? (“vboxsf” not available)

我有以下錯誤:

Vagrant無法掛載VirtualBox共享文件夾。 這通常是因為文件系統“vboxsf”不可用。 該文件系統通過VirtualBox Guest Additions和內核模塊提供。 請驗證這些客人添加內容是否已在guest虛擬機中正確安裝。 這不是Vagrant中的錯誤,通常是由錯誤的Vagrant框引起的。 對於上下文,嘗試的命令是:

id -u vagrant

該命令的錯誤輸出是:

id:'vagrant':沒有這樣的用戶

所以我試着尋找解決方案。 我看過很多人說需要一個特殊的vbguest vagrant插件然后運行vagrant並且在ssh中應該修改另外的vbguest。

所以我做了以下步驟:

$ vagrant plugin install vagrant-vbguest然后添加了插件:

安裝'vagrant-vbguest'插件。 這可能需要幾分鍾......安裝插件'vagrant-vbguest(0.13.0)'!

$ vagrant up

$ vagrant ssh

$ sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions這不打印任何消息,所以我認為這是正確的。 然后我重新加載了流浪漢。

$ vagrant reload

不幸的是,我又錯了。

$ vagrant reload
==> Project-Yii: Attempting graceful shutdown of VM...
==> Project-Yii: Clearing any previously set forwarded ports...
==> Project-Yii: Clearing any previously set network interfaces...
==> Project-Yii: Preparing network interfaces based on configuration...
    Project-Yii: Adapter 1: nat
    Project-Yii: Adapter 2: hostonly
==> Project-Yii: Forwarding ports...
    Project-Yii: 22 (guest) => 2222 (host) (adapter 1)
==> Project-Yii: Running 'pre-boot' VM customizations...
==> Project-Yii: Booting VM...
==> Project-Yii: Waiting for machine to boot. This may take a few minutes...
    Project-Yii: SSH address: 127.0.0.1:2222
    Project-Yii: SSH username: ubuntu
    Project-Yii: SSH auth method: password
    Project-Yii: Warning: Remote connection disconnect. Retrying...
==> Project-Yii: Machine booted and ready!
[Project-Yii] GuestAdditions 5.1.14 running --- OK.
==> Project-Yii: Checking for guest additions in VM...
==> Project-Yii: Setting hostname...
==> Project-Yii: Configuring and enabling network interfaces...
==> Project-Yii: Mounting shared folders...
    Project-Yii: /app => /home/xxx/Projects/project-shop
Vagrant was unable to mount VirtualBox shared folders. This is usually
because the filesystem "vboxsf" is not available. This filesystem is
made available via the VirtualBox Guest Additions and kernel module.
Please verify that these guest additions are properly installed in the
guest. This is not a bug in Vagrant and is usually caused by a faulty
Vagrant box. For context, the command attempted was:

id -u vagrant

The error output from the command was:

id: 'vagrant': no such user

當然,當我刪除流浪者並再次運行流浪漢並從草圖重新加載時,我嘗試了這種情況,但同樣的問題。 是的,我也嘗試過vagrant-hostmanager插件(這是在yii文檔中,但同樣的問題)

這是我的流浪文件,也許它對你有用。

require 'yaml'
require 'fileutils'

domains = {
  frontend: 'frontend-yii.com',
  backend:  'backend-yii.com'
}

config = {
  local: './vagrant/config/vagrant-local.yml',
  example: './vagrant/config/vagrant-local.example.yml'
}

# copy config from example if local config not exists
FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local])
# read config
options = YAML.load_file config[:local]

# check github token
if options['github_token'].nil? || options['github_token'].to_s.length != 40
  puts "You must place REAL GitHub token into configuration:\n/project-yii/vagrant/config/vagrant-local.yml"
  exit
end

# vagrant configurate
Vagrant.configure(2) do |config|
  # select the box
  config.vm.box = 'ubuntu/xenial64'

  # should we ask about box updates?
  config.vm.box_check_update = options['box_check_update']

  config.vm.provider 'virtualbox' do |vb|
    # machine cpus count
    vb.cpus = options['cpus']
    # machine memory size
    vb.memory = options['memory']
    # machine name (for VirtualBox UI)
    vb.name = options['machine_name']
  end

  # machine name (for vagrant console)
  config.vm.define options['machine_name']

  # machine name (for guest machine console)
  config.vm.hostname = options['machine_name']

  # network settings
  config.vm.network 'private_network', ip: options['ip']

  # sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine)
  config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant'

  # disable folder '/vagrant' (guest machine)
  config.vm.synced_folder '.', '/vagrant', disabled: true

  # hosts settings (host machine)
  config.vm.provision :hostmanager
  config.hostmanager.enabled            = true
  config.hostmanager.manage_host        = true
  config.hostmanager.ignore_private_ip  = false
  config.hostmanager.include_offline    = true
  config.hostmanager.aliases            = domains.values

  # provisioners
  config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']]
  config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false
  config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always'

  # post-install message (vagrant console)
  config.vm.post_up_message = "Frontend URL: http://#{domains[:frontend]}\nBackend URL: http://#{domains[:backend]}"
end

我的流浪漢版本是1.9.1 ,我的Virtualbox版本是5.1.14 r112924(最新的)

somebady有同樣的問題嗎? 我應該采取哪些其他步驟來解決這個問題?

它對我來說是5.1.18。

https://www.virtualbox.org/wiki/Changelog 5.1.18修復了以下看似相關的問題:

  • 共享文件夾:固定不區分大小寫的文件名訪問(5.1.16回歸;僅限Windows客戶;錯誤#16549)

  • 共享文件夾:固定訪問長路徑(5.1.16回歸;僅限Windows客戶端;錯誤

    14651,#16564)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM