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
sudowhen executing commands below), and then click
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
tarextraction program in the case of minimal installation. So install it:
dnf update dnf install tar
- Run the installation:
You can see there exists an error. Let's take a look at the details of the error:
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
Then press the
:wq save and exit.
There is also a same issue in another file, so continue to execute the command:
cd ../../../vboxsf vi regops.c
- Finally continue the installation:
Installation is complete!
Finally, the VirtualBox Guest Addition can be used after restarting the system!