...or how to get new hardware working on the old system by only using a linux live-cd, chroot and a new kernel.
Some weeks ago, i had to change a complete Debian Squeeze System which ran on a Dell PowerEdge R310 to a newer R320 System with a new CPU, new NIC's and a new PERC - a so called PowerEdge RAID Controller.
There was no problem for the older Squeeze system to detect and use the new CPU but it didn't recognize the new Broadcom NIC's nor the new PERC (which is a H710 mini now).
What i had to do
The first thing i had to do was checking the complete new hardware specs of the R320 system before touching the old R310 system. This was quite easy and so i was able to check the running stock 2.6.32 kernel for hardware support of the new components.
So in the end the new PERC H710 mini and the new Broadcom NIC's where not supported by the older kernel but they are by newer kernels.
Now i checked what newer kernels where available for Squeeze and saw, that several backport kernels had support for the new hardware. In my case it was the
How to get the new kernel running on the old system?
As long as the old system is still running, this is straight forward. I just had to add the squeeze backports sources and install the backports kernel:
echo "deb http://http.debian.net/debian-backports squeeze-backports main" > /etc/apt/sources.list.d/squeeze-backports.list apt-get update # Add the "-s" parameter to do a dry run first apt-get -t squeeze-backports install linux-image-3.2.0-0.bpo.2-amd64 firmware-linux-free
Now i could just shutdown the system, pull out the hard disks and re-insert them into the new system. The new PERC will use the RAID configuration which is stored on the disks and boot the system. While the new kernel is the default kernel after installation the system will happily go live again. This will just take 2-3 minutes and i would be back in action.
Reenabling the NIC's
The last step here is to reenable the new NIC's. Normally the new kernel will also recognize the new NIC's and add them to the system with a new interface name. Since i only had two NIC's on the R310, the new NIC's will be eth2 and eth3. I just had to delete the old eth0 and eth1 and rename eth2 to eth0 and eth3 to eth1 to automagically get the old network config back after a reboot.
To rename the NIC's i had to edit the appropriate file
vim /etc/udev/rules.d/70-persistent-net.rules # Comment out the old eth0/1 lines and rename eth2/3 to eth0/1 or just deleted the old eth0/1 lines
I saved that file and rebooted to get your old network config back.
I'm done - but only, if the old system had worked until the hardware switch.
What to do if the old system did not work anymore upon switching the system?
In my case it was a little harder, because the R310 did not work anymore before the switch to the R320 system due to some hardware failures.
What i did first was swapping over the hard disks to the new system and booting up a linux live-cd. I've used the Wheezy Live-CD. It is important here to use the same architecture as your old system - it was x64/amd64 for me - and a kernel with support for the new hardware!
After booting up the system i had to check that the Live-Linux had recognized all my hardware - especially my LVM. If you have problems here, just check that you have installed the
lvm2 package on your live system.
Creating the chroot-environment
Now i had to construct the chroot environment so I where able to install the backports kernel for the old system.
I'll post the commands here with some inline comments:
# Create a 'root' chroot folder mkdir -p /mnt/chroot # Mount your / filesystem mount /dev/mapper/vg0-root /mnt/chroot/ # If you have separate partitions for boot or logs, mount them as well # While we want to install a new kernel, /boot is crucial! mount /dev/sda1 /mnt/chroot/boot mount /dev/mapper/vg0-var–log /mnt/chroot/var/log # Mount system folders for the old system mount -t proc proc /mnt/chroot/proc mount -t sysfs sys /mnt/chroot/sys mount -o bind /dev /mnt/chroot/dev # Also cross-mount your live-linux resolv.conf, so we can grab the new kernel from the internet cp -L /etc/resolv.conf /mnt/chroot/etc/resolv.conf
Now I've successfully constructed the chroot environment. Let's get into it with
chroot /mnt/chroot /bin/bash
update the old system's mtab before installing a new kernel and load the old profiles file just to have all parameters loaded for your shell
grep -v rootfs /proc/mounts > /etc/mtab source /etc/profile
Now I just executed all commands for the new kernel installation like i discribed above. When i was done, I
exit'ed the chroot environment and unmounted all folders in reverse order before I safely rebooted the system without the live-cd.
My system should booted up and I just had to follow the steps to reenable the new NIC's. Then i was done and be able to use the new system like before.