LoginSignup
11
12

More than 5 years have passed since last update.

vagrant で共有フォルダのマウントに失敗するときの対処

Posted at

==症状==

Vagrantの仮想マシンの起動時に、仮想マシンとホストOSの共有フォルダのマウントに失敗してしまう。

$ vagrant up
:
[default] Mounting shared folders...
[default] -- /vagrant
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!
mount -t vboxsf -o uid=id -u vagrant,gid=id -g vagrant /vagrant /vagrant
$

==使用環境==

Vagrant version : 1.2.4
ホストOS : matchbook 13-inch, Late 2009
オラクルVirtualBox : 4.2.16
使用したVagrant BOX : http://developer.nrel.gov/downloads/vagrant-boxes/CentOS-6.4-x86_64-v20130427.box

==原因==

起動メッセージにはこうでてる
 :
Guest Additions Version: 4.1.18
VirtualBox Version: 4.2
 :
このバージョンの不一致が問題らしい。Guest Additionsのバージョンが古い。

==対処方法==

オラクルVirtualBox のバージョンにGuest Additionsを合わせバージョンアップする。

==実行手順==

$ vagrant ssh
[vagrant@localhost ~]$ whoami
vagrant

対応するバージョン4.2のisoイメージをダウンロードする
[vagrant@localhost ~]$ wget -c http://download.virtualbox.org/virtualbox/4.2.0/VBoxGuestAdditions_4.2.0.iso

[vagrant@localhost ~]$ ls
VBoxGuestAdditions_4.2.0.iso postinstall.sh

isoイメージをCDドライブにマウントしインストーラーを実行
[vagrant@localhost ~]$ sudo mount VBoxGuestAdditions_4.2.0.iso -o loop /mnt
[vagrant@localhost ~]$ sudo sh /mnt/VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.0 Guest Additions for Linux..........
VirtualBox Guest Additions installer
Removing installed version 4.1.18 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules [ OK ]
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 失敗
Doing non-kernel setup of the Guest Additions [ OK ]
Installing the Window System drivers 失敗

Xserver関係をインストールしてないのでエラーは出るがこれでOKでした。あとはVagrantを再起動。

[vagrant@localhost ~]$exit
$ vagrant reload

==確認==

再び、vagrant ssh接続し、Vagrant内の/vagrantディレクトリがホスト側のVagrantディレクトリと共有している事を確認する

$ vagrant ssh
[vagrant@localhost ~]$ cd /vagrant
[vagrant@localhost vagrant]$ touch test.txt
[vagrant@localhost vagrant]$ exit
$ ls -l
-rw-r--r-- 1 hogehoge staff test.txt
$

Guest Additionsをアップデートするプラグインがあるけども、トラブルシューティング中に知らないプラグインのイストールしたくなかったのと、使用するisoイメージは自分で選択したかったので、あえて自分で手動でアップデートする方法を選択。

ここらの管理方法はVmwareと良く似てる。

11
12
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
11
12