[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#475958: updated procedure



Please, find below an updated version of the procedure. I have included the remarks and proposition of W. Martin Borgert and Vincent McIntyre.

Title : system boot hangs on 'Waiting for root file system'
Title : procedure to recover from "/dev/hda became /dev/sda"

Some users have reported that an upgrade could cause the kernel not finding
the system root partition after a system reboot.

In such case, the system boot will hang on the following message:
  Waiting for root file system ...
and after a few seconds a bare busybox prompt will show.

This problem can occur when the upgrade of the kernel introduces the use of
the new generation of IDE drivers. The IDE disk naming convention for the
old drivers was hda, hdb, hdc, hdd. The new drivers will name the same disks
respectively sda, sdb, sdc, sdd. The problem appears when the upgrade does not
generate a new '/boot/grub/menu.lst' file to take the new naming convention
into account. During the boot, Grub will pass a system root partition to the
kernel that the kernel doesn't find.

If you have encountered this problem after upgrading, jump to the section
"How to recover from the problem after the upgrade". To avoid the problem
before upgrading, read ahead.

How to avoid the problem before upgrading
-----------------------------------------
One can avoid this problem entirely by using an identifier for the
root filesystem that does not change from one boot to the next. There are two
possible methods for doing this - labelling the filesystem, or using the
filesystem's universal unique identifier (UUID). These methods are supported
in Debian since the 'etch' release.

The two approaches have advantages and disadvantages. The labelling approach is
more readable, but there may be problems if another filesystem on your machine
has the same label. The uuid approach is uglier, but having two clashing uuids
is highly unlikely.

For the examples below we assume the root filesystem is on /dev/hda6. We also
assume your system has a working udev installation and ext2 or ext3 filesystems.

To implement the labelling approach:
  1. Label the filesystem (the name must be < 16 characters) by running
     the command:
       e2label /dev/hda6 rootfilesys
  2. Edit /boot/grub/menu.lst and change the line:
       # kopt=root=/dev/hda6 ro
     to
       # kopt=root=LABEL=rootfilesys ro
     NB: Do not remove the '#' at the start of the line, it needs to be there.
  3. Update the 'kernel' lines in menu.lst by running the command:
       update-grub
  4. Edit /etc/fstab and change the line that mounts the '/' partition, eg.:
       /dev/hda6     /     ext3  defaults,errors=remount-ro 0 1
     to
       LABEL=rootfilesys     /     ext3  defaults,errors=remount-ro 0 1
     The change that matters here is the first column, you don't need to
     modify the other columns of this line.

To implement the uuid approach:
  1. Find out the universal unique identifier of your filesystem by issuing:
       ls -l /dev/disk/by-uuid | grep hda6
     You should get a line similar to this one:
       lrwxrwxrwx 1 root root 24 2008-09-25 08:16 d0dfcc8a-417a-41e3-ad2e-9736\
       317f2d8a -> ../../hda6
     The uuid is the name of the symbolic link pointing to /dev/hda6 ie.:
       d0dfcc8a-417a-41e3-ad2e-9736317f2d8a
     NB: your filesystem uuid will be a different string.
  2. Edit /boot/grub/menu.lst and change the line
       # kopt=root=/dev/hda6 ro
     to
       # kopt=root=UUID=d0dfcc8a-417a-41e3-ad2e-9736317f2d8 ro
     NB: Do not remove the '#' at the start of the line, it needs to be there.
  3. Update the 'kernel' lines in menu.lst by running the command:
       update-grub
  4. Edit /etc/fstab and change the line that mounts the '/' partition, eg.:
       /dev/hda6     /     ext3  defaults,errors=remount-ro 0 1
     to
       UUID=d0dfcc8a-417a-41e3-ad2e-9736317f2d8  /  ext3  defaults,errors=\
       remount-ro 0 1
     The change that matters here is the first column, you don't need to
     modify the other columns of this line.

How to recover from the problem after the upgrade	
-------------------------------------------------
Preliminary remark : once you have successfully applied one of the solutions
  below, you should consider applying one of the two appoaches above to get
  definitely rid of this issue.

Solution 1 :
This is applicable when Grub shows you the menu interface for selecting
the entry you want to boot from. If such menu does not appear, try
pressing 'ESC' key before the kernel boots in order to make it appear.
If you can't get into this menu, try solution 2 or 3.

 1. In the Grub menu, highlight the entry you want to boot from. Press 'e' key
    to edit the options related to this entry. You will see something like :
      root (hd0,0)
      kernel /vmlinuz-2.6.26-1-686 root=/dev/hda6 ro
      initrd /initrd.img-2.6.26-1-686

 2. Highlight the line
      kernel /vmlinuz-2.6.26-1-686 root=/dev/hda6 ro

    press 'e' key and replace 'hdX' with 'sdX' ('X' being the letter 'a','b',
    'c' or 'd' depending of your system), In my example the line becomes:
      kernel /vmlinuz-2.6.26-1-686 root=/dev/sda6 ro

    Then press 'ENTER' to save the modification. If other lines show 'hdX',
    change these line too. Don't modify the entry similar to 'root (hd0,0)'.
    Once all modifications are done, press 'b' key. And your system should
    now boot as usual.

 3. If this solution worked. Login to your system, make a backup of the
    '/boot/grub/menu.lst' file. Then generate a new '/boot/grub/menu.lst'
    by issuing with root privileges the command:
      update-grub

 4. Edit '/boot/grub/menu.lst' and make sure all occurences of 'hdX' were
    replaced by 'sdX'. There is nothing wrong with the lines similar to:
      root            (hd0,0)
    just leave it as it is.

 5. Reboot your system, it should reboot correctly.

Solution 2 :
Boot from a debian installation media (cd/dvd) and when prompt, type
'rescue' to launch the rescue mode. Select your language, location, keyboard
mapping, let it configure the network no matter if it success or not. After a
while, you should be asked for selecting a partition you want to use as root
file system. The proposed choices will look something like:
 /dev/ide/host0/bus0/target0/lun0/part1
 /dev/ide/host0/bus0/target0/lun0/part2
 /dev/ide/host0/bus0/target0/lun0/part5
 /dev/ide/host0/bus0/target0/lun0/part6

If you know which partition is your root file system, choose the right one. If
you don't, just try with the first. If it complains about an invalid root file
system partition, try the next one, and so on. Trying one after the other
shouldn't arm your partitions and if you have only one system installed on your
disks, you should easily find the right root file system partition. If you have
many systems installed on your disks, it would be better to know exactly which
is the right partition.

Once you have choosen a partition, you will be proposed among several actions.
Make the choice of executing a shell in the selected partition. If it complains
that it cannot do that then try with another partition.

Now you should have shell access as user root on your root file system
mounted on '/'. You need access to the /boot, /sbin and /usr directories
content. If these directories need to be mounted from other partitions, do it.
(see '/etc/fstab' if you have no idea of which partition to mount)

 1. Make a backup of the '/boot/grub/menu.lst' file. Then generate a new
    '/boot/grub/menu.lst' by issuing with root privileges the command:
       update-grub

 2. Edit '/boot/grub/menu.lst' and make sure all occurences of 'hdX' ( 'X' is
    a letter among 'a','b','c' or 'd' depending of your system) were replaced
    by 'sdX'. There is nothing wrong with the lines similar to:
      root            (hd0,0)
    just leave it as it is.

 3. Type 'exit' to leave the rescue shell
 4. Select 'reboot', it should reboot correctly.

Solution 3 :
 1. Boot from your favorite LiveCD distribution (Debian Live,
    Knoppix, and many other).
 2. Mount the partition where your '/boot' directory is. If you don't know
    which one it is, use the output of the command:
      dmesg
    to find whether your disk is known as hda, hdb, hdc, hdd or sda, sdb, sdc,
    sdd. Once you know which disk to work on, for example sdb, issue the
    following command to see the partition table of the disk and to find the
    right partition:
      fdisk -l /dev/sdb

 3. Assuming that you have mounted the right partition under '/mnt' and
    that this partition contains the '/boot' directory and its content,
    edit the '/mnt/boot/grub/menu.lst' file.

    Find the section similar to:
      ## ## End Default Options ##

      title           Debian GNU/Linux, kernel 2.6.26-1-686
      root            (hd0,0)
      kernel          /vmlinuz-2.6.26-1-686 root=/dev/hda6 ro
      initrd          /initrd.img-2.6.26-1-686

      title           Debian GNU/Linux, kernel 2.6.26-1-686 (single-user mode)
      root            (hd0,0)
      kernel          /vmlinuz-2.6.26-1-686 root=/dev/hda6 ro single
      initrd          /initrd.img-2.6.26-1-686

      ### END DEBIAN AUTOMAGIC KERNELS LIST

    and replace every hda, hdb, hdc, hdd respectively with sda, sdb, sdc, sdd.
    Don't modify the line similar to:
      root            (hd0,0)

 4. Reboot the system, remove the LiveCD and your system should boot correctly.
 5. If it boots correctly, login, make a backup of the '/boot/grub/menu.lst'
    file. Then generate a new '/boot/grub/menu.lst' by issuing with root
    privileges the command:
      update-grub

 6. Edit '/boot/grub/menu.lst' and make sure all occurences of 'hdX' ( 'X' is
    a letter among 'a','b','c' or 'd' depending of your system) were replaced
    by 'sdX'. There is nothing wrong with the lines similar to:
      root            (hd0,0)
    just leave it as it is.

 7. Reboot your system, it should reboot correctly.




Reply to: