이 세상에 하나는 남기고 가자

이 세상에 하나는 남기고 가자

세상에 필요한 소스코드 한줄 남기고 가자

VirtualBox 5.1.20 버전업 후 Vagrant Shared Folders mount 오류 해결

유영재

개발 환경 구성을 위해 Vagrant를 사용중이다. 그런데 얼마전 VirtualBox를 5.1.20으로 업데이트하고 나니 Shared Folders를 mount 하는 과정에서 오류가 발생했다.

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 dmode=755,fmode=644,uid=1000,gid=1000 vagrant /vagrant

The error output from the command was:

mount: wrong fs type, bad option, bad superblock on vagrant,
       missing codepage or helper program, or other error

       In some cases useful info is found in syslog - try
       dmesg | tail or so.

나의 경우는 shared folders를 사용하지 않고 nfs mount를 사용하고 있어 사용 상에 문제가 되는 부분은 없었으나 실행시 마다 오류가 나타나는 것도 보기 싫고 vagrant up을 한번 더 해줘야 시작시 실행되는 스크립트가 정상 실행되었기 때문에 해결하기 위해 찾아봤다(사실 비슷한 문제에 대해 "VirtualBox 버전업 후 Vagrant synced_folder 설정에서 오류가 날 경우"라는 글을 쓴 적이 있었지만 이번엔 다른 문제였다).

검색해보니 일본어로 되어 있긴 하지만 "VirtualBox 5.1.20で共有フォルダーが動かなくなる対策" 글에 해결 방법이 나와 있었다.

간단한 해결 방법을 소개하자면 아래의 명령을 vagrant vm 내부에서 실행하면 된다.

sudo rm /sbin/mount.vboxsf && sudo ln -s /usr/lib/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf

이후에 vagrant를 재시작 해주면 문제는 해결된다.

재시작하기 싫다면 아래의 명령을 추가로 실행해서 즉시 mount 하는 것도 가능하다.

sudo mount -t vboxsf -o dmode=755,fmode=644,uid=1000,gid=1000 vagrant /vagrant
comments powered by Disqus