Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
kernel panic when moving drive to new machine[SOLVED]
One of the things I've always like about linux is that for a non-X server installation it was pretty easy to move the hard drives to another machine in the event of a hardware problem. I'm having a little difficulty with 2008 and I'm sure it's just because I'm not understanding something but the boot messages are going by too fast for me to read and once the panic happens I can't use shift+pageup to read them. I'm not getting any answers on Mandriva's forum so thought I'd try here.
I'm doing a truly minimal install with LILO as the boot loader.(Also tried with grub with same results.) It boots just fine on the machine I did the install with but not on the others. (I've done installs on the 1700 and 2800 only.)
What's on the screen when the kernel panic stops it is: (Sorry for any mispellings)
Loading ext3.ko module
Mounting /proc filesystem
Mounting sysfs
Creating device files
Mounting tmpfs on /dev
No resume device specified
Trying userspace resume from suspend.com file
No resume device in suspend.conf
echo: cannot open /sys/power/suspend2/do_resume for write: 2
echo: cannot open /sys/power/tuxonice/do_resume for write: 2
Mounting root filesystem /dev/root with flags relatime
mount: error 6 mounting ext3 flags relatime
well, retrying without the option flags
mount: error 6 mounting ext3
well, retrying read-only without any flag
mount: error 6 mounting ext3
Switching to new root
ERROR opening /dev/console!!!!: 2
unmounting old /proc
unmounting old /sys
switchroot: mount failed: 22
Initrd finished
Kernel panic - not syncing: Attempted to kill init
It can't find your root filesystem probably because you have the hard drive in a different configuration on the second machine. If it's an ide drive it has to be in the same position on the second box as the first, eg primary master. If it's a sata drive it has to be on the same sata channel as the first.
Hard drives in linux are configured according to where they are on the ide or sata bus. For example, if you installed on the first primary partition on an ide drive on the primary master ide channel, the root partition would be hda1, or possibly sda1 on more recent kernels. If you transfer the drive to a second box and put it on the secondary master channel, it becomes hdc1. Unfortunately, the bootloader is configured to look for the root partition on hda1; when it can't find anything there, you get a kernel panic.
It can't find your root filesystem probably because you have the hard drive in a different configuration on the second machine. If it's an ide drive it has to be in the same position on the second box as the first, eg primary master. If it's a sata drive it has to be on the same sata channel as the first.
Good thought (it is a single IDE drive) but I checked that. It was the primary master (hda) on the installing machine and the primary master (hda) on the second machine and third machine. Actually I've done this quite a lot. Usually with software raid-1 drives and I've never had this problem until mandriva 2008.
I just finished trying it with Mandriva 2007(Spring) on a completely different hard drive (just to make sure it wasn't a drive issue) and was able to move it to several different machines with no problem. It booted right up. Then I tried it with 2008 on the new drive and got the kernel panic again.
There's got to be something new in the linux kernel or something that doesn't like this anymore.
Thoughts
Rois
Your life is going somewhere whether you have a strategy or not. Experience the High Life. - http://www.sailingthroughlife.net
Last edited by gimecoffee; 03-29-2008 at 02:22 PM.
In reading the release notes and seeing that the IDE drivers are all done as modules now makes me wonder if this could be an IDE module problem. If the installer is setting up the IDE modules for the MOBO it's on and the the others MOBO's aren't the same then I'm guessing that the kernel would panic trying to load the wrong IDE modules for the MOBO???
Any thoughts on this idea and what I might be able to do to get the correct module to find itself?? (pipe dream???)
It's possible. On the newer kernels, I've also seen different device files for drives on different boards using the same distro/kernel. Sometimes the old hdx designation is used for ide drives and other times the new sdx designation is used for the same drive depending on the hardware environment. That alone would cause a kernel panic.
Are you using grub and, if so, can you get to a grub prompt on the non-booting box? If so, there are some things you can try to investigate these possibilities.
The drive and/or partitions mapping has changed, because as correctly identified above, the drive location is either different or the kernel device mappings from m/b chipsets are different.
with the hard disk in the new machine, boot up and go into grub. Dont load a kernel but goto into the GRUB command line and enter the command
All this indicates the grub mapping is the same so I'm guessing the device file for the root partition changed from hda1 to sda1. To test that, run this at the grub prompt:
grub> root (hd0,0)
> kernel /boot/vmlinuz root=/dev/sda1
> initrd /boot/initrd.img
> boot
And see if it boots. If it does, I'm right.
Last edited by kilgoretrout; 11-09-2007 at 05:42 PM.
Probably crossing 2.6.19 with the libata changes that caused the device designation to change from /dev/hd? to /dev/sd?
If you're having problems with the switchroot, the initrd will need to be rebuilt as well as changing the bootloader config and fstab (probably).
Different distros handled this variously; redhat/Fedora used LABEL in place of the device designation, Ubuntu went with UUID. Never used Mandriva (gave up on Mandrake (10) when it ate my partition table) so I don't know their direction.
All this indicates the grub mapping is the same so I'm guessing the device file for the root partition changed from hda1 to sda1. To test that, run this at the grub prompt:
grub> root (hd0,0)
> kernel /boot/vmlinuz root=/dev/sda1
> initrd /boot/initrd.img
> boot
And see if it boots. If it does, I'm right.
This is a good bet. Provided the sata drivers are loaded natively or in the initrd image !
I think that syg00 had the right idea when he said to rebuild the initrd. If you need different kernel modules loaded for the different IDE chips on the two motherboards then you need a different initrd for the second motherboard.
I am uncertain how to do that. One way might be to pack the module for the second motherboard IDE chip into the first initrd even though the first initrd doesn't need that module for the first motherboard. You might try using the --with option in mkinitrd to add an extra module to the first motherboard's initrd.
This article (although not specifically on initrd images) does include some detail on how to create initrd for mandriva (which appears on your sidebar signature): http://mandrivausers.org/lofiversion...hp/t23958.html
Moreover the problem most likely related to chipsets and hardware changes on the motherboard - there are many components on a m/b that dont seem initially obvious: APIC, north/south chips, sound/vga, memory bus, system bus, PCI interface etc.etc.
Very briefly thinking about your challenge, I would say your options are limited because you need to ensure the correct kernel drivers are loaded for you m/b.
Would it be possible to boot a Mandrake liveCD and copy its /boot/* files onto the HDD ??
or
Still from the LiveCD, "chroot" and "bind" to your HDD / filesystem on the HDD and download from synaptic a kernel package. Because of the chroot+bind the package contents+mods should be written to the HDD filesystems.
Thanks guys. Sounds like changing the ide module and rebuilding the initrd was the correct answer. I got this from the mandriva forum so I thought I'd post the solution here in case someone on this forum might find this useful. (Here is the url in case you want the full details: http://forum.mandriva.com/viewtopic.php?p=399288#399288 )
Quote:
RJ549 (Site Admin, Mandriva):
2008.0 has gone to modular IDE. What that means is that the IDE drivers are insertable modules similar to what has been done with scsi for a long time. In fact, several of the IDE modules actually enumerate drives with 'sda', 'sdb'... as though they are scsi instead of the usual 'hda', 'hdb'... that we're used to seeing.
Do you know what model of IDE controller the panicking machine has?
If so, you can boot the disk in the bootable machine and add that module name to /etc/modprobe.conf. Here's an example:
Code:
alias ide-controller ide_generic
The ide_generic module stands a good chance of working on most IDE controllers and still uses the 'hda', hdb'... nomenclature. For best performance though, it really is best to select the correct module for your particular controller model.
Once you get the correct line added to /etc/modprobe.conf, you need to rebuild the initrd. I've found that the easiest way to do that is to uninstall, the re-install the kernel package. If you only have the one default kernel installed, you'll need to temporarily install another one (like perhaps kernel-desktop586-latest) first.
Thx
Rois
Your life is going somewhere whether you have a strategy or not. Experience the High Life. - http://www.sailingthroughlife.net
Last edited by gimecoffee; 03-29-2008 at 02:22 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.