Virtualizing Red Had Enterprise Linux 2 (and all the troubles I had with it)

For some time I wanted to virtualize the only non-Windows server we had. It was a Red Hat Enterprise Linux 2 server serving some old legacy application. This server had to be preserved en kept running for archiving purposes. So instead of letting it run consuming power and hope it wouldn’t fail (+-7 year old hardware?) we wanted it to be virtual. This way we weren’t reliable on old hardware and we had a flexible way of turning it on whenever we needed it.

With great enthusiasm I went to the datacenter with the VMWare converter CD and I performed a quick and smooth virtualization of the machine. However when I started the machine I got kernel panics and notifications of partitions that couldn’t be found.

Well after quite some time (it wasn’t the highest priority) and a lot of searching I finally found a blogpost called Virtualize a Linux Server with VmWare Converter 3.0.1. “This is exactly what I am looking for!” was my first thought. Well although the article is really clear (well done Manlio Frizzi) it helped me only a bit further.

So my first steps were those that Manlio Frizzi described on his blog. Virtualized the system to my ESX environment. After i’ve done that I downloaded the rescue iso of Fedora Core 3 (FC2 wasn’t available) and mounted this in the virtual cd-rom drive. After selecting “Rescue installed system” from the bootscreen it started loading the BusLogic driver. Then I selected English as my language and US as my keyboard lay-out.

After these steps the system questions you if you want to start the network interfaces. Don’t let the system start the network interfaces, because it might hang the entire system. A little bit later I will tell you what went wrong for me when I tried to start the network later on. So now the rescue environment wants to mount your Linux installation to /mnt/sysimage. You have to select “Continue” here, otherwise you won’t be able to make the changes necessary. So now after selecting OK you will be presented with a command line environment. The first thing I typed was as instructed by the blog:

chroot /mnt/sysimage

Now my own system is the root system. The first thing we have to do is make clear to the Linux box that we no longer have the SCSI adapters and LAN adapters as before. This can be done by modifying the file /etc/modules.conf. On some Linux systems it might be /etc/modprobe.conf. So after opening the modules.conf file with my favourite editor (vi) I noticed a number of references to a scsi_hostadapter[n] and two references to network adapters. Basically all you have to do is modify the text after the scsi_hostadapter[n] to BusLogic and the text after eth[n] to pcnet32. My own modules.conf file looked like this after the edit:

alias parport_lowlevel parport_pc
alias scsi_hostadapter1 BusLogic
alias scsi_hostadapter2 BusLogic
alias eth0 pcnet32

 So following the blog the only thing we needed to do next is make a new initrd image. This is done by going to /boot and first ofcourse making a back-up of the existing initrd-2.x.y-zz.img (replace x, y and zz ofcourse with the kernel version). After making the back-up you have to execute the command to make a new one:

mkinitrd -v -f /boot/initrd-2.x.y-zz.img 2.x.y-zz

So after this is done you reboot the machine and in theory kudzo should kick in and after that everything would be perfect. Well in my case it wasn’t. Something definitely changed, because I saw that the BusLogic was detected perfectly and was loaded during boot. But I still had the same errors and RHEL2 just wouldn’t boot. So for me it was back to the rescue environment again.

So back in the rescue environment I decided to check the grub config file which was located at /boot/grub.conf. I noticed that there was still a reference to the old scsi controller after the ‘root=’. So a quick fdisk -l made clear that I needed the fifth partition of /dev/sda. So after ‘root=’ I added ‘/dev/sda5’. My entire line looks like this:

kernel /vmlinuz-2.4.9-e-49 ro root=/dev/sda5

After I did this my system finally booted, but still there were network errors and swap allocation errors. Because I thought those swap errors were also because of a bad reference I decided to fix that first. I looked at /etc/fstab in which is defined which devices and partitions are mounted and where. So my first guess where to look was the right guess. The reference here was also wrong so I corrected it to /dev/sda2 (which i saw with fdisk -l it was the swap) and this worked out perfectly. The corrected fstab linke looked like this:

/dev/sda2 swap swap defaults 0 0

So now everything worked except network. This was really a tricky thing because it wasn’t specifically a virtualization thing. Whenever I booted the system it would hang when it would try to start eth0. This also happened when I manually tried to start or stop it. After a lot of reading I found out there was a bug in the startup script (which is fixed in newer versions of initscripts) which created an infinate loop. The solution was rather simple. I just had to delete the HWADDR line from the /etc/sysconfig/networking/default/ifcfg-eth0 config file.

So now a final reboot and everything worked and started perfectly. I virtualized the Linux box, but it was way more of a challenge then a Windows box. It was a nice challenge, but i’m certainly glad I now mastered it.

I hope this was useful for some people. I have spend quite some time searching for all te solutions and I was helped a lot by the commands dmesg and cat /var/log/messages. Also thanks again to Manlio Frizzi without whom I probably would never have come this far with the initial steps.

Advertisements

One response to “Virtualizing Red Had Enterprise Linux 2 (and all the troubles I had with it)

  1. No problem RJ 🙂 !
    are you coming to Cannes for VmWorld 2009?
    hope to see you there.
    Manlio

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s