停止或重新加载后出现错误“无法在Linux guest虚拟机中装入文件夹”

时间:2015-01-16 20:35:37

标签: linux vagrant virtualbox

我正在尝试使用来自其他人的Vagrant盒子,当我第一次启动它时它工作正常,但在我停止并使用vagrant haltvagrant up重新启动它之后,或{ {1}},我收到以下错误消息:

vagrant reload

现在,搜索此错误消息会导致很多人遇到Virtual Box 4.3.10的问题,但这不是我遇到的问题。

7 个答案:

答案 0 :(得分:18)

事实证明,升级Linux内核将导致Virtual Box Guest Additions停止工作,直到通过在VM中运行以下命令重建它们

sudo /etc/init.d/vboxadd setup

当我运行yum update(类似于apt-get upgrade)以获取其他软件的更新时,我已经升级了内核而没有考虑它。

或者,如果您按照here所述安装dkms软件包,则在更新内核时应自动更新内核模块。

答案 1 :(得分:5)

要解决此问题,必须安装虚拟框添加。例如,我使用Centos 7.首先下载centos 7 minimal,然后安装guest添加,请看下面的所有步骤

  1. 下载centos 7

    vagrant init centos / 7

    流浪汉

    vagrant ssh

  2. 为虚拟框安装Guest添加

    yum update

    重新启动

    流浪汉ssh

    yum更新内核

    重新启动

    流浪汉ssh

    yum groupinstall“开发工具”

    yum install kernel-devel

    yum install wget

    wget http://download.virtualbox.org/virtualbox/5.0.2/VBoxGuestAdditions_5.0.2.iso

    sudo mkdir / media / VBoxGuestAdditions

    sudo mount -o loop,ro VBoxGuestAdditions_5.0.2.iso / media / VBoxGuestAdditions

    sudo sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run rm VBoxGuestAdditions_5.0.2.iso

    sudo umount / media / VBoxGuestAdditions

    sudo rmdir / media / VBoxGuestAdditions

    sudo /etc/init.d/vboxadd setup

    sudo chkconfig --add vboxadd

    sudo chkconfig vboxadd on

    出口

  3. 打包新盒子

    vagrant package --base my-virtual-machine

答案 2 :(得分:2)

遇到同样的问题,但有一个不同的修复:我已经安装了dkms(Debian Jessie下的virtualbox-guest-dkms)。

事情是“vboxsf”模块没有自动加载,并且运行mount shared_directory不起作用(No such file or directory错误)。

但是在跑完modprobe vboxsf之后,安装很顺利。

所以我修改了/etc/modules并在新行上添加了vboxsf:问题解决了!

附注:如果运行modprobe vboxsf因错误而结束,则表示您没有安装vboxsf模块,因此您应首先安装DKMS模块。

答案 3 :(得分:2)

在我得到同样的错误之后我就这样做了:

$ vagrant ssh
$ sudo apt-get update
$ exit

然后安装了vagrant-vbguest

$ vagrant plugin install vagrant-vbguest

然后

$ vagrant halt
$ vagrant up

它有效!

查看日志,似乎vagrant-vbguest在guest虚拟机(VM)上添加vbguest时进行了一些清理。

[default] GuestAdditions versions on your host (4.3.38) and guest (4.3.10) do not match.
 * Stopping VirtualBox Additions
   ...done.
rmmod: ERROR: Module vboxsf is not currently loaded
rmmod: ERROR: Module vboxguest is not currently loaded
Reading package lists...
Building dependency tree...
Reading state information...
The following packages will be REMOVED:
  virtualbox-guest-dkms* virtualbox-guest-utils* virtualbox-guest-x11*
0 upgraded, 0 newly installed, 3 to remove and 12 not upgraded.
After this operation, 12.1 MB disk space will be freed.
(Reading database ... 113238 files and directories currently installed.)
Removing virtualbox-guest-dkms (4.3.10-dfsg-1ubuntu5) ...
Error! Could not locate dkms.conf file.
File:  does not exist.
Removing virtualbox-guest-x11 (4.3.10-dfsg-1ubuntu5) ...
Purging configuration files for virtualbox-guest-x11 (4.3.10-dfsg-1ubuntu5) ...
Removing virtualbox-guest-utils (4.3.10-dfsg-1ubuntu5) ...
Purging configuration files for virtualbox-guest-utils (4.3.10-dfsg-1ubuntu5) ...
Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6.9) ...
Reading package lists...
Building dependency tree...
Reading state information...
dkms is already the newest version.
linux-headers-3.13.0-91-generic is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 12 not upgraded.
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: block device /tmp/VBoxGuestAdditions.iso is write-protected, mounting read-only
Installing Virtualbox Guest Additions 4.3.38 - guest version is 4.3.10
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.38 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.

P.S。我在OS X上使用以下软件版本:

$ vagrant plugin list
solve (0.8.2)
  - Version Constraint: 0.8.2
vagrant-berkshelf (4.1.0)
vagrant-hostmanager (1.5.0)
  - Version Constraint: 1.5.0
vagrant-hostsupdater (1.0.2)
vagrant-omnibus (1.3.1)
  - Version Constraint: 1.3.1
vagrant-proxyconf (1.2.0)
  - Version Constraint: 1.2.0
vagrant-share (1.1.5, system)
vagrant-vbguest (0.12.0)

$ VBoxManage --version
4.3.38r106717

$ vagrant --version
Vagrant 1.8.4

希望这有帮助。

答案 4 :(得分:1)

只需安装Vagrant插件vagrant-vbguest,即可让您的VirtualBox Guest Additions保持最新状态。

vagrant plugin install vagrant-vbguest

答案 5 :(得分:0)

我使用Vagrant 1.8.1,VirtualBox 5.0.18,Chef 12.10.10主机MacOSX El Capitan和访客CentOS7遇到了同样的错误。 我尝试在guest虚拟机中安装kernel-devel,安装最新的GuestAdittions并更新yum,但这些都不适合我,所以我改变了#34; nfs"的安装类型。在我的自定义同步文件夹和厨师临时文件夹中,它都有效!

在Vagrantfile中,我的同步文件夹:

config.vm.synced_folder ".", "/vagrant", type: "nfs"

和我的chef_solo配置:

chef.cookbooks_path = ["chef/cookbooks/"]
chef.synced_folder_type = "nfs"

答案 6 :(得分:0)

VirtualBox 5.18解决了这个问题。它存在于5.16中,不能通过任何常用方法修复。最新版本5.18完美运行。