Monday, December 24, 2012

Install VirtualBox on Oracle Linux 5

Download latest version from http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html

Install rpm 


rpm -ivh VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm
warning: VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 98ab5139
Preparing...                ########################################### [100%]
   1:VirtualBox-4.2         ########################################### [100%]

Creating group 'vboxusers'. VM users must be member of that group!

No precompiled module for this kernel found -- trying to build one. Messages
emitted during module compilation will be logged to /var/log/vbox-install.log.

Stopping VirtualBox kernel modules [  OK  ]
Recompiling VirtualBox kernel modules [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong)

Installation of VirtualBox is partially complete.
Lets look at vbox-install log.
cat  /var/log/vbox-install.log
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop.

Basically recompiling kernel to include vboxdrv kernel module failed. 
Because its not able to locate kernel headers.
Run rpm command again and it shows that virtualbox is already installed, even though the
vboxdrv kernel module is not loaded.


 rpm -ivh VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm
warning: VirtualBox-4.2-4.2.6_82870_el5-1.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 98ab5139
Preparing...                ########################################### [100%]
        package VirtualBox-4.2-4.2.6_82870_el5-1.x86_64 is already installed



To install the kernel module  run "sudo /etc/init.d/vboxdrv setup"
#sudo /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Recompiling VirtualBox kernel modules                      [FAILED]
  (Look at /var/log/vbox-install.log to find out what went wrong)
[root@slc03dml downloads]# cat /var/log/vbox-install.log
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop.
Makefile:181: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again.  Stop. 

 Tried below commmand to install kernel headers


#yum install kernel-headers-`uname -r`
base                                                                                                     | 1.1 kB     00:00   
el5_latest                                                                                               | 1.4 kB     00:00   
ol5_u6_base                                                                                              | 1.1 kB     00:00   
Setting up Install Process
No package kernel-headers-2.6.18-238.0.0.0.1.el5xen available.
Nothing to do
/usr/include/asm-generic/fcntl.h from install of
kernel-headers-2.6.18-308.24.1.0.1.el5.x86_64 conflicts with file from package kernel-uek-headers-2.6.32-100.26.2.el5.x86_64

....similar error messages...
Installation of kernel headers fails as kernel-uek-headers is already installed.
List the kernel-uek packages using "yum list kernel-euk"

#yum list kernel-uek
base                                                                                                     | 1.1 kB     00:00   
el5_latest                                                                                               | 1.4 kB     00:00   
ol5_u6_base                                                                                              | 1.1 kB     00:00   
Installed Packages
kernel-uek.x86_64                                       2.6.32-100.26.2.el5                                           installed
Available Packages
kernel-uek.x86_64                                       2.6.32-300.39.2.el5uek                                        el5_latest

Remove kernel-uek headers using " rpm -ev --nodeps kernel-uek-headers"

 # rpm -ev --nodeps kernel-uek-headers
Now install kernel-headers 
#yum install kernel-headers
base                                                                                                     | 1.1 kB     00:00   
ol5_u6_base                                                                                              | 1.1 kB     00:00   
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package kernel-headers.x86_64 0:2.6.18-238.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved
================================================================================================================================
 Package                           Arch                      Version                              Repository               Size
================================================================================================================================
Installing:
 kernel-headers                    x86_64                    2.6.18-238.el5                       base                    1.2 M

Transaction Summary
================================================================================================================================
Install       1 Package(s)
Upgrade       0 Package(s)

Total size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test

 Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : kernel-headers                                                                                           1/1

Installed:
  kernel-headers.x86_64 0:2.6.18-238.el5                                                                                        

Complete!


Now set KERN_DIR 
 export KERN_DIR=/usr/src/kernels/2.6.32-100.26.2.el5
# echo $KERN_DIR
/usr/src/kernels/2.6.32-100.26.2.el5 

 Install virtual box kernel module now
#  sudo /etc/init.d/vboxdrv setup
Stopping VirtualBox kernel modules                         [  OK  ]
Recompiling VirtualBox kernel modules                      [  OK  ]

The recompilation of VirtualBox Kernel modules is successful.
 

 

No comments: