TL;DR --When I updated to CentOS8-> CentOS Stream release 8 using VirtualBox6.1.16, the shared folder did not work, so I will describe how to solve it. --Partially modify the guest source of Guest Additions to deal with it. --Since it's a Guest Additions bug, it's likely to be resolved in a later version of VirtualBox.
--Assuming you already have CentOS 8 with VirtualBox 6.1.16. It is also assumed that you are using a shared folder. --I'm using vagrant 2.2.14.
--Update to CentOS Stream release 8 → Notice the error of the shared folder when restarting → Reinstall Guest Additions (failure) → Correct the source → Reinstall Guest Additions (success). * Actually, it can be simplified --All command input in the following procedure assumes root privileges. sudo is preferable, but root is easy to write articles. .. .. When using sudo, please read as appropriate.
https://www.centos.org/centos-stream/ Then, update with the following command.
dnf install centos-release-stream
dnf swap centos-{linux,stream}-repos
dnf distro-sync
When the guest OS is restarted, the following error message may be displayed at startup. It says that vboxsf cannot be found.
(Omitted in the middle)
==> default: Mounting shared folders...
default: /vagrant => C:/XXXXXX/YYYYYY/ZZZZZZ
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=777,fmode=666,uid=1000,gid=1000 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
This kind of error often occurs due to different versions of Guest Additions on the host side and guest side, and it can be fixed by reinstalling Guest Additions. This time the host side is the latest VirtualBox as of December 2020, so I doubt the Guest side. Reinstall Guest Additions with CentOS Stream release 8 running. Mount the Guest Additions CD image with the following command and perform the reinstallation.
mkdir /mnt/cdrom
mount /dev/cdrom /mnt/cdrom/
/mnt/cdrom/VBoxLinuxAdditions.run
When the guest OS is restarted, the following error message is displayed at startup. I haven't fixed it. .. ..
(Omitted in the middle)
==> default: Mounting shared folders...
default: /vagrant => C:/XXXXXX/YYYYYY/ZZZZZZ
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=777,fmode=666,uid=1000,gid=1000 vagrant /vagrant
The error output from the command was:
/sbin/mount.vboxsf: mounting failed with the error: No such device
Here, when I checked /var/log/vboxadd-setup.log, it was found. The location of the error. Apparently there is an error on line 568 of vfsmod.c.
/var/log/vboxadd-setup.log
(Omitted in the middle)
(cat /dev/null; echo kernel//tmp/vbox.0/vboxsf.ko;) > /tmp/vbox.0/modules.order
gcc -Wp,-MD,/tmp/vbox.0/.vfsmod.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -I./include/drm-backport -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fshort-wchar -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -fno-PIE -DCC_HAVE_ASM_GOTO -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_AVX512=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -DCONFIG_TPAUSE=1 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -fno-jump-tables -fno-delete-null-pointer-checks -Wno-frame-address -Wno-format-truncation -Wno-format-overflow -Wno-int-in-bool-context -O2 --param=allow-store-data-races=0 -Wframe-larger-than=2048 -fstack-protector-strong -Wno-unused-but-set-variable -Wno-unused-const-variable -g -gdwarf-4 -pg -mrecord-mcount -mfentry -DCC_USING_FENTRY -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -Wno-stringop-truncation -fno-strict-overflow -fno-merge-all-constants -fmerge-constants -fno-stack-check -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -Werror=date-time -Werror=incompatible-pointer-types -Werror=designated-init -fmacro-prefix-map=./= -Wno-packed-not-aligned -Wno-declaration-after-statement -fno-pie -include /tmp/vbox.0//include/VBox/VBoxGuestMangling.h -fshort-wchar -I./include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -D__KERNEL__ -DMODULE -DRT_WITHOUT_PRAGMA_ONCE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DIN_MODULE -DIN_GUEST -DIN_GUEST_R0 -DRT_NO_EXPORT_SYMBOL -DVBOX_WITH_64_BITS_GUESTS -DRT_ARCH_AMD64 -DMODULE -DKBUILD_BASENAME='"vfsmod"' -DKBUILD_MODNAME='"vboxsf"' -c -o /tmp/vbox.0/.tmp_vfsmod.o /tmp/vbox.0/vfsmod.c
/tmp/vbox.0/vfsmod.c:Function ‘vbsf_read_super_In aux ’:
/tmp/vbox.0/vfsmod.c:568:17:error: ‘MS_REMOUNT’ undeclared (first use in this function); did you mean ‘DT_RELCOUNT’?
if (flags & MS_REMOUNT) {
^~~~~~~~~~
DT_RELCOUNT
/tmp/vbox.0/vfsmod.c:568:17:Remarks:Undeclared identifiers are reported only once within each function that appears
make[2]: *** [scripts/Makefile.build:316: /tmp/vbox.0/vfsmod.o]Error 1
make[1]: *** [Makefile:1545: _module_/tmp/vbox.0] Error 2
make: *** [/tmp/vbox.0/Makefile-footer.gmk:117: vboxsf] Error 2
Could not find the X.Org or XFree86 Window System, skipping.
For details, see https://www.virtualbox.org/ticket/20091, the version condition judgment error.
vim /opt/VBoxGuestAdditions-6.1.16/src/vboxguest-6.1.16/vboxsf/vfsmod.c
In, the contents of the 48th line,
vfsmod.c
#if RTLNX_VER_MIN(5,0,0)
↓ Modify and save as follows.
vfsmod.c
#if RTLNX_VER_MIN(5,0,0) || RTLNX_RHEL_MIN(8,4)
After completing the above work, restart the guest OS.
This is the third guest OS restart.
(Omitted in the middle)
default: /vagrant => C:/XXXXXX/YYYYYY/ZZZZZZ
==> default: Detected mount owner ID within mount options. (uid: 1000 guestpath: /vagrant)
==> default: Detected mount group ID within mount options. (gid: 1000 guestpath: /vagrant)
It worked fine. You did it! : grinning: If you SSH into the guest OS and look at the contents of/vagrant, you'll see that the shared folder is working.
--After noticing the error in the output of vagrant and checking dmesg and syslog, you can find out the details of the cause of the error in /var/log/vboxadd-setup.log, search Google and https://www.virtualbox.org/ I arrived at ticket/200011. It took me a while to notice the contents of /var/log/vboxadd-setup.log, so that's the point of reflection.
Recommended Posts