【问题标题】:Vagrant was unable to mount VirtualBox shared folders. ERROR: INVALID ARGUMENTVagrant 无法挂载 VirtualBox 共享文件夹。错误:无效的参数
【发布时间】:2021-09-17 20:58:13
【问题描述】:

我知道这些年来其他人也遇到过类似的问题(例如 this )但是在我的情况下,访客添加 已安装(0.30.0 版本)我尝试重新安装了很多次。

我在 Windows10 上工作,这些是 VirtualBox 和虚拟机的版本。

Virtualbox on your host claims:   5.2.8

VBoxService inside the vm claims: 6.1.22

这是问题的代码:

 default: /vagrant => C:/Users/XXXX XXXX/Documents/src
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:

mount -t vboxsf -o uid=1000,gid=1000,_netdev vagrant /vagrant

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: Invalid argument

我从未在类似情况下发现错误Invalid argument,所以我的问题是这是否需要特定程序。

非常感谢

【问题讨论】:

    标签: vagrant vagrant-windows vagrant-plugin


    【解决方案1】:

    更新后遇到了类似的问题 - 是一样的:

    /sbin/mount.vboxsf: mounting failed with the error: Invalid argument
    

    我在 virtualbox 启动中发现的是消息:

    VirtualBox Guest Additions: Kernel headers not found for target kernel
    5.4.0-81-generic. Please install them and execute
      /sbin/rcvboxadd setup
    

    使用“vagrant ssh”访问virtualbox命令行并运行:

    sudo apt-get install linux-headers-$(uname -r)
    

    之后重新启动 vagrant:

    vagrant halt
    
    vagrant up
    

    然后它实际上正确构建了 VirtualBox Guest Additions 并安装了我的共享文件夹。

    【讨论】:

    • 谢谢!我不知道我找到了多少死胡同。
    【解决方案2】:

    在制作我的第二个流浪项目后遇到了与您完全相同的错误 - 特别是在更改了我的 public_network 设置之后。

    mount -t vboxsf -o uid=1000,gid=1000,_netdev vagrant /vagrant
    The error output from the command was:
    /sbin/mount.vboxsf: mounting failed with the error: Invalid argument
    

    我还从人们的回答中尝试了几种解决方案,例如提到的here 并更新了我的 VirtualBox。

    我不太确定我的工作原理,但这是我所做的:

    我登录了 VM (vagrant ssh) 并手动安装了来宾添加

    cd /opt
    sudo wget -c 
    http://download.virtualbox.org/virtualbox/6.1.26/VBoxGuestAdditions_6.1.26.iso O VBoxGuestAdditions_6.1.26.iso
    

    然后尝试:

    sudo mount VBoxGuestAdditions_5.1.28.iso -o loop /mnt
    sudo sh /mnt/VBoxLinuxAdditions.run
    

    但我收到一条错误消息,例如权限被拒绝或没有目录。

    所以我重新加载了 vagrant (vagrant reload),但错误仍然发生。但是,我仍然继续尝试其他东西,所以我想也许我应该安装 vbguest 插件并这样做:

    vagrant plugin install vagrant-vbguest
    

    重新加载后为我消除了错误,但是当我再次登录 vagrant 时,我仍然看不到我的共享文件夹,所以我停止了我的 vb 并运行配置:

    vagrant up --provision
    

    然后我收到一条消息,说执行VBoxManage 时出错,依此类推。所以我暂停了我的VB中所有正在运行的机器,关闭了我桌面上所有正在运行的VB应用程序,然后运行命令:

    vagrant destroy
    

    在重新创建 vagrant vagrant up 之后,一切都奇迹般地工作了!我现在可以导航到我的共享文件夹的目录。

    我仍在学习 vagrant,所以我无法真正解释我的机器中实际发生的情况,但我希望这对您或遇到相同问题的人有所帮助。

    【讨论】:

      猜你喜欢
      • 2017-09-15
      • 2017-06-23
      • 1970-01-01
      • 2017-06-07
      • 1970-01-01
      • 2017-08-04
      • 1970-01-01
      • 2015-05-16
      • 1970-01-01
      相关资源
      最近更新 更多