流浪汉-如何安装virtualbox共享文件夹? ("vboxsf"不可用) [英] Vagrant - How can I mount the virtualbox shared folder? ("vboxsf" not available)

查看:501
本文介绍了流浪汉-如何安装virtualbox共享文件夹? ("vboxsf"不可用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到以下错误:

Vagrant无法挂载VirtualBox共享文件夹.这通常是因为文件系统"vboxsf"不可用.这 文件系统通过VirtualBox Guest Additions和 内核模块.请验证这些来宾添加是否正确 安装在来宾中.这不是Vagrant中的错误,通常是 由错误的Vagrant盒子引起的.对于上下文,命令已尝试 原为:

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流浪汉

该命令的错误输出是:

id:'vagrant':没有这样的用户

id: 'vagrant': no such user

因此,我尝试搜索解决方案.我见过很多人说,需要一个特殊的vbguest vagguest插件然后运行vagrant,并且在ssh中应修改其他vbguest.

So I tried to search on for the solution. I have seen a lot of people say that a special vbguest vagrant plugin is needed then run vagrant and in the ssh additional vbguest should be modified.

所以我执行了以下步骤:

So I did the following steps:

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

安装"vagrant-vbguest"插件.这可能需要一些时间 分钟...安装了插件"vagrant-vbguest(0.13.0)"!

Installing the 'vagrant-vbguest' plugin. This can take a few minutes... Installed the plugin 'vagrant-vbguest (0.13.0)'!

$ vagrant up

$ vagrant ssh

$ sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions 这不会打印出任何消息,所以我认为这是正确的. 然后我重新加载了无业游民.

$ sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions This does not print out any messages, so I think it is correct. Then I reloaded the vagrant.

$ vagrant reload

不幸的是,我再次收到错误消息.

And I got again the error unfortunately.

$ 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文档中,但存在相同的问题)

Of course I tried that scenario when I deleted the vagrant and run again vagrant up and reload from the sketch, but the same problem. Yes, I have tried with the vagrant-hostmanager plugin too (which is in the yii documentation, but the same problem)

这是我无所事事的文件,也许对您有用.

Here is my vagrant file, maybe it can be useful you.

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也有同样的问题吗?我应该采取哪些其他步骤来解决此问题?

Does somebady have the same problem? Which another steps should I take to solve this problem?

推荐答案

它对我来说与5.1.18兼容.

It worked with 5.1.18 for me.

https://www.virtualbox.org/wiki/Changelog 5.1.18已修复以下看似相关的问题:

https://www.virtualbox.org/wiki/Changelog 5.1.18 fixed the following seemingly relevant issues:

  • 共享文件夹:修复了不区分大小写的文件名访问(5.1.16 回归仅Windows来宾;错误#16549)

  • Shared Folders: fixed case insensitive filename access (5.1.16 regression; Windows guests only; bug #16549)

共享文件夹:已修复 访问长路径(5.1.16回归;仅Windows guest虚拟机;错误

Shared Folders: fixed access to long paths (5.1.16 regression; Windows guests only; bugs

这篇关于流浪汉-如何安装virtualbox共享文件夹? ("vboxsf"不可用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆