Vagrant 마운트 오류로 알려진 버전 불일치를 해결하는 방법

10100 단어 VirtualBoxVagrant

소개



VirtualBox + Vagrant에서 가상 환경을 시작하기 전에 알림이 왔기 때문에
VirtualBox의 버전 업하고 Vagarant up 하면 에러가 나 버렸다∑(;


환경



· Mac OS X
· Virtualbox 6.1
· Vagrant 2.2.9
· CentOS 8.2

오류 내용


hide@mbp MyCentos % vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-8.2' version '202007.17.0' is up to date...
==> 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: Adapter 2: hostonly
==> 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: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/hide/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=1000,gid=1000 vagrant /vagrant

The error output from the command was:

/sbin/mount.vboxsf: mounting failed with the error: No such device
どうやらこのエラーは
ホスト⇔ゲスト間のフォルダ共有機能を提供しているGuest Additionsが
ホスト(VirtualBox)だけバージョンアップしたことでゲスト(Guest Additions)との
バージョンが不一致したことでマウントエラーが起きたようです

"아니, 둘 다 자동으로 업데이트 해줘....(마음의 목소리)"

그래서 게스트 버전을 올리면 해결할 수 있습니다.

해결 방법



호스트(VirtualBox)를 버전 업하여 vagrant up매번 호스트 (VirtualBox) 버전을 확인하십시오.
게스트 (Guest Additions) 버전도 자동으로 올리는 플러그인을 설치합니다.
그리고 마지막으로 재부팅
hide@mbp MyCentos % vagrant plugin install vagrant-vbguest
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
Fetching micromachine-3.0.0.gem
Fetching vagrant-vbguest-0.24.0.gem
Installed the plugin 'vagrant-vbguest (0.24.0)'!

hide@mbp MyCentos % vagrant reload

좋아!!!!!! 끝난!!!!!!!!라고 생각하면...
hide@mbp MyCentos % vagrant reload
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-8.2' version '202007.17.0' is up to date...
==> 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: Adapter 2: hostonly
==> 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!
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   
VBoxService inside the vm claims: 6.1.12
Going on, assuming VBoxService is correct...
[default] GuestAdditions seems to be installed (6.1.12) correctly, but not running.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   
VBoxService inside the vm claims: 6.1.12
Going on, assuming VBoxService is correct...
Redirecting to /bin/systemctl start vboxadd.service
Job for vboxadd.service failed because the control process exited with error code.
See "systemctl status vboxadd.service" and "journalctl -xe" for details.
Redirecting to /bin/systemctl start vboxadd-service.service
Job for vboxadd-service.service failed because the control process exited with error code.
See "systemctl status vboxadd-service.service" and "journalctl -xe" for details.
Got different reports about installed GuestAdditions version:
Virtualbox on your host claims:   
VBoxService inside the vm claims: 6.1.12
Going on, assuming VBoxService is correct...
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Kernel headers not found for target kernel 
4.18.0-193.14.2.el8_2.x86_64. Please install them and execute
  /sbin/rcvboxadd setup
ValueError: File context for /opt/VBoxGuestAdditions-6.1.12/other/mount.vboxsf already defined
modprobe vboxguest failed
The log file /var/log/vboxadd-setup.log may contain further information.
==> 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.

*ここからがエラー内容
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/usr/sbin/rcvboxadd setup

Stdout from the command:

VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel 
modules.  This may take a while.
VirtualBox Guest Additions: To build modules for other installed kernels, run
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup <version>
VirtualBox Guest Additions: or
VirtualBox Guest Additions:   /sbin/rcvboxadd quicksetup all
VirtualBox Guest Additions: Kernel headers not found for target kernel 
4.18.0-193.14.2.el8_2.x86_64. Please install them and execute
  /sbin/rcvboxadd setup


Stderr from the command:

ValueError: File context for /opt/VBoxGuestAdditions-6.1.12/other/mount.vboxsf already defined
modprobe vboxguest failed
The log file /var/log/vboxadd-setup.log may contain further information.

hide@mbp MyCentos % cat /var/l
どうやらこのエラーは
起動中の kernel と kernel のヘッダー(kernel-headers)とディベロッパー(kernel-devel)のバージョンが異なることによって発生するらしい...(´;ω;`)

그래서 커널을 업데이트! ! ! ! ! ! !
[vagrant@localhost ~]$ sudo yum -y update kernel && sudo yum -y install gcc kernel-devel kernel-headers make bzip2 perl

그리고 더 이상 오류가 발생하지 않기를 바랍니다, 일단 중지하고 시작! ! ! ! ! !
hide@mbp MyCentos % vagrant halt
==> default: Attempting graceful shutdown of VM...
hide@mbp MyCentos % vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'bento/centos-8.2' version '202007.17.0' is up to date...
==> 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: Adapter 2: hostonly
==> 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] GuestAdditions 6.1.12 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
==> default: Mounting shared folders...
    default: /vagrant => /Users/hide/Myvagrant/MyCentos
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.
hide@mbp MyCentos %

성공했습니다.

마지막으로



이번에 오류를 해결할 수있어서 좋았습니다 ...
실은, 전에도 이 에러가 일어나서 귀찮아서 Docker에 도망쳐 버리고 나서
또한 이것을 만났기 때문에 도망쳐 버린 것에 반성입니다.
여러분도 에러에서 도망친 나를 반면 교사로 하고, 확실히 자기 학습에서도 에러를 해결해 주세요 w
읽어 주셔서 감사합니다!

참고문헌



Vagrant에서 마운트 오류가 발생했을 때 해결하는 방법
VirtualBox guest additions를 설치할 수 없는 경우(CentOS, Fedora)

좋은 웹페이지 즐겨찾기