LoginSignup
0
0

More than 1 year has passed since last update.

VagrantでVirtualBoxの仮想環境構築で共有フォルダのエラーが発生し解決

Last updated at Posted at 2022-10-21

800px-Centos-logo-light.svg.png

概要

Windows環境下でVagrantを使用しVirtualBoxの仮想環境をpython用に構築。共有フォルダのエラーとなったので、その解決までの対処をまとめた

環境

Windows 10 Home バージョン1909
VirtualBox バージョン 6.1.14 r140239 (Qt5.6.2)
vagrant 2.3.2_windows_amd64

VirtualBox:
ubuntu

発生したエラー

/vagrant => C:/PythonProject
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,_netdev vagrant /vagrant

The error output from the command was:

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

/sbin/mount.vboxsf: エラーでマウントに失敗しました
とのこと。冒頭の文章から
「Vagrant は VirtualBox 共有フォルダーをマウントできませんでした。 これは通常
ファイルシステム「vboxsf」が利用できないためです。 このファイルシステムは
VirtualBox Guest Additions およびカーネル モジュールを介して利用可能になります。
これらのゲストの追加が正しくインストールされていることを確認してください」
とのこと。

対処1 プラグインのインストール

pluginのインストール後のvagrant reloadで解決したという方も結構いた。
なお、当方は解決しなかった。

# vagrant plugin install vagrant-vbguest
# vagrant plugin list

対処2 virtualbox additionalのバグ?対応

syslogを確認する(VirtualBoxの環境によりlogが違うので注意)

$ sudo tail /var/log/syslog
sf_read_super_aux err=-22

エラーコードを調べてみると、virtualbox additionalのバグ?らしい。
mount.vboxsfへのリンクが通ってない模様。virtualbox.orgのチケットのリンク先に対応策としてシンボリックリンクを貼るコマンドが表記されている。
#12879 (Can't mount shared folders with guest additions 4.3.10 => Fixed in SVN) – Oracle VM VirtualBox

# vagrant ssh xxxx
sshで入った後にコマンドを実行。
$ sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions

解決

対処1,対処2を経てvagrant reloadで解決した。

==> main: Mounting shared folders...
    main: /vagrant => C:/PythonProject
0
0
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
0
0