VirtualBox Guest Additions on Fedora 34/33, CentOS/RHEL 8/7/6/5 - Comment Page: 12
This is guide, howto install Oracle VirtualBox Guest Additions on Fedora, CentOS and Red Hat (RHEL). This guide should work with Fedora 34/33/32/31/30, CentOS 8.2/7.8/6.10/5.11, Red Hat (RHEL) 8.2/7.8/6.10/5.11.
VirtualBox Guest Additions is special software that can be installed inside Linux virtual machines to improve performance and make integration much more seamless. Among the features provided by these VirtualBox Guest Additions are mouse pointer integration and arbitrary screen solutions (e.g. by resizing the guest window).
Check video version of guide:
Watch More Videos and Subscribe to if-not-true-then-false.com Youtube Channel
Note: Fedora 34/33/32/31/30...
Sorry, I tried twice. No luck!
…
[[email protected] ~]$ sudo -i
[[email protected] ~]# dnf install gcc kernel-devel kernel-headers dkms make bzip2 perl
Last metadata expiration check: 0:49:48 ago on Sun 23 Sep 2018 03:39:52 PM CST.
Package gcc-7.3.1-6.fc27.x86_64 is already installed, skipping.
Package kernel-devel-4.18.7-100.fc27.x86_64 is already installed, skipping.
Package kernel-headers-4.18.7-100.fc27.x86_64 is already installed, skipping.
Package dkms-2.6.1-1.fc27.noarch is already installed, skipping.
Package make-1:4.2.1-4.fc27.x86_64 is already installed, skipping.
Package bzip2-1.0.6-24.fc27.x86_64 is already installed, skipping.
Package perl-4:5.26.2-407.fc27.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
[[email protected] ~]# KERN_DIR=/usr/src/kernels/`uname -r`/build
[[email protected] ~]# export KERN_DIR
[[email protected] ~]# cd /run/media/thomas/VBox_GAs_5.2.18/
[[email protected] VBox_GAs_5.2.18]# ./VBoxLinuxAdditions.run
Verifying archive integrity… All good.
Uncompressing VirtualBox 5.2.18 Guest Additions for Linux……..
VirtualBox Guest Additions installer
Removing installed version 5.2.18 of VirtualBox Guest Additions…
Copying additional installer modules …
Installing additional modules …
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while.
VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrong
VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: modprobe vboxsf failed
[[email protected] VBox_GAs_5.2.18]#
…
Hi Thomas,
Looks like VBox_GAs_5.2.18 is currently broken with latest kernel+gcc. I just tested VirtualBox Guest Additions 5.2.x revision 125028 (5.2.19) and it builds and works as expected. You can find all testbuild from here.
Hi JR, I was having the same problem as Thomas. I downloaded the .iso you linked above, and while the setup does run for longer, and gets passed the sharedfolder install stage, it still fails with modprobe vboxsf failed.
Going to /var/log/vboxaddsetup.log before trying your fix gave a long error, but on the new version all I see is:
Building the main Guest Additions module.
Building the shared folder support module.
Building the graphics driver module.
Any ideas?
Thanks,
Ryan
Hi Ryan,
Did you reboot your system after install (step 7.)? It shows error message when it tries to modprobe vboxsf, but after reboot it works for me.
Does not work.
— Linux fedora-base.local 4.18.10-200.fc28.x86_64 #1 SMP Wed Sep 26 09:48:36 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
— VirtualBox Version 5.2.18 r124319 (Qt5.11.1), from Fedora repos
— Extension pack 5.2.18 DLed from Oracle site
— vboxadd-setup.log
Building the main Guest Additions module.
Building the shared folder support module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= -C /lib/modules/4.18.10-200.fc28.x86_64/build SUBDIRS=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j2 modules
make[1]: warning: -jN forced in submake: disabling jobserver mode.
mkdir -p /tmp/vbox.0/.tmp_versions ; rm -f /tmp/vbox.0/.tmp_versions/*
…
gcc -Wp,-MD,/tmp/vbox.0/.VBoxGuestR0LibIdc-unix.o.d -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/8/include -I./arch/x86/include -I./arch/x86/include/generated -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 -pipe -Wno-sign-compare -fno-asynchronous-unwind-tables -mindirect-branch=thunk-extern -mindirect-branch-register -DRETPOLINE -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 -fvar-tracking-assignments -g -pg -mfentry -DCC_USING_FENTRY -Wdeclaration-after-statement -Wno-pointer-sign -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 -mrecord-mcount -Wno-declaration-after-statement -fshort-wchar -include /tmp/vbox.0/include/VBox/VBoxGuestMangling.h -fno-pie -I/lib/modules/4.18.10-200.fc28.x86_64/build/include -I/tmp/vbox.0/ -I/tmp/vbox.0/include -I/tmp/vbox.0/r0drv/linux -I/tmp/vbox.0/vboxsf/ -I/tmp/vbox.0/vboxsf/include -I/tmp/vbox.0/vboxsf/r0drv/linux -D__KERNEL__ -DMODULE -DRT_OS_LINUX -DIN_RING0 -DIN_RT_R0 -DIN_SUP_R0 -DVBOX -DVBOX_WITH_HGCM -DIN_MODULE -DIN_GUEST_R0 -DRT_NO_EXPORT_SYMBOL -DRT_ARCH_AMD64 -DVBOX_WITH_64_BITS_GUESTS -DMODULE -DKBUILD_BASENAME='”VBoxGuestR0LibIdc_unix”‘ -DKBUILD_MODNAME='”vboxsf”‘ -c -o /tmp/vbox.0/VBoxGuestR0LibIdc-unix.o /tmp/vbox.0/VBoxGuestR0LibIdc-unix.c
/tmp/vbox.0/utils.c: In function ‘sf_init_inode’:
/tmp/vbox.0/utils.c:165:28: error: passing argument 1 of ‘sf_ftime_from_timespec’ from incompatible pointer type [-Werror=incompatible-pointer-types]
sf_ftime_from_timespec(&inode->i_atime, &info->AccessTime);
sf_ftime_from_timespec(&inode->i_atime, &info->AccessTime);
^~~~~~~~~~~~~~~
/tmp/vbox.0/utils.c:53:53: note: expected ‘struct timespec *’ but argument is of type ‘struct timespec64 *’
Hi RW Shore,
You should download VBoxGuestAdditions from here. Check note on step 3.
Well done brada
Kudos, very nice guide.
I’m currently using the free developer subscription for RHEL 7.6.
At least for the server, the EPEL project recommends that you also enable the optional and extras repositories since EPEL packages may depend on packages from these repositories:
subscription-manager repos –enable “rhel-*-optional-rpms” –enable “rhel-*-extras-rpms”
You’re welcome! Good point, thanks for this information.
you saved my life here ty :)
KERN_DIR=/usr/src/kernels/4.15.6-300.fc27.x86_64/build
I don’t have the “build” folder here on fedora28 after following the step.
Should I create ? where should this point to ?, to a directory containing the makefile ?
Hi lighta,
Yes, you don’t have that directory at all! Installer will do it when you run it, then when build is finished, this directory is removed. So no, you shouldn’t create it, just set your KERN_DIR variable and run installer.
VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what went wrong
Hi Quark,
Could you post real error message(s) from console or from log file?
I had this problem for a while (Guest is CentOS 7.5). Today I found a VBox GA ticket that states the Testing build (GA 5.2.23) solves it. I downloaded it and complied GA on my CentOS 7.5 Guest. It works!!!
https://www.virtualbox.org/wiki/Testbuilds
(Latest 5.2.x test builds – Guest Additions)
On CentOS 7, I skipped adding the repo with RPM and also step 5 and it seemed to work fine.
Hi Brian,
Did you really get dkms installed without epel repo? Or did you have epel repo already installed?
But yes, step 5. is optional until everything works, but some cases it’s needed.
Installed CentOS7 via VM on my MacBook, and was trying to get Guest Additions to work. This was exactly what I was searching for, and it worked first time through. Thank you!
KERN_DIR=/usr/src/kernels/`uname -r`/build
that builds a path that doesn’t exist.
Hi victor,
Yes, and that’s right, it shouldn’t exits. Installer use that environment variable and create that directory, when build is ready, then it’s removed.
./VBoxLinuxAdditions.run
doesn’t work in Fedora 29 as bash doesn’t recognize it, the file on the disk (VirtualBoxGA6.0) is “VBoxLinuxAdditions.run”, select it and then select the run program button in upper right corner.
Hi Bill,
You have to be right directory of course (if you follow this guide, then you are)?
Btw. You do just same thing with your run program button.
I’ve spent maybe whole days trying to get this to work with a CentOS VM, searching endless resources online… until I found your article!
Everything works now, thank you so much!! Really helpful.
[Windows 10 host / VirtualBox 6.0.2 / CentOS 6.10]
[[email protected] VirtualBoxGuestAdditions]$ sudo ./VBoxLinuxAdditions.run && reboot
Verifying archive integrity… All good.
Uncompressing VirtualBox 6.0.4 Guest Additions for Linux……..
VirtualBox Guest Additions installer
This system appears to have a version of the VirtualBox Guest Additions
already installed. If it is part of the operating system and kept up-to-date,
there is most likely no need to replace it. If it is not up-to-date, you
should get a notification when you start the system. If you wish to replace
it with this version, please do not continue with this installation now, but
instead remove the current version first, following the instructions for the
operating system.
If your system simply has the remains of a version of the Additions you could
not remove you should probably continue now, and these will be removed during
installation.
Do you wish to continue? [yes or no]
yes
touch: cannot touch ‘/var/lib/VBoxGuestAdditions/skip-4.20.6-100.fc28.x86_64’: No such file or directory
Copying additional installer modules …
Installing additional modules …
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
VirtualBox Guest Additions: Building the modules for kernel
4.20.6-100.fc28.x86_64.
VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what
went wrong
VirtualBox Guest Additions: Running kernel modules will not be replaced until
the system is restarted
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the modules for kernel
4.20.6-100.fc28.x86_64.
VirtualBox Guest Additions: Look at /var/log/vboxadd-setup.log to find out what
went wrong
VirtualBox Guest Additions: modprobe vboxsf failed
[[email protected] VirtualBoxGuestAdditions]$
I had problems with fedora kernel 4.20.8-200…
after modifying the path to remove the build directory it worked.
From:
KERN_DIR=/usr/src/kernel/4.20.8-200.fc29.x86_64/build
to:
KERN_DIR=/usr/src/kernel/4.20.8-200.fc29.x86_64