0
0

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 1 year has passed since last update.

Vagrantで共有フォルダ設定時、vagrant upで 「mount: unknown filesystem type ‘vboxsf’」が出る

Posted at

環境

  • Windows10
  • VirtulBox 5.2.20
  • Vagrant 2.2.0
  • centos/7 (virtualbox)

発生事象

Vagrantfileの以下の項目を有効にする。

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
   config.vm.synced_folder "../data", "/vagrant_data"

vagrant upで以下のエラー発生が発生した。

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
==> default: Rsyncing folder: /cygdrive/c/vagrant/centos7/ => /vagrant
==> default: Mounting shared folders...
    default: /vagrant_data => C:/vagrant/data
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_data /vagrant_data

The error output from the command was:

mount: unknown filesystem type 'vboxsf'

対応内容

  • 以下のサイトを参考に対応するVirtualbox Guest Additionsのインストールを試みる。

参考:vagrant upで 「mount: unknown filesystem type ‘vboxsf’」が出る

# cd /tmp
# yum install -y gcc perl bzip2 make perl vagrant-vbguest
# wget http://download.virtualbox.org/virtualbox/5.2.20/VBoxGuestAdditions_5.2.20.iso
# mkdir /media/VBoxGuestAdditions
# mount -o loop,ro VBoxGuestAdditions_5.2.20.iso /media/VBoxGuestAdditions
# sh /media/VBoxGuestAdditions/VBoxLinuxAdditions.run
# rm VBoxGuestAdditions_5.2.20.iso
# umount /media/VBoxGuestAdditions
# rmdir /media/VBoxGuestAdditions
  • しかし、yum installだと新しいkernel-develをとってきてしまい、必ずしもkernelのバージョンと一致せず、駄目らしい。手動で kernelのバージョンにあうkernel-develをインストールする。

参考:Install Linux kernel-devel

uname -r
rpm -qa | grep kernel-devel
KERNEL_DEVEL_WRONG_VERSION=`rpm -qa | grep kernel-devel`
echo ${KERNEL_DEVEL_WRONG_VERSION}
rpm -e --nodeps ${KERNEL_DEVEL_WRONG_VERSION}
rpm -qa | grep kernel-devel
ls -l /usr/src/kernels/
KERNEL_VERSION=`uname -r`
KERNEL_DEVEL_EXPECTED_VERSION=kernel-devel-${KERNEL_VERSION}
echo ${KERNEL_DEVEL_EXPECTED_VERSION}
cd /usr/local/src
wget --no-check-certificate https://buildlogs.centos.org/c7.2003.00.x86_64/kernel/20200331233310/3.10.0-1127.el7.x86_64/kernel-devel-3.10.0-1127.el7.x86_64.rpm
ls -l ${KERNEL_DEVEL_EXPECTED_VERSION}.rpm
rpm -ivh ${KERNEL_DEVEL_EXPECTED_VERSION}.rpm
rpm -qa | grep kernel-devel
ls -l /usr/src/kernels/
ls -l /lib/modules/${KERNEL_VERSION}/build/
  • 結果、フォルダの共有が成功。
C:\vagrant\centos7>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Rsyncing folder: /cygdrive/c/vagrant/centos7/ => /vagrant
==> default: Mounting shared folders...
    default: /vagrant_data => C:/vagrant/data
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?