ERROR: Unable to open policy //etc/selinux/targeted/policy/policy.31

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

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.