When installing Oracle VirtualBox 6.1.4 Guest Addition on Linux, the following errors occur:
# mount /dev/cdrom /media/cdrom # cd /media/cdrom # ./VBoxLinuxAdditions.run Verifying archive integrity… All good. Uncompressing VirtualBox 6.1.14 Guest Additions for Linux…….. VirtualBox Guest Additions installer Removing installed version 6.1.4 of VirtualBox Guest Additions… Copying additional installer modules … Installing additional modules … VirtualBox Guest Additions: Starting. 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: or VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all VirtualBox Guest Additions: Building the modules for kernel 4.14.35-1902.10.7.el7uek.x86_64. ERROR: Can't map '//etc/selinux/targeted/policy/policy.31': Invalid argument ERROR: Unable to open policy //etc/selinux/targeted/policy/policy.31. libsemanage.semanage_read_policydb: Error while reading kernel policy from /etc/selinux/targeted/active/policy.kern. (No such file or directory). OSError: No such file or directory VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted
Check ‘//etc/selinux/targeted/policy/policy.31’ file exists but zero size.
#ls -ltr //etc/selinux/targeted/policy/policy.31 -rw-r--r-- 1 root root 0 May 1 6:03 //etc/selinux/targeted/policy/policy.31
SOLUTION
Install the latest package for “selinux-policy-targeted”.
# yum install selinux-policy-targeted
Then run VirtualBox Guest Additions installer successfully.
# ./VBoxLinuxAdditions.run uninstall # ./VBoxLinuxAdditions.run Verifying archive integrity… All good. Uncompressing VirtualBox 6.1.14 Guest Additions for Linux…….. VirtualBox Guest Additions installer Copying additional installer modules … Installing additional modules … VirtualBox Guest Additions: Starting. 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: or VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all VirtualBox Guest Additions: Building the modules for kernel 4.14.35-1902.10.7.el7uek.x86_64. VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted