LoginSignup
96
94

More than 5 years have passed since last update.

Failed to mount folders in Linux guest. This is usually because the "vboxsf" file system is not available.を直す方法

Last updated at Posted at 2015-03-21

vagrantでこういうエラーが出ました。

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device

原因

yum updateした

カーネルがアップデートされた

VitualBox GuestAdditionが壊れた

vboxsfのマウント機能が動かなくなった。

(゚д゚)マズー

解決策

VitualBox GuestAdditionsを再ビルドする必要があります。

ゲストOSで、ビルドに必要なパッケーをインストール

$ sudo yum install kernel-devel
$ sudo yum install gcc make

ホストOSで再ビルド実行

$ vagrant vbguest
$ vagrant plugin install vagrant-vbguest
$ vagrant vbguest
GuestAdditions versions on your host (4.3.20) and guest (4.3.14) do not match.
The guest's platform is currently not supported, will try generic Linux method...
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
mount: /dev/loop2 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 4.3.20 - guest version is 4.3.14
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.20 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 4.3.20 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
Building the main Guest Additions module[  OK  ]
Building the shared folder support module[  OK  ]
Building the OpenGL support module[  OK  ]
Doing non-kernel setup of the Guest Additions[  OK  ]
Starting the VirtualBox Guest Additions [  OK  ]
Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
An error occurred during installation of VirtualBox Guest Additions 4.3.20. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.

確認して再起動

$ vagrant vbguest --status
GuestAdditions 4.3.20 running --- OK.
$ vagrant reload

これで直りました!

(おまけ)kernelが更新されないようにする

そもそもの発端は、yum updateを実行してkernelをアップデートしてしまったことです。

yum updateするときに、kernelがアップデートされないように回避するには下記のようにします。

yum -y update --exclude=kernel*
96
94
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
96
94