LoginSignup
4
4

More than 5 years have passed since last update.

vagrant upでmountエラーが発生した場合の解決方法

Posted at

vagrant up でこんなエラー(赤字)が出た

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=500,gid=500 vagrant /vagrant

The error output from the command was:

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

赤字の上にはこんなメッセージ

[default] GuestAdditions versions on your host (5.0.30) and guest (4.3.4) do not match.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.premi.st
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Setting up Install Process
No package kernel-devel-2.6.32-431.el6.x86_64 available.
Package gcc-4.4.7-17.el6.x86_64 already installed and latest version
Package binutils-2.20.51.0.2-5.44.el6.x86_64 already installed and latest version
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
Package 4:perl-5.10.1-141.el6_7.1.x86_64 already installed and latest version
Package bzip2-1.0.5-7.el6_0.x86_64 already installed and latest version
Nothing to do
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Installing Virtualbox Guest Additions 5.0.30 - guest version is 4.3.4
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.30 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.30 of VirtualBox Guest Additions...
Stopping VirtualBox Additions [  OK  ]
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.
The missing package can be probably installed with
yum install kernel-devel-2.6.32-431.el6.x86_64

Building the main Guest Additions module[FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions[  OK  ]

==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 4.3.4
    default: VirtualBox Version: 5.0
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => <vagrant upしたディレクトリ>

どうやらvagrantのホストとゲストでGuestAdditionsなるもののVersionが違うとエラーになるみたい。
で、ゲスト側にkernel-devel〜をインストールすれば良いそう。

ゲスト側にkernel-devel〜を入れてみる→失敗

コマンドプロンプト(ホスト)
vagrant ssh

して、

コマンドプロンプト(ゲスト)
sudo yum install kernel-devel-2.6.32-431.el6.x86_64

すると

実行結果
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.premi.st
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Setting up Install Process
No package kernel-devel-2.6.32-431.el6.x86_64 available.
Error: Nothing to do

失敗してるみたい。。

kernel-devel〜をupdate の対象にする

kernel〜はyum installやupdateの対象外になっているみたい。だから失敗した。

/etc/yum.conf
exclude=kernel*

上記箇所をコメントアウトする。

再度ゲスト側にkernel-devel〜を入れてみる→失敗その2

コマンドプロンプト(ゲスト)
sudo yum install kernel-devel-2.6.32-431.el6.x86_64
実行結果
ailed to set locale, defaulting to C
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
epel/metalink                                            | 4.6 kB     00:00     
 * base: mirror.0x.sg
 * epel: mirror01.idc.hinet.net
 * extras: mirror.nus.edu.sg
 * updates: mirror.0x.sg
base                                                     | 3.7 kB     00:00     
extras                                                   | 3.4 kB     00:00     
puppetlabs-deps                                          | 2.5 kB     00:00     
puppetlabs-products                                      | 2.5 kB     00:00     
updates                                                  | 3.4 kB     00:00     
Setting up Install Process
No package kernel-devel-2.6.32-431.el6.x86_64 available.

再度ゲスト側にkernel-devel〜を入れてみる(インストールもと指定)

kernel-devel-2.6.32-431.el6.x86_64 でググって、置いてある場所を指定して再トライ

コマンドプロンプト (ゲスト)
sudo yum install ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/os/Packages/kernel-devel-2.6.32-431.el6.x86_64.rpm

今度はインストール成功:ok_woman:

ゲスト再起動

コマンドプロンプト(ゲスト)
exit
コマンドプロンプト(ホスト)
 vagrant reload
実行結果
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Fixed port collision for 22 => 2222. Now on port 2200.
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 (guest) => 2200 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2200
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
[default] GuestAdditions versions on your host (5.0.30) and guest (4.3.4) do not match.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: mirror.premi.st
 * extras: mirror.nus.edu.sg
 * updates: mirror.nus.edu.sg
Setting up Install Process
Package gcc-4.4.7-17.el6.x86_64 already installed and latest version
Package binutils-2.20.51.0.2-5.44.el6.x86_64 already installed and latest version
Package 1:make-3.81-23.el6.x86_64 already installed and latest version
Package 4:perl-5.10.1-141.el6_7.1.x86_64 already installed and latest version
Package bzip2-1.0.5-7.el6_0.x86_64 already installed and latest version
Nothing to do
Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Installing Virtualbox Guest Additions 5.0.30 - guest version is 4.3.4
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.30 Guest Additions for Linux............
VirtualBox Guest Additions installer
Removing installed version 5.0.30 of VirtualBox Guest Additions...
Stopping VirtualBox Additions [  OK  ]
Removing existing VirtualBox non-DKMS kernel modules[  OK  ]
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 graphics driver module[  OK  ]
Doing non-kernel setup of the Guest Additions[  OK  ]
Starting the VirtualBox Guest Additions Installing the Window System drivers
Could not find the X.Org or XFree86 Window System, skipping.
[  OK  ]

==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => <vagrant upしたディレクトリ>
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

ゲストのGuestAdditionsのversion upが走ったみたい。

参考

4
4
0

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
4
4