Install VirtualBox Guest Additions for openEuler 20.03 SP1

This article mainly discusses encountered issues and solutions when I installed VirtualBox Guest Additions for OpenEuler 20.03 SP1.

  1. 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 click Device -> Insert Guest Additions CD image... to load the latest version of the Guest Additions CD into the system.

  2. Mount the CD:

mkdir -p /run/media/openeuler/VBoxAdditions
mount /dev/sr0 /run/media/openeuler/VBoxAdditions
cd /run/media/openeuler/VBoxAdditions

  1. 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

  1. Run the installation:

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.

  1. 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.

  1. Finally continue the installation:
/sbin/rcvboxadd setup

Installation is complete!

Finally, the VirtualBox Guest Addition can be used after restarting the system!

Source link