Install VirtualBox Guest Additions in CentOS (RedHat) Linux Guest

When you try to install the VirtualBox Guest Additions for a Linux guest system, this will fail due to some wired ‘features’ in the installation. This post is based on my experience with VirtualBox 3.0.6 but conceptually it is valid also with current 4.3.x releases.

To perform the installation do the following:
Choose Install Guest Additions... from the VirtualBox menu. Open a terminal window in your guest system. Do a

cd /media/VBOXADDITIONS_3.0.6_52128/
(the foldername will change depending on the VBox version). Proceed as described below.

1. Cannot execute .run file

When you try to execute the installation file (e.g. VBoxLinuxAdditions-amd64.run), you get an error message like this

[root@integration /]# cd /media/VBOXADDITIONS_3.0.6_52128/
[root@integration VBOXADDITIONS_3.0.6_52128]# ./VBoxLinuxAdditions-amd64.run
-bash: ./VBoxLinuxAdditions-amd64.run: /bin/sh: bad interpreter: Permission denied

The solution is to use the command

sh VBoxLinuxAdditions-amd64.run

instead (choosing the right architecture, it was 64bit in this case).

2. Installer complains about missing gcc and Linux kernel headers

The solution to this is to update your kernel to the latest version and install headers and sources for it. VirtualBox requires to compile some drivers when it installs.

Just execute
yum update kernel
yum install gcc
yum install kernel-devel

.
Run the installer again and everything should be ok.

4 Comments

  1. Thanks!

    I love the internet…so helpful.

    Reply
  2. thanks in advancedd..thanks aloooooooooooottt for great helppp..that was my problemm that couldn’t solved by read more websites and forums but this blog is extremely helpful that soled my problemm..thankkkkkss again

    Reply
  3. Ive been searching for long time in all search engine and nothing works.
    this is the only one that works great job!! nice reference!

    Reply
  4. Found the following problem: It is linked to the mounting of the cdrom which gets the noexec flag (seen on CenOS5) :

    [root@localhost VBOXADDITIONS_4.1.18_78361]# mount
    /dev/hdc on /media/VBOXADDITIONS_4.1.18_78361 type iso9660 (ro,noexec,nosuid,nodev,uid=0)

    You can “remount” it (as root) to get rid of the problem:
    mount -o remount,exec /media/VBOXADDITIONS_4.1.18_78361/

    Reply

Submit a Comment

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