質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

Q&A

解決済

1回答

556閲覧

Vagrantで共有フォルダのエラー(host,gest間のGuestAdditionsバージョン違い)を解決できません

risaito74

総合スコア44

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Vagrant

Vagrantは、VirtualBox上の仮想マシンを コマンドラインから作成してくれるソフトウェアです。 ビルド環境など容易に構築が可能です。

0グッド

0クリップ

投稿2017/12/12 03:07

編集2017/12/12 09:27

PC:ThinkPad X250(Corei7 8GB)
OS:Windows10
Vagrant:2.0.1(12/12現在の最新版)
VirtualBox:5.2.2(12/12現在の最新版)

半年ぐらい前に作ったVagrant環境を再び使うことになり、vagrant upをしてみたところ、共有フォルダでエラーが出てしまいました。
(以前は共有フォルダも含めて正常に使えていました)

==> default: Mounting shared folders...

default: /vagrant => C:/Vagrant/centos70

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:

mount: unknown filesystem type 'vboxsf'

エラーが出る状態前にやったこと
・Windows8を10にアップデート
・Vagrantを最新版にアップデート(エラー後にアンインストールから再インストール)
・VirtualBoxを最新版にアップデート(エラー後にアンインストールから再インストール)

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

上記のようにhostとgestでGuestAdditionsのバージョンが異なるというエラーが出ていました。

[default] GuestAdditions versions on your host (5.2.2) and guest (4.3.28) do not match.

この記事を参考にvagrant-vbguestのインストールしGuest Additions更新を試みてみましたが、以下のエラーが出てしまい、記事のように解決はできませんでした。

$ vagrant vbguest

[default] GuestAdditions versions on your host (5.2.2) and guest (4.3.28) do not match.
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile

  • base: ftp.tsukuba.wide.ad.jp
  • extras: ftp.tsukuba.wide.ad.jp
  • updates: ftp.tsukuba.wide.ad.jp

Package gcc-4.8.5-16.el7_4.1.x86_64 already installed and latest version
Package binutils-2.25.1-32.base.el7_4.1.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-292.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 C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
Mounting Virtualbox Guest Additions ISO to: /mnt
mount: /dev/loop0 is write-protected, mounting read-only
Installing Virtualbox Guest Additions 5.2.2 - guest version is 4.3.28
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.2 Guest Additions for Linux........
VirtualBox Guest Additions installer
This system appears to have a version of the VirtualBox Guest Additions
already installed. If it is part of the operating system and kept up-to-date,
there is most likely no need to replace it. If it is not up-to-date, you
should get a notification when you start the system. If you wish to replace
it with this version, please do not continue with this installation now, but
instead remove the current version first, following the instructions for the
operating system.

If your system simply has the remains of a version of the Additions you could
not remove you should probably continue now, and these will be removed during
installation.

Do you wish to continue? [yes or no]

Cancelling installation.
An error occurred during installation of VirtualBox Guest Additions 5.2.2. Some functionality may not work as intended.
In most cases it is OK that the "Window System drivers" installation failed.
Redirecting to /bin/systemctl start vboxadd.service
Failed to issue method call: Unit vboxadd.service failed to load: No such file or directory.
Unmounting Virtualbox Guest Additions ISO from: /mnt

なお、私物のPC(PCはVaio(Corei3 8GB)、それ以外の環境は冒頭の情報と一致しているもの)で同じように試したところ、こちらではバージョン違いのエラーがそもそも出ず、問題なく共有フォルダも機能していました。
Vaio側と問題の起きているThinkPadの違いを考えたところ、Vaioは一度Vagrant,VirtualBoxをアンインストールしていたため、同じようにアンインストールから再インストールをしてみましたが、状況は変わりませんでした。

Guest Additionsのバージョン違いを解消し、共有設定を有効に機能させるためには、どうしたらよいか、ご助言をいただけましたら大変助かります。
よろしくお願い致します。

【追記1】
Vagrantでフォルダがmountできないエラーが出たときの対応

上記の記事を参考に以下のコマンドをゲスト側で実行し、カーネルのアップデートは実行されたようですが、現象としては変化ありませんでした。

sudo yum update kernel*

【追記2】
VagrantでBox追加してvagrant upしてdestroyしてまたvagrant upするとか

上記の記事を参考に以下のコマンドを試してみましたが、現象としては変化ありませんでした。

vagrant destroy

【追記3】
vagrant up時にGuestAdditionsがnot runningになる場合、ゲストマシンのkernelをupdateすることで解決できる可能性がある

上記の記事を参考に以下のコマンドを試してみましたが、現象としては変化ありませんでした。

sudo yum update

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

問題のvagrant環境は原因不明のままですが、改めてboxファイルからvagrant環境を別に作ってみたところ、最初は同様のエラーなどが起きましたが、色々試行錯誤した結果、問題が解消されました。
問題を解消した具体的な方法はハッキリとはわかりませんが、最後の方に試した以下のコマンドが効いたのかなと感じています(このコマンドは問題の環境でも試したのですが…)

sudo yum -y update kernel

sudo yum -y install kernel-devel kernel-headers dkms gcc gcc-c++

参考にした記事
Vagrantでディスクのマウントができない

自分自身あまりスッキリしない解決ですが、とりあえず問題の起きないvagrant環境を作るという目的は達成できたので、本件解決とさせていただきます。

投稿2017/12/13 06:45

編集2017/12/13 06:46
risaito74

総合スコア44

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問