Install VirtualBox Guest Additions for openEuler 20.03 SP1
Hollow Man
Posted on October 27, 2021
This article mainly discusses encountered issues and solutions when I installed VirtualBox Guest Additions for OpenEuler 20.03 SP1.
After installing openEuler 20.03 SP1, log in to openEuler (I login as root here, if you are a regular user, you may need to use
sudo
when executing commands below), and then clickDevice
->Insert Guest Additions CD image...
to load the latest version of the Guest Additions CD into the system.Mount the CD:
mkdir -p /run/media/openeuler/VBoxAdditions
mount /dev/sr0 /run/media/openeuler/VBoxAdditions
cd /run/media/openeuler/VBoxAdditions
- If you choose to install directly as usual, it may prompt an error for extraction because the system lacks the
tar
extraction program in the case of minimal installation. So install it:
dnf update
dnf install tar
- Run the installation:
./VBoxLinuxAdditions.run
You can see there exists an error. Let's take a look at the details of the error:
cat /var/log/vboxadd-setup.log
It can be seen that it is a compilation error. According to Linux kernel documentation, the access_ok
function has been changed from passing three parameters to passing two parameters after the Linux kernel version 5. VBoxAdditions judges whether to use three or two parameters by the Linux version number. However, the kernel version number used by openEuler 20.03 SP1 is 4, but the patches later than the Linux kernel version 5 for this have been applied. As a result, the access_ok
function only needs two parameters in this case, so we only need to change the VBoxAdditions source code to let it call access_ok
with two parameters.
- Modify the source code of VBoxAdditions (note that the corresponding path is changed according to the version number of VBoxAdditions):
cd /opt/VBoxGuestAdditions-6.1.22/src/vboxguest-6.1.22/vboxguest/r0drv/linux
vi memuserkernel-r0drv-linux.c
Use i to edit, and change the following two places RTLNX_VER_MIN(5,0,0)
to RTLNX_VER_MIN(4,0,0)
:
Then press the ESC
key, :wq
save and exit.
There is also a same issue in another file, so continue to execute the command:
cd ../../../vboxsf
vi regops.c
Then press the ESC
key, :wq
save and exit.
- Finally continue the installation:
/sbin/rcvboxadd setup
Installation is complete!
Finally, the VirtualBox Guest Addition can be used after restarting the system!
Posted on October 27, 2021
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.