How to install Nvidia driver on a Xen kernel, CentOS 5.5(Final)
We have already discussed the installation of Nvidia driver on CentOS. But this method only applies to regular kernels. Xen, the virtual machine monitor, requires you to install a modified linux kernel and guess what, nVidia officially doesn't support it. The regular installation is aborted when this kernel is detected and working without the driver is not possible because the performance degradation is unbearable(at least on my system). So, after some searching and trying out different methods, I finally found this work around to make nvidia drivers work on Xen kernels.
Lets start by updating the system. Run the following commands.
[root]# yum -y update
[root]# yum clean all
Now, lets keep only the latest kernels and remove all the old ones. In order to see what kernel versions are already installed, execute the following command.
[root]# rpm -qa | grep kernel
The output should look something like this
This is the output on my system, all updated. Before starting its better to install the latest kernel-xen & kernel-xen-devel also kernel & kernel-devel
Just run the following commands to install the latest kernels and gcc.
[root]# yum install kernel kernel-devel kernel-xen kernel-xen-devel gcc
Its better to keep the latest versions. If you want to remove any older ones, then you can use the following command to remove them
[root]# rpm -e kernel-xen-2.6.18-164.el5 kernel-xen-devel-2.6.18-164.el5
The installation method I have used and mentioned here seems to work with this version. NVIDIA-Linux-x86_64-256.53.run. If you don't have the driver package yet, then you may use this link on nvidia's website to download the appropriate driver for your card. You may use the instructions given on the previous article in case you are wondering how to proceed.
Now, before starting make sure that you are running the xen kernel. Run the following command to check it.
[shredder12]$ uname -r
If this is the case then move on, otherwise shutdown and boot into the xen kernel(select the xen kernel in the grub menu)
Follow the steps below
- First of all we will need the drivers, use the steps mentioned in the previous article to download the driver from Nvidia's website.
- Now, move the driver file to the /tmp directory
- Now, make the file executable by changing the permissions
- Run the following command to just extract the bundle
- Now, based upon the driver file, you may either have to move to [extracted-dir]/usr/src/nv folder or [extracted-dir]/kernel. Both don't exist in the same driver file, so there shouldn't be a conflict. In my case it was kernel dir.
- Run the following command
- You may get a lot of warnings and error after this command but at the end you should see
- Its time to move the built kernel module in to Xen-kernel library. First we will create the directory for nvidia drivers and then will copy the nvidia.ko file into that folder. The following couple of commands should do so.
[root]# mv NVIDIA-Linux-x86_64-256.53.run /tmp
[root]# chmod a+x NVIDIA-Linux-x86_64-256.53.run
[root]# ./NVIDIA-Linux-x86_64-256.53.run --extract-only
[root]# cd NVIDIA-Linux-x86_64-256.53.run/kernel/
IGNORE_XEN_PRESENCE=y make SYSSRC=/lib/modules/`uname -r`/build module
NVIDIA: left KBUILD
[root]# mkdir -p /lib/modules/`uname -r`/kernel/drivers/video/nvidia/
[root]# cp -i nvidia.ko /lib/modules/`uname -r`/kernel/drivers/video/nvidia/
Now, we will build the .dep module files using depmod and finally load the module into the kernel using modprobe
[root]# depmod -a
[root]# modprobe nvidia
So, we have finally loaded the nvidia module into the running Xen kernel, but things still won't work because we haven't installed most of the nvidia software yet. Now, the next step is to install the driver software fully on the non-Xen linux kernel. For that, you can follow the small guide on basic installation of Nvidia driver on CentOS (non-Xen kernel).
Once you are done with the installation, finally boot into the xen kernel and you should see the nvidia splash screen. In order to check if the driver module has been uploaded, you may run the following command
[root]# dmesg | grep -i nvidia
You should see the following output
nvidia: module license 'NVIDIA' taints kernel.
NVRM: loading NVIDIA UNIX x86_64 Kernel Module 256.53 Fri Oct 01 20:27:48 IST 2010
Now, you may even check the driver's performance using glxgears
You should see the frame output, which you can use to compare the performance on non-xen kernels. On my system the output was around 15000 frames in 5 seconds. Apparently, the driver installed on Ubuntu(through the default way) gives around 11000 frames every 5 second. I wonder why is that so .
P.S. Just like regular kernels, you will have to perform the same thing everytime a new xen kernel update comes in. I would be happy to know some easy way to handle such issues. If you know any other way, do suggest :).