LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (http://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   kernel panic when moving drive to new machine (http://www.linuxquestions.org/questions/linux-kernel-70/kernel-panic-when-moving-drive-to-new-machine-598103/)

gimecoffee 11-08-2007 12:47 PM

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.

Machines are:
AMD Athlon 1700
AMD Athlon 2800
Intel Celeron

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

Any thoughts on what my problem is?
Thx
Rois

Your life is going somewhere whether you have a strategy or not. Experience the High Life. - http://www.sailingthroughlife.net

kilgoretrout 11-08-2007 01:29 PM

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.

gimecoffee 11-08-2007 02:10 PM

Quote:

Originally Posted by kilgoretrout (Post 2952436)
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

gimecoffee 11-09-2007 09:56 AM

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???)

Thanks for the input.
Rois

Your life is going somewhere whether you have a strategy or not. Experience the High Life. - http://www.experiencethehighlife.com

kilgoretrout 11-09-2007 12:24 PM

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.

keratos 11-09-2007 12:28 PM

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

find /vmlinuz

post the output

gimecoffee 11-09-2007 02:40 PM

grub>find /vmlinuz
Error 15: File not found

The grub line is:
kernel (hd0,0)/boot/vmlinuz BOOT_IMAGE=linux root=/dev/hda1
initrd (hd0,0)/boot/initrd.img

so I ran this w/ the following out put:
grub>find /boot/vmlinuz
(hd0,0)
grub>find /boot/initrd.img
(hd0,0)

Thoughts?
Rois
Your life is going somewhere whether you have a strategy or not. Experience the High Life. - http://www.sailingthroughlife.net

kilgoretrout 11-09-2007 05:30 PM

Just for thoroughness, also try:

grub> find /sbin/init

You should get the same output re (hd0,0).

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.

syg00 11-09-2007 06:51 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.

keratos 11-10-2007 04:09 AM

Quote:

Originally Posted by kilgoretrout (Post 2953786)
Just for thoroughness, also try:

grub> find /sbin/init

You should get the same output re (hd0,0).

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 !

gimecoffee 11-13-2007 12:24 PM

Thank you for the suggestions. Following your instructions . . .

grub> find /sbin/init
Shows: (hd0,0)

grub> root (hd0,0)
Shows: Filesystem type is ext2fs, partition type 0x83

> kernel /boot/vmlinuz root=/dev/sda1
Shows: [Linux-bzImage, setup=0x2000, size=0x18a858]

> initrd /boot/initrd.img
Shows: [Linux-initrd @ 0xffbd000, 0x2e5ec bytes]

> boot
Gives same kernel panic after a bunch of boot messages I can't see.

Just for giggles I did it for hda1 as well (I was guessing this is the manual way of booting grub) and it still gave a kernel panic.

This is getting pretty frustrating. Any other thoughts I could try.

btw keratos . . . there is no SATA on any of these MOBOs. Only IDE.

Thx
Rois

Your life is going somewhere whether you have a strategy or not. Experience the High Life. - http://www.experiencethehighlife.com

jailbait 11-13-2007 01:50 PM

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.

----------------
Steve Stites

keratos 11-14-2007 02:24 AM

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.

gimecoffee 11-14-2007 11:27 AM

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


All times are GMT -5. The time now is 07:00 PM.