2-6. Vagrant up時のGuestAdditionのアンマッチを解消する

一連のインストールの中で、yum update (all)したせいで、vagrant upした際に、こんなエラーが出るようになりました。 (実は、最初から出ていたのですが、読んでいませんでしたw)
    centos72: The guest additions on this VM do not match the installed version
of
    centos72: VirtualBox! In most cases this is fine, but in rare cases it can
    centos72: prevent things such as shared folders from working properly. If yo
u see
    centos72: shared folder errors, please make sure the guest additions within
the
    centos72: virtual machine match the version of VirtualBox you have installed
 on
    centos72: your host and reload your VM.
    centos72:
    centos72: Guest Additions Version: 4.3.30
    centos72: VirtualBox Version: 5.1
==> centos72: Configuring and enabling network interfaces...
==> centos72: Mounting shared folders...
    centos72: /vagrant => D:/VM
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=1000,gid=1000 vagrant /vagrant

The error output from the command was:

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

これは、ホストPC(Windows: D:\VM)とゲストPC(CentOS: /vagrant/)の共有を行う、Guest Additionsのバージョンのアンマッチに原因があるみたい。(yum updateで、CentOS側が上がった?) Windows側のモジュールも新しくしてあげれば、エラーは解消しました。
D:\VM>vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching: micromachine-2.0.0.gem (100%)
Fetching: vagrant-vbguest-0.13.0.gem (100%)
Installed the plugin 'vagrant-vbguest (0.13.0)'!

D:\VM>vagrant vbguest
[centos72] GuestAdditions versions on your host (5.1.12) and guest (4.3.30) do n
ot match.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: epel.excellmedia.net
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Package kernel-devel-3.10.0-514.2.2.el7.x86_64 already installed and latest vers
ion
Package gcc-4.8.5-11.el7.x86_64 already installed and latest version
Package binutils-2.25.1-22.base.el7.x86_64 already installed and latest version
Package 1:make-3.82-23.el7.x86_64 already installed and latest version
Package 4:perl-5.16.3-291.el7.x86_64 already installed and latest version
Package bzip2-1.0.6-13.el7.x86_64 already installed and latest version
Nothing to do
Copy iso file D:\VM\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGues
tAdditions.iso
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.1.12 - guest version is 4.3.30
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.1.12 Guest Additions for Linux...........
VirtualBox Guest Additions installer
Removing installed version 4.3.30 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
vboxadd.sh: Building Guest Additions kernel modules.
vboxadd.sh: Starting the VirtualBox Guest Additions.

Could not find the X.Org or XFree86 Window System, skipping.

Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.3.30
VBoxService inside the vm claims: 5.1.12
Going on, assuming VBoxService is correct...
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   4.3.30
VBoxService inside the vm claims: 5.1.12
Going on, assuming VBoxService is correct...

D:\VM>
これで、再度vagrant upすると、
D:\VM>vagrant up
Bringing machine 'centos72' up with 'virtualbox' provider...
==> centos72: Clearing any previously set forwarded ports...
==> centos72: Clearing any previously set network interfaces...
==> centos72: Preparing network interfaces based on configuration...
    centos72: Adapter 1: nat
    centos72: Adapter 2: intnet
==> centos72: Forwarding ports...
    centos72: 22 (guest) => 10022 (host) (adapter 1)
    centos72: 8888 (guest) => 18888 (host) (adapter 1)
    centos72: 22 (guest) => 2222 (host) (adapter 1)
==> centos72: Booting VM...
==> centos72: Waiting for machine to boot. This may take a few minutes...
    centos72: SSH address: 127.0.0.1:2222
    centos72: SSH username: vagrant
    centos72: SSH auth method: private key
    centos72: Warning: Remote connection disconnect. Retrying...
    centos72: Warning: Remote connection disconnect. Retrying...
==> centos72: Machine booted and ready!
[centos72] GuestAdditions 5.1.12 running --- OK.
==> centos72: Checking for guest additions in VM...
==> centos72: Configuring and enabling network interfaces...
==> centos72: Mounting shared folders...
    centos72: /vagrant => D:/VM

D:\VM>
バッチリです。余計な警告メッセージも出なくなりました。 ## 以上で、環境構築は完了です。 おつかれさまでした!!

このブログの人気の投稿

MS Azure Information Protection を入れたら右クリックの「分類して保護する」がうざい