Vagrant 无法挂载 VirtualBox 共享文件夹。错误:无效的参数

     2023-03-23     169

关键词:

【中文标题】Vagrant 无法挂载 VirtualBox 共享文件夹。错误:无效的参数【英文标题】:Vagrant was unable to mount VirtualBox shared folders. ERROR: INVALID ARGUMENT 【发布时间】: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,所以我的问题是这是否需要特定程序。

非常感谢

【问题讨论】:

【参考方案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,所以我无法真正解释我的机器中实际发生的情况,但我希望这对您或遇到相同问题的人有所帮助。

【讨论】:

Vagrant 错误:无法挂载 VirtualBox 共享文件夹(Guest Additions,vboxsf)

】Vagrant错误:无法挂载VirtualBox共享文件夹(GuestAdditions,vboxsf)【英文标题】:VagrantError:UnabletoMountVirtualBoxSharedFolders(GuestAdditions,vboxsf)【发布时间】:2017-06-2318:37:42【问题描述】:问题我在Windows10上安装了Vagrant,以便可以在虚... 查看详情

Vagrant:无法让 NFS 工作

...尝试更改我的VagrantFile,以便它使用NFS挂载而不是默认的VirtualBox共享文件夹。我收到此错误消息:vm:*SharedfoldersthathaveNFSenableddonotsupportowner/groupattributes.Hostpa 查看详情

windows10环境vagrant+virtualbox虚拟机无法创建私有网络的解决方案。

报错信息==>default:Clearinganypreviouslysetnetworkinterfaces...Therewasanerrorwhileexecuting`VBoxManage`,aCLIusedbyVagrantforcontrollingVirtualBox.Thecommandandstderrisshownbelow.Command:["hostonlyif", 查看详情

在 Windows 7 主机上使用活动 *** 连接启动时,vagrant 配置的 virtualbox 无法访问互联网

】在Windows7主机上使用活动***连接启动时,vagrant配置的virtualbox无法访问互联网【英文标题】:vagrantprovisionedvirtualboxcannotaccesstheinternetwhenbootedupwithanactive***connectiononthewindows7host【发布时间】:2015-04-0403:02:48【问题描述】:我在设... 查看详情

Vagrant 错误:无法在 Linux 客户机中挂载文件夹

】Vagrant错误:无法在Linux客户机中挂载文件夹【英文标题】:Vagranterror:FailedtomountfoldersinLinuxguest【发布时间】:2014-05-0804:28:11【问题描述】:我对Vagrant共享文件夹有一些问题,我的基本系统是Ubuntu13.10桌面。我不明白为什么我有... 查看详情

virtualbox-5.1.22​无法挂载u盘解决办法

W10环境下VirtualBox-5.1.22装WIN7无法挂载U盘.。VirtualBox-5.1.22可能还需要安装扩展插件(我装了),地址如下http://download.virtualbox.org/virtualbox/5.1.22/Oracle_VM_VirtualBox_Extension_Pack-5.1.22-115126.vbox-extpack安装完成后在虚拟WIN7里安装 查看详情

virtualbox+vagrant环境配置(代码片段)

VirtualBox+Vagrant环境配置1、下载安装VirtualBox和VagrantVirtualBox下载地址:https://download.virtualbox.org/virtualbox/6.1.12/VirtualBox-6.1.12-139181-Win.exeVagrant下载地址:https://releases.hashicorp.com/vagrant/2.2.9/ 查看详情

Jenkins / Vagrant / VirtualBox - Virtualbox 以系统用户身份运行?

】Jenkins/Vagrant/VirtualBox-Virtualbox以系统用户身份运行?【英文标题】:Jenkins/Vagrant/VirtualBox-Virtualboxisrunningasthesystemuser?【发布时间】:2014-10-0922:41:55【问题描述】:我对VirtualBox和Vagrant都很陌生,但不是Jenkins。我有一个Jenkins版本... 查看详情

mac下virtualbox+vagrant安装(代码片段)

mac下virtualbox+vagrant安装1.安装VirtualBoxVirtualBox下载地址?免费小巧非常适用,根据自己机器系统选择下载包图12.安装并使用Vagrant1)Vagrant下载地址?选择下载包图2安装完成后,在终端输入vagrant-v提示显示vagrant版本即安装成功并可使... 查看详情

markdown[vagrant]fedora#linux上的vagrant和virtualbox安装(代码片段)

查看详情

vagrant,virtualbox安装虚拟机

01访问Vagrant官网,下载需要的版本https://www.vagrantup.com/ 02访问VirtualBox官网  下载需要的版本https://www.virtualbox.org/ 一、创建步骤(创建一个centos7虚拟机系统,)(1)创建文件夹G:\\docker\\labs\\first- 查看详情

使用 NFS 的 Vagrant CentOS8 无法挂载:mount.nfs:不支持请求的 NFS 版本或传输协议

】使用NFS的VagrantCentOS8无法挂载:mount.nfs:不支持请求的NFS版本或传输协议【英文标题】:VagrantCentOS8usingNFSfailstomount:mount.nfs:requestedNFSversionortransportprotocolisnotsupported【发布时间】:2020-11-0121:29:02【问题描述】:我正在尝试为使用... 查看详情

vagrant+virtualbox

Vagrant+virtualBox 1、准备工作1)Vagrant下载 https://www.vagrantup.com/downloads.html2)Virtualbox5.1下载  https://www.virtualbox.org/wiki/Download_Old_Builds_5_13)重启:windows下进入系统bios->cpu设置->开启虚拟化服务说明:目前Vagrant只支... 查看详情

无法安装 Vagrant box Laravel Homestead

...re上的官方文档说明在MacOSX上安装LaravelHomestead。我安装了VirtualBox和Vagrant。现在我正在尝试使用命令vagrantboxaddlaravel/homestead添 查看详情

markdown使用vagrant限制virtualbox资源(代码片段)

查看详情

sh将vagrant框导入virtualbox(代码片段)

查看详情

virtualbox+vagrant快速安装centos7(代码片段)

一、下载Virturalbox并完成安装下载地址:https://www.virtualbox.org/wiki/Downloads安装完成将用户.VirtualBox文件拷贝到d:\\linux\\virtualbox目录下全局设定,将虚拟目录指向virtualbox二、下载Vagrant并完成安装,并且电脑要重启下载地... 查看详情

1vagrant初识

1.简介vagrant是一个命令行虚拟机管理工具,需借助virtualbox、vmware、hyper-v等虚拟机工具,可以安装在centos、macorwindows环境下,利用它可以快速部署虚拟化的测试环境2.安装virtualboxhttp://download.virtualbox.org/virtualbox/5.1.4/VirtualBox-5.1.4-11... 查看详情