9
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

vagrantでマウントエラーが発生する

Posted at

#開発環境

  • Windows10 =>ホストOS
  • virtualBox5.1.26
  • vagrant 1.9.7
  • CentOS6.5 =>ゲストOS

#エラー内容

$vagrant up
したところ、

$vagrant up
ringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'CentOS6.5'...
==> default: Matching MAC address for NAT networking...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
                 :
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
                 :
                 :
    default: SSH auth method: private key
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/UserName/MyVagrant/MyCentOS
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

とマウントエラーが起きる。
エラーを見る限り、共有フォルダでマウントエラーが起きている様子。

#解決方法

ぐぐってみると、以下のサイトを発見

解決方法1を実行したら解決されず。

$vagrant ssh
で接続し、

$vagrant vbguest --status
で確認してみると、

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

どうやら、ホストOSとゲストOSのバージョンが違うのが原因だった。

解決方法2を参考にしながら、今までのログを見てみると、

No package kernel-devel-2.6.32-431.3.1.el6.x86_64 available.

どうやらカーネルのアップデート用ファイルが見つからないらしい。
######カーネルファイルのバージョンが異なる場合があるのでしっかりチェックしてDL先をぐぐってみること。今回はkernel-devel-2.6.32-431.3.1.el6.x86_64を扱う。

以下のサイトからリンクを保存し、インストール
http://rpm.pbone.net/index.php3/stat/4/idpl/25578728/dir/scientific_linux_6/com/kernel-devel-2.6.32-431.3.1.el6.x86_64.rpm.html

$vagrant ssh
######SSH接続してログインしてある状態で作業を進めること。

$sudo yum install -y URL

$sudo yum install -y ftp://mirror.switch.ch/pool/4/mirror/scientificlinux/6.5/x86_64/updates/fast bugs/kernel-devel-2.6.32-431.3.1.el6.x86_64.rpm

completeとでたら成功。

$vagrant vbguest --status
で確認してみると、

[default] GuestAdditions 5.1.26 running --- OK.

正常に稼働していることがわかる。

$vagrant reload
もしくは
$vagrant halt $vagrant up

で再起動してみると

==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
                 :
                 :
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
                 :
                 :
==> default: Machine booted and ready!
[default] GuestAdditions 5.1.26 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
                 :
                 :
    default: SSH auth method: private key
==> default: Mounting shared folders...
    default: /vagrant => C:/Users/UserName/MyVagrant/MyCentOS

成功!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?