OEL - VBox Guest Additions

On gui-less linux installations it is not always clear how the guest additions can be installed.

This article tries to show how to do this.

The steps to do this are:
  • Get the additions mounted (supposing no cdrom is attached yet) 
  • create cdrom directories 
  • determine the cdrom device 
  • mount the device loosely 
  • install the guest additions 
  • (Install missing packages ... ) 
  • (Retry installation) 
Just click devices > install guest additions
The cdrom will become attached to the vm
Best is to reboot the system at this instance. (Have encountered that for some reason the cd device was no immediately available.)

To be able to mount the cdrom within some instances you will require a directory to mount it to.
Go to the /mnt directory as root user and create some directories with a trailing number.

For example:
mkdir cdrom0
mkdir cdrom1
...for as many as you will find cdroms required ;-)

The trailing number starts best with 0 ... why ... see later.

Determine the cdrom device.
The name of the device depends under which link the cdrom is attached.
If a cdrom is defined as a SATA device the cdrom will become available as sr0, sr1 ...
For the further documentation let 's suppose the device is /dev/sr0

Mount the cdrom by using the following command:
mount /dev/sr0 /mnt/cdrom0
So ... that is why 0 at the end ... ;-)

The output of the command will be something like this:

root@wlspfrd mnt]# mount /dev/sr0 /mnt/cdrom0
mount: block device /dev/sr0 is write-protected, mounting read-only

Go to the cdrom drive:
cd /mnt/cdrom0

[root@wlspfrd mnt]# cd /mnt/cdrom0
[root@wlspfrd cdrom0]# ls
32Bit runasroot.sh VBoxWindowsAdditions.exe
64Bit VBoxLinuxAdditions.run VBoxWindowsAdditions-x86.exe
AUTORUN.INF VBoxSolarisAdditions.pkg
autorun.sh VBoxWindowsAdditions-amd64.exe

To install the additions execute the VBoxLinuxAdditions.run command.
./VBoxLinuxAddtions.run

In a 64-bit Oracle Linux environment you will encounter a problem which is indicated by the line:
Building the main Guest Additions module [FAILED]

The reason is that the build requires the header files of the correct version of the Linux OS.
The line preceeding the FAILED error gives a clear hint:
The following command should solve the problem.
yum install kernel-uek-devel-2.6.32-200.13.1.el5uekPut the package name, in this case kernel-uek-devel-2.6.32-200.13.1.el5uek in the copy buffer

To install this package, the yum repository must be configured (context Oracle)
See the website for this: http://public-yum.oracle.com/
Follow the instructions.
cd /etc/yum.repos.d
for Oracle Linux 5:
          wget http://public-yum.oracle.com/public-yum-el5.repo
for Oracle Linux 6:
          wget http://public-yum.oracle.com/public-yum-el6.repo
In the obtained file enable (value = 1) the correct version (warning if you enable the latest version the update may take a long time ... ).

After installation of the yum repository, retry the installation of VBox additions.
This should now succeed.

After this any shared folder will become available in the /media directory.

Update dd 02-feb-2014


When using version 6 update 3 of Oracle Linux, it seems not possible to get the correct Kernel headers for the uek. At least it should be possible to find them ... but I did not find them, or at least ... not as fast as I wanted. Just used a short-circuit to get things working fast ... 

I followed these steps:
  • boot with the non-uek kernel
    This can be achieved by:
    • or change the kernel at boot time
    • or change the default boot instance in the /boot/grub/grub.conf file
  • Make sure gcc and the kernel-devel packages are installed (using yum install gcc kernel-devel kernel-headers)
  • running VBoxLinuxAdditions.run -> this should not fail anymore
  • you will find in the /media any shared folder
  • now ... reboot in
    • uek -> seems to work ... but not really guaranteed because of the difference in the compile-time and runtime-kernel versions
    • run in the version as was compiled 
      • make the kernel version permanent in the grub.conf if not already done so

Update 4-feb-2014

Context Delta : Oracle Linux 6.3 base installation with Database Server option.
Even though the kernel was booted with the compatible version (RHEL) the openGL compilation failed. All major requirements like folder sharing and screen sizing do not work.
Found on a site the hint to do an export  MAKE="/usr/bin/gmake -i " before launching the VBoxLinuxadditions.run command.
This solved immediately the problem of the shared folders not being accessible under /media/sf_*.
It did not solve the problem of the windows resizing.
After a reboot with the original UEK kernel (in OL 6.3) which caused the Shared folders not being accessible anymore.
Starting to update to really latest version of OL v6 ... see if things will be more smooth then ...
... and yes it did.
So ... changed  config file in the yum.repos.d directory to retrieve the latest versions, which at this moment in time seems to be 6.5.1. Performed a simple yum update which took 40 MB to download and install. Rebooted with the new kernel.
Mounted the cdrom again and started the installation of the VBoxGuestAdditions again.
This time no errors were encountered ... with the exception of the Window System Drivers.
Will try to fix that too.

Good Luck

No comments: