2016年10月1日土曜日

vagrant upで"Failed to mount folders in Linux guest."

勉強のため、Postgre SQLを玩ぼうと、久々にvagrantを立ち上げたら、virtual machineは立ち上がるものも、マウントに失敗しる模様。

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-6.7' is up to date...
==> default: Clearing any previously set forwarded ports...
==> 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 => 2222 (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/user/myvagrant/mycentos
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

$ 

下記のブログを参考になんとか解決しました。

事象内容

1. guest osとhost osでvirtual boxのvirtual boxのバージョンが違うと、共有ディレクトリがリンクできない。
2. vagnrat vbguest installによりguest osのvirtual boxのバージョンアップを試みたが、カーネルの更新で失敗していた。

対応内容

まずは、2から。
2. guest osにvagrant sshしてyumでカーネルを更新※今回のguest osはcent os 6.7でしたので、yum。
$ sudo yum -y update kernel
念のため、下記も実行しました。
yum -y install kernel-devel kernel-headers dkms gcc gcc-c++
1. guest osを再起動したら直りました。
$ vagrant reload

0 件のコメント:

コメントを投稿