Rebuilding initramfs

Kernels & Hardware, configuring network, installing services

Rebuilding initramfs

Postby Smjert » 2010-05-25 22:10

I have debian squeeze, i just moved the OS hard disk from usb to internal and now it doesn't start since the initramfs loads usb driver first and then waits for the root to mount...
How can i rebuild the initramfs to load the sata drivers?
Smjert
 
Posts: 8
Joined: 2009-11-04 00:39

Re: Rebuilding initramfs

Postby bugsbunny » 2010-05-25 23:07

Are you sure that's the reason? What's the entry in grub? Specifically what is root pointing to on the kernel line?

I suspect that moving the drive caused it to get renamed (from sda to sdb or something along those lines) and that that is the cause of the problem.
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04

Re: Rebuilding initramfs

Postby Smjert » 2010-05-26 07:34

I know that because i look often what the boot writes and i saw that it loads first the usb, waits the root and then it loads the sata drives.
Here's a screenshot, when it waits for the root (and it stops really soon, so the other writes on the monitor are "all" the things it loaded so far)

Image

I also already tried to change grub entries since i suspected that the uuid was changed (altought it seems that it's the same), and i put the real path, /dev/sda1 or /dev/sdb1, but none of them worked.

Here's the relevant part of my grub.cfg:

Code: Select all
[.. omissis ..]
### BEGIN /etc/grub.d/10_linux ###
menuentry "Debian GNU/Linux, with Linux 2.6.30-2-amd64" --class debian --class gnu-linux --class gnu --class os {
   insmod ext2
   set root='(hd0,1)'
   echo   Loading Linux 2.6.30-2-amd64 ...
   linux   /boot/vmlinuz-2.6.30-2-amd64 root=/dev/sdb1 ro 
   echo   Loading initial ramdisk ...
   initrd   /boot/initrd.img-2.6.30-2-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.30-2-amd64 (recovery mode)" --class debian --class gnu-linux --class gnu --class os {
   insmod ext2
   set root='(hd0,1)'
   search --no-floppy --fs-uuid --set c72fec4f-dcb9-4839-aa21-699bfb4622fd
   echo   Loading Linux 2.6.30-2-amd64 ...
   linux   /boot/vmlinuz-2.6.30-2-amd64 root=UUID=c72fec4f-dcb9-4839-aa21-699bfb4622fd ro single
   echo   Loading initial ramdisk ...
   initrd   /boot/initrd.img-2.6.30-2-amd64
}
menuentry "Debian GNU/Linux, with Linux 2.6.30-amd64-test" --class debian --class gnu-linux --class gnu --class os {
   insmod ext2
   set root='(hd0,1)'
   search --no-floppy --fs-uuid --set c72fec4f-dcb9-4839-aa21-699bfb4622fd
   echo   Loading Linux 2.6.30-amd64-test ...
   linux   /boot/vmlinuz-2.6.30-amd64-test root=/dev/sda1 ro 
}
menuentry "Debian GNU/Linux, with Linux 2.6.30-amd64-test (recovery mode)" --class debian --class gnu-linux --class gnu --class os {
   insmod ext2
   set root='(hd0,1)'
   search --no-floppy --fs-uuid --set c72fec4f-dcb9-4839-aa21-699bfb4622fd
   echo   Loading Linux 2.6.30-amd64-test ...
   linux   /boot/vmlinuz-2.6.30-amd64-test root=/dev/sda1 ro single
}
### END /etc/grub.d/10_linux ###
[.. omissis ..]
Smjert
 
Posts: 8
Joined: 2009-11-04 00:39

Re: Rebuilding initramfs

Postby BioTube » 2010-05-26 12:49

debian-installer has a rescue mode that you can use to chroot into your installation. Afterwards
Code: Select all
update-initramfs -c -k <kernel>
update-grub
should do the trick.
Image
Ludwig von Mises wrote:The elite should be supreme by virtue of persuasion, not by the assistance of firing squads.
User avatar
BioTube
 
Posts: 7551
Joined: 2007-06-01 04:34

Re: Rebuilding initramfs

Postby Smjert » 2010-05-26 15:46

This works even if the /dev of my installation is not populated? (the last time i used the debian cd i didn't found my disks there.., only on the virtual OS loaded by the cd).
Smjert
 
Posts: 8
Joined: 2009-11-04 00:39

Re: Rebuilding initramfs

Postby nadir » 2010-05-26 16:02

This works even if the /dev of my installation is not populated? (the last time i used the debian cd i didn't found my disks there.., only on the virtual OS loaded by the cd).


I don't know. If so use a live-CD:
mount /dev/sdb1 /media/disk
mount -o bind /sys /media/disk/sys
mount -t proc /proc /media/disk/proc
mount -o bind /dev /media/disk/dev
chroot /media/disk
run the command, exit chroot, umount all stuff and reboot.
I hope. I never had to do it with the said command.

Are you sure:
Code: Select all
 set root='(hd0,1)'

is correct? Cause one of your entries is for sdb1.

Either run:
ls -l /dev/disk/by-uuid
or
blkid
to double-check if the by-uuid stuff is correct.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
User avatar
nadir
 
Posts: 5964
Joined: 2009-10-05 22:06
Location: away

Re: Rebuilding initramfs

Postby bugsbunny » 2010-05-26 16:30

stick it back on the usb port, boot the system, add the needed drivers to /etc/initramfs-tools/modules, rebuild initramfs.

Are there other ways? yes, but the above is probably the way I would do it.

Also, in /etc/initramfs-tools/initramfs.conf, what's the value of MODULES= ?
User avatar
bugsbunny
 
Posts: 5355
Joined: 2008-07-06 17:04

Re: Rebuilding initramfs

Postby Smjert » 2010-05-26 16:57

BioTube... it worked!!
I used the CD, went in Rescue Mode, mounted /dev/sdb1 as root, opened the shell, mounted my usr partition, renamed the current initrd with .bak extensione and then i gave that commands and the system booted!.
Thank you.
Smjert
 
Posts: 8
Joined: 2009-11-04 00:39


Return to System configuration

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable