Recently I installed Virtual Box 4.1-4 on Redhat 5.5 64 bit. It was a painful experience with some serious Gotchas. The install docs were confusing. They are probably fine for people already quite familiar with the product. But not for newbies.
————-
xen:
One critical issue with Redhat Oracle and Virtual Box is that: VIRTUAL BOX WILL NOT RUN IN AN XEN ENVIRONMENT.
“xen” is not found in the install doc. Nor in the table of contents.
When I first tried to install Virtual Box, I got:
rpm -ivh VirtualBox-4.1-4.1.8_75467_rhel5-1.x86_64.rpm warning: VirtualBox-4.1-4.1.8_75467_rhel5-1.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 98ab5139 Preparing... ########################################### [100%] 1:VirtualBox-4.1 ########################################### [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 ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] Trying to register the VirtualBox kernel modules using DKMS [FAILED] (Failed, trying without DKMS) Recompiling VirtualBox kernel modules [ OK ] Starting VirtualBox kernel modules [FAILED] (Running VirtualBox in a Xen environment is not supported)
————
Hmm. What’s an xen environment?
whatis xen
xen (rpm) – Xen is a virtual machine monitor
xen-libs (rpm) – Libraries for Xen tools
whatis xm
xm (1) – Xen management user interface
How do you tell if you are running xen? See if you get output from the following commands.
xm info
host : black.testrac.com
release : 2.6.18-194.el5xen
version : #1 SMP Mon Mar 29 22:22:00 EDT 2010
machine : x86_64
nr_cpus : 8
nr_nodes : 1
sockets_per_node : 2
cores_per_socket : 4
threads_per_core : 1
cpu_mhz : 2493
hw_caps : bfebfbff:20100800:00000000:00000140:040ce3bd:00000000:00000001
total_memory : 16382
free_memory : 383
node_to_cpu : node0:0-7
xen_major : 3
xen_minor : 1
xen_extra : .2-194.el5
xen_caps : xen-3.0-x86_64 xen-3.0-x86_32p hvm-3.0-x86_32 hvm-3.0-x86_32p hvm-3.0-x86_64
xen_pagesize : 4096
platform_params : virt_start=0xffff800000000000
xen_changeset : unavailable
cc_compiler : gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)
cc_compile_by : mockbuild
cc_compile_domain : us.oracle.com
cc_compile_date : Mon Mar 29 22:07:53 EDT 2010
xend_config_format : 2
--------------
xm top
xentop - 15:33:14 Xen 3.1.2-194.el5
1 domains: 1 running, 0 blocked, 0 paused, 0 crashed, 0 dying, 0 shutdown
Mem: 16775668k total, 16382760k used, 392908k free CPUs: 8 @ 2493MHz
NAME STATE CPU(sec) CPU(%) MEM(k) MEM(%) MAXMEM(k) MAXMEM(%) VCPUS NETS NETTX(k) NETRX(k) VBDS
VBD_OO VBD_RD VBD_WR SSID
Domain-0 -----r 414674 28.8 16015360 95.5 no limit n/a 8 5 172265 1798646 0
0 0 0 0 If you get output similar to the above, then xen is running.
————–
If xen is not running, output will look like:
xm top ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory) ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory) xc_interface_open: No such file or directory Failed to initialize xenstat library xm info ERROR Internal error: Could not obtain handle on privileged command interface (2 = No such file or directory) Error: Unable to connect to xend: No such file or directory. Is xend running? --------------
How to solve the xen problem?
Turns out that xen is not just a process. Your xen kernel is chosen when you boot.
Check /boot/grub/grub.conf
cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda4
# initrd /initrd-version.img
#boot=/dev/sda1
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title Enterprise Linux (2.6.18-194.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-194.el5
module /vmlinuz-2.6.18-194.el5xen ro root=LABEL=/ rhgb quiet
module /initrd-2.6.18-194.el5xen.img
title Enterprise Linux-base (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=LABEL=/ rhgb quiet
initrd /initrd-2.6.18-194.el5.img
title Other
rootnoverify (hd0,1)
chainloader +1 See the kernel with xen?
module /vmlinuz-2.6.18-194.el5xen
Change the grub default to a kernel, without xen:
kernel /vmlinuz-2.6.18-194.el5
And reboot.
You may be wondering if this would affect the databases, software, and services already installed on the server. I rebooted and started them all fine.
————-
Virtual Box Package Pre-Requisites:
One clear part of the docs, is that these two packages are required.
Qt 4.4.0 or higher;
SDL 1.2.7 or higher (this graphics library is typically called libsdl or similar).
————-
Package qt: rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}_%{ARCH}.rpm \n " | grep "qt" | sort qt-3.3.6-23.el5_i386.rpm qt-3.3.6-23.el5_x86_64.rpm qt4-4.2.1-1_i386.rpm qt4-4.2.1-1_x86_64.rpm ... whatis qt qt (rpm) - The shared library for the Qt GUI toolkit. qt-MySQL (rpm) - MySQL drivers for Qt's SQL classes. qt-designer (rpm) - Interface designer (IDE) for the Qt toolkit qt-devel (rpm) - Development files for the Qt GUI toolkit. ------------- Package SDL: rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}_%{ARCH}.rpm \n " | grep -i "sdl" | sort SDL-1.2.10-8.el5_i386.rpm SDL-1.2.10-8.el5_x86_64.rpm SDL-devel-1.2.10-8.el5_i386.rpm SDL-devel-1.2.10-8.el5_x86_64.rpm wsdl4j-1.5.2-4jpp.1_x86_64.rpm whatis sdl SDL (rpm) - A cross-platform multimedia library. SDL-devel (rpm) - Files needed to develop Simple DirectMedia Layer applications. -------------
Now, here is where it gets confusing and some more Gotchas.
dkms:
The docs talk a lot about the package: dkms. dkms is used in other Linux distributions. BUT PACKAGE dkms IS NOT USED IN REDHAT ORACLE.
dkms is not part of the Oracle Redhat distribution. dkms is also completely unavailable if you try to get it via yum.
However, multiple times, both the docs, and error messages refer to dkms. Confusing? You bet! Ignore what the docs say about dkms.
————-
The kernel and package kernel-devel:
On Redhat, for Virtual Box, you also need to install the package: kernel-devel.
And here is another one of those Gotchas: The package, kernel-devel, MUST HAVE EXACTLY THE SAME VERSION AS, the kernel.
To check the kernel versions:
uname -r
2.6.18-194.el5
rpm -qa | grep -i “kernel-devel”
kernel-devel-2.6.18-194.el5
whatis kernel
kernel (rpm) – The Linux kernel (the core of the Linux operating system)
whatis kernel-devel
kernel-devel (rpm) – Development package for building kernel modules to match the kernel
With so many installs with Oracle and other products, they ask for a certain package version, or higher. But not in this case.
I used yum to install kernel-devel. And it installed the highest version it could find: kernel-devel-2.6.32-100.0.19.el5. But my kernel was different: 2.6.18-194.el5.
When I tried reinstalling, I got:
/etc/init.d/vboxdrv setup Stopping VirtualBox kernel modules [ OK ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] Trying to register the VirtualBox kernel modules using DKMS[FAILED] (Failed, trying without DKMS) Recompiling VirtualBox kernel modules [FAILED] (Look at /var/log/vbox-install.log to find out what went wrong) cat /var/log/vbox-install.log Makefile:172: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.
So, when you download kernel-devel, make sure it’s the right version.
—————
KERN_DIR:
The output from the error log above brought me to another Gotcha. The error message I got concerned itself with the kernel source directory. But it was erroneous.
My install didn’t have the kernel source. I then spent a lot of time searching for the correct kernel source. Non xen. Downloading it. Installing it properly. Then I tried recompiling again.
/etc/init.d/vboxdrv setup Stopping VirtualBox kernel modules [ OK ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] Trying to register the VirtualBox kernel modules using DKMS[FAILED] (Failed, trying without DKMS) Recompiling VirtualBox kernel modules [FAILED] (Look at /var/log/vbox-install.log to find out what went wrong) cat /var/log/vbox-install.log Makefile:175: Warning: using /usr/src/linux as the source directory of your Linux kernel. If this is not correct, specify KERN_DIR= and run Make again. Makefile:190: *** Error: unable to find the include directory for your current Linux kernel. Specify KERN_INCL= and run Make again. Stop.
—————-
Then I found out that the real issue was that kernel, and kernel-devel needed to be the same. So the error log was completely wrong. You would figure that the install script would check that the kernel, and kernel-devel were the same, but it does not.
—————-
So I uninstalled, and reinstalled kernel-devel.
Uninstall kernel-devel.
rpm -e kernel-devel-2.6.32-100.0.19.el5
rpm -qa | grep -i “kernel-devel”
– nothing.
Install kernel-devel with yum:
yum install kernel-devel-2.6.18 Loaded plugins: security Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package kernel-devel.x86_64 0:2.6.18-194.el5 set to be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================== Package Arch Version Repository Size ============================================================================================================== Installing: kernel-devel x86_64 2.6.18-194.el5 el5_u5_base 5.5 M Transaction Summary ============================================================================================================== Install 1 Package(s) Upgrade 0 Package(s) Total download size: 5.5 M Is this ok [y/N]: y Downloading Packages: kernel-devel-2.6.18-194.el5.x86_64.rpm | 5.5 MB 00:06 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : kernel-devel 1/1 Installed: kernel-devel.x86_64 0:2.6.18-194.el5 Complete!
————-
In the end, after figuring out what exactly was involved, I uninstalled Virtual Box, and reinstalled it cleanly.
Uninstall Virtual Box:
rpm -e VirtualBox-4.1-4.1.8_75467_rhel5-1
rpm -qa | grep -i “virtual”
– nothing
—————–
Clean Install of Virtual Box:
This is what a clean install looks like.
cd /tmp/virtualbox ls -l -rw-r--r-- 1 oracle dba 75184331 Jan 5 23:47 VirtualBox-4.1-4.1.8_75467_rhel5-1.x86_64.rpm rpm -ivh VirtualBox-4.1-4.1.8_75467_rhel5-1.x86_64.rpm warning: VirtualBox-4.1-4.1.8_75467_rhel5-1.x86_64.rpm: Header V4 DSA signature: NOKEY, key ID 98ab5139 Preparing... ########################################### [100%] 1:VirtualBox-4.1 ########################################### [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 ] Uninstalling old VirtualBox DKMS kernel modules [ OK ] Trying to register the VirtualBox kernel modules using DKMS [FAILED] (Failed, trying without DKMS) Recompiling VirtualBox kernel modules [ OK ] Starting VirtualBox kernel modules [ OK ] ----------- rpm -qa | grep -i "virtual" VirtualBox-4.1-4.1.8_75467_rhel5-1
————-
So, to summarize, when installing Virtual Box:
xen kernels are not allowed!
dkms not required or allowed!
kernel and kernel-devel need to be exactly the same!
It’s not necessary to have the source directory for the kernel.
I hope this helps any other poor soul who has similar issues.
Now to configure Virtual Box.
Hello Everyone,
Well, here is an update.
After the tough struggle with the install, another struggle to create an XP VM totally failed. See all the details here:
http://rodgersnotes.wordpress.com/2012/02/17/vmware-player-versus-virtual-box/
While attempting to create the VM, Virtual Box actually hung the entire Linux server! Unbelieveable!
R.
Thanks for putting this here. I was as lost as you were but this saved me!