If Not True Then False

VirtualBox Guest Additions on Fedora 25/24, CentOS/RHEL 7.3/6.8/5.11 - Comment Page: 7

This is guide, howto install Oracle VirtualBox Guest Additions on Fedora, CentOS and Red Hat (RHEL). This guide should work with Fedora 25/24/23/22/21/20/19/18/17/16, CentOS 7.3/6.8/5.11, Red Hat (RHEL) 7.3/6.8/5.11. VirtualBox Guest Additions is special software that can be installed inside Linux virtual machines to improve performance and make integration much more seamless. Among the features...
Categories:

236 Comments

Leave a Comment

Your email address will not be published. Required fields are marked *

Input your comment.
help

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Input your name.

Rafael

Hi JR,
I have installed one Oracle Linux 6.6 hosted by Windows. I’m student and I used your post to install Guest Additions, just to split my screen in two parts, but after reboot process the Oracle VM VirtualBox is not resizing the screen. Could you please help me to solve this problem?

Regeards,
Rafael

reply Reply
Shashank

su –
mkdir /media/vboxguest
run df -h
see where areyou seeing your VirtualBoxGuestAdditions media mostly in /media/VirtualBoxGuestAdditions or run/media/root/VirtualBoxGuestAdditions (on RHEL7)
go to that directory and execute cp /VBoxLinuxAdditions.run /media/vboxguest/
yum update kernel*
yum install gcc kernel-devel kernel-headers dkms make bzip2 perl
cd /media/vboxguest
run ./VBoxLinuxAdditions.run

no need to do any other step. in my case it worked always and have tried more than 20 times.

reply Reply
Jochen

Thanks a lot for this post! It was a life-saver for me.
In certain regards I am forced to use CentOS and I don’t understand why this is so annoying compared to Ubuntu.

reply Reply
niro

Thanks a Lot. Installed GA successfully for Centos 6.5 on VirtualBox with your guidelines.

reply Reply
Marc

Unfortunately my install with a Red Hat 6.7 guest failed during the:
sh ./VBoxLinuxAdditions.run

The output indicated:
Building the OpenGL support module [FAILED]
(Look at /var/log/vboxadd-install.log to find out what went wrong)

The logfile indicated:

make KERNELRELEASE=2.6.32-573.1.1.el6.x86_64 -C /lib/modules/2.6.32-573.1.1.el6.x86_64/build M=/var/lib/dkms/vboxguest/4.3.30/build………(bad exit status: 2)
Error! Bad return status for module build on kernel: 2.6.32-573.1.1.el6.x86_64 (x86_64)
Consult /var/lib/dkms/vboxguest/4.3.30/build/make.log for more information.

and that logfile indicated:

In file included from /var/lib/dkms/vboxguest/4.3.30/build/vboxvideo/vboxvideo_drm.c:79:
include/drm/drmP.h:64:26: error: uapi/drm/drm.h: No such file or directory
include/drm/drmP.h:65:31: error: uapi/drm/drm_mode.h: No such file or directory

uapi/drm exists under /usr/include, so creating a symbolic link resulted in a different error in this log:

/var/lib/dkms/vboxguest/4.3.30/build/vboxvideo/vboxvideo_drm.c:129: error: ‘drm_mmap’ undeclared here (not in a function)
make[2]: *** [/var/lib/dkms/vboxguest/4.3.30/build/vboxvideo/vboxvideo_drm.o] Error 1

If I look at vboxvideo_drm.c, the corresponding code is:


# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
/* This shouldn't be necessary even for old kernels as there is
* nothing sensible to mmap. But we play safe and keep it for
* legacy reasons. */
.mmap = drm_mmap,
# endif

so it appears that VirtualBox hasn't pulled in the correct headers, or has a kernel mismatch.
Any idea what the source of the problem might be?
Thanks

reply Reply
aga

Thank’s
After

export MAKE=’/usr/bin/gmake -i’

It work’s.

reply Reply
LymanZerga

Unbelievable! This solution was posted 5 years ago and still helping to the folks!. Thank you so much JR

reply Reply
Lakshmi

I am getting building opengl support failed error after doing these steps. Currently I have centOS6.7 version and virtual box 5.0

reply Reply
JR

Hello Marc and Lakshmi,

You are totally right. VBoxGuestAdditions are not compatible with CentOS 6.7 kernel. Easy way is install older kernel and kernel-devel and use it. First update your host system and VirtualBox to version 5.0.2.

Then install CentOS 6.6 kernel


yum localinstall http://vault.centos.org/6.6/os/x86_64/Packages/kernel-2.6.32-504.el6.x86_64.rpm http://vault.centos.org/6.6/os/x86_64/Packages/kernel-devel-2.6.32-504.el6.x86_64.rpm

Then reboot and select kernel-2.6.32-504

Compile VirtualBox Linux Additions


./VBoxLinuxAdditions.run

And reboot once again and select kernel-2.6.32-504.

Next step is protect older kernel version, so yum update shouldn’t remove it:


yum install yum-plugin-versionlock

yum versionlock add kernel-2.6.32-504.el6 kernel-devel-2.6.32-504.el6

Now you should have working VirtualBox Guest Additions on CentOS 6.7. You could try to rebuild Guest Additions when new kernels are released, but this is just simple workaround until Vbox Guest Additions are fixed.

reply Reply
curts

I used this info to build the Guest Additions for CentOS 6.6, which works correctly, but I don’t understand how this works with CentOS 6.7. When I boot the v6.7 kernel, VirtualBox 4.3.30 tells me the Guest Additions are not installed. What am I missing here? Is there something I can run in the /opt Guest Additions folder that will install the Guest Additions into the v6.7 runtime environment without rebuilding them?

reply Reply
JR

Hi curts,

You have to use 6.6 kernel if you want to use Guest Additions.

So you can use 6.7 kernel without Guest Additions or use 6.6 kernel with Guest Additions.

reply Reply
JP

I have found a work-around to using guest-additions with CentOS 6.7 kernel:
export MAKE=’/usr/bin/gmake -i’

reply Reply
lynn

Thank you so much for the information. I just upgraded to centOS 6.7 last night. This morning, I got “VBoxClient: the VirtualBox kernel service is not running. Exiting”. After finding this post about VBoxGuestAdditions are not compatible with the centOS6.7, I did the first step: install centOS6.6 kernel, and reboot and select kernel 2.6.32-504. The error message didn’t show up this time. Now, I need to do the second step: compile the VirtualBoxLinuxAdditions. In which folder should I run the command “./VirtualBoxLinuxAdditions.run”? My system could not find the command. Thank you for your help!

reply Reply
JR

You are welcome!

Just run following commands:


mkdir /media/VirtualBoxGuestAdditions
mount -r /dev/cdrom /media/VirtualBoxGuestAdditions

cd /media/VirtualBoxGuestAdditions
./VBoxLinuxAdditions.run

Or directly:


/run/media/[username]/VBOXADDITIONS_*/VBoxLinuxAdditions.run

## Example ##
/run/media/lynn/VBOXADDITIONS_*/VBoxLinuxAdditions.run
reply Reply
sawta

FYI fedora users:

Yum is depreciated in Fedora 22. For step 3, instead of “yum update kernel*” run:
dnf update kernel*

For those having problems with Step 6: “./VBoxLinuxAdditions.run” try the following:

Make sure you are set as root (su -, like it said in the beginning of the tutorial)
cd /run/media/YOURUSERNAMEHERE/
ls

You should see something like: VBOXADDITIONS_5.0.2_102096

cd VBOXADDITIONS_5.0.2_102096 (OR WHATEVER YOUR LISTED VBOXADDITION NUMBERS WERE)
./VBoxLinuxAdditions.run
reboot

Done! :)

reply Reply
JR

Hi sawta,

I updated step 3. thanks.

If you run step 2. commands and then step 6. commands, then you shouldn’t have problems. :)


mkdir /media/VirtualBoxGuestAdditions
mount -r /dev/cdrom /media/VirtualBoxGuestAdditions

cd /media/VirtualBoxGuestAdditions
 
# 32-bit and 64-bit systems run following
./VBoxLinuxAdditions.run

Actually it’s maybe better change step 2. and step 3. order.

reply Reply
Dale

Thanks for the great site. I don’t know who you are but you’ve done a great job providing a lot of very useful information. Thanks for all your time and effort.

reply Reply
Dale

You might want to point out in step 6 that if you’re installing guest additions on Fedora server (and I assume server versions of the other distributions) then the output will be slightly different. I got a message that I didn’t save that the windows and graphics installation would be skipped because no X system was found and the installation would be skipped. It was a bit confusing because the output just terminated at that and I didn’t get the notice to reboot. After rebooting, though, I found that my host shared folder was mounted and I could copy files onto my server.

Thanks for a great document.

reply Reply
Harry G.

Thanks s lot!
For CentOS 7, at least a GUI-less infrastructure server, this was sufficient:

yum update kernel*
yum install gcc kernel-devel bzip2
KERN_DIR=/usr/src/kernels/`uname -r`
export KERN_DIR
mkdir /media/cdrom
mount -r /dev/cdrom /media/cdrom
cd /media/cdrom
./VBoxLinuxAdditions.run

reboot

So it was a bit easier, I did not need kernel-headers, dkms, perl nor the epel rpm .
dkms was even unknown in my CentOS7.
kernel-headers were already included in kernel-devel

reply Reply
rodride

hi
how to install virtualbox guest additions 5.0.4 in fedora 23 workstation beta ?
I try many times but i don’t succeed : i have this message “Warning : unsupported pre-release version of X.Org Server installed. Not installing the X.Org drivers.”

Any ideas please ?

reply Reply
Martins

For some reason my fedora did not use kernel 4.2.3 but uses 4.0.4.
“dnf install kernel-devel” installs headers for 4.2.3
therefore vboxaddition build fails.
Command:
dnf install “kernel-devel-$(uname -r)”
worked for me as fix.

However I’m still amazed that very fresh install of fedora uses older kernel and uses newer as backup.

reply Reply
Martins

Ok, I got it. I missed “reboot” command after “dnf update kernel”.

Thats why I was still running on older kernel than actually installed.

reply Reply