January 17, 2019

Upgrading a Motherboard in Linux: Kernel Panic

Kernel Panic, Meet Weeping User

  • October 6, 2009
  • By Carla Schroder
I spent the weekend installing a new motherboard in my audio/video production computer. The old motherboard had a dead memory slot, so it was removed and converted into a skeet target. The new board is an ECS A740GM-M for AMD processors. What should have been a 30-minute chore turned into a vexing showstopper, because the Linux kernel in 64 Studio didn't get along with the new board and panicked on boot.

Kernel Panic, Meet Weeping User

Swapping in a new motherboard is usually a painless task on Linux systems. The most common problem is accidentally changing the hard drive order on a multiple-drive system, and then it won't boot because GRUB can't find the drives. Easy to fix, just plug the drives into the correct slots.

This a different problem. Here is a photo of the screen messages, which are typically cryptic and unhelpful.

figure 1
figure 1

While we're on the subject of unhelpful tech, when is the x86 BIOS going to catch up to its decades-old competitors, and provide a BIOS that includes some useful boot management and troubleshooting tools? Like capturing the boot messages, and the ability to step through the whole boot process one step at a time. There are a couple of ways to hack around this, such as monitoring bootup from a serial terminal, or buying and installing a PC Weasel card, which costs $350. Having this functionality integrated into the x86 PC BIOS would be a great help.

The messages indicate a kernel panic. The system boots normally up to the GRUB menu, and then when it gets to the kernel line it panics and requires a hard restart. Kubuntu 8.04 is installed on the same box, and it boots and runs fine. In fact it has several kernels, and they're all happy with the new board:

  • 2.6.24-24-rt
  • 2.6.24-24-generic
  • 2.6.24-23-rt
  • 2.6.24-23-generic
64 Studio 3.0 beta 3 uses a 2.6.29-1-multimedia kernel. I tried manually editing the kernel line in the GRUB menu to try various boot-time options gleaned from various forums and lists, and none of them had any effect. Akkana Peck, ace programmer and LinuxPlanet author, suggested copying a Kubuntu kernel into 64 Studio and trying that. This was easy to do since they were both on the same machine, so all I had to do was fire up Kubuntu, mount the 64 Studio root filesystem, and copy the necessary files. This could also be done using a live USB or CD Linux.

So I did, and it gave me a usable 64 Studio system. Here are the steps for copying a kernel from a different Linux installation:

  • Go into /boot and copy the kernel you want to use from your "donor" system (there may be several kernels) plus its corresponding initrd and System_map files. These will all have the same version number as your kernel, like initrd.img-2.6.24-24-rt and System.map-2.6.24-24-rt. rt means "real time" kernel, which is essential for audio production.
  • Copy them into /boot on the recipient system.
  • Create a boot stanza in /boot/grub/menu/lst so you'll have an entry in your boot menu. You can copy any existing working stanza and replace the filenames. For example, for my 64 Studio system I now have two stanzas that look like this:
    title           64 Studio, kernel 2.6.29-1-multimedia-686
    root            (hd1,0)
    kernel          /boot/vmlinuz-2.6.29-1-multimedia-686 
       root=UUID=bb33260f-7472-4705-96a9-db09e86eed6f ro 
    initrd          /boot/initrd.img-2.6.29-1-multimedia-686
    title           test ubuntu kernel 2.6.24-24-rt
    root            (hd1,0)
    kernel          /boot/vmlinuz-2.6.24-24-rt 
      root=UUID=bb33260f-7472-4705-96a9-db09e86eed6f ro
    initrd          /boot/initrd.img-2.6.24-24-rt
    An important thing to note here-- if your system uses root=UUID, be very sure you copy the correct UUID for your local system. This identifies the correct block device. Also note that each line needs to be one unbroken line, and not broken as the kernel line is in this example.
  • Copy the /lib/modules directory that goes with your borrrowed kernel, which in this example is /lib/modules/2.6.24-24-rt
That should do it, and you should be able to boot into your new borrowed kernel. A cool thing about doing it this way is you still have the old kernel to try different boot options and other fixits. Meanwhile I have filed a bug report, and hopefully will have a 64 Studio kernel to use someday.

Old GRUB vs. New GRUB

One more note-- the GRUB examples are for old GRUB 0.97. GRUB 2.0 is starting to appear in distros, and it is very different to configure, an over-complicated spaghetti hash. Watch this space for a GRUB 2.0 tutorial.

Carla Schroder is the author of the Linux Cookbook and the Linux Networking Cookbook (O'Reilly Media), the upcoming "Building a Digital Recording Studio with Audacity" (NoStarch Press), a lifelong book lover, and the managing editor of LinuxPlanet and Linux Today.

Most Popular LinuxPlanet Stories