Update grub

One of our office servers refused to reboot after a recent update. Attaching a monitor to it we discovered that it could no longer find its boot device. Manually editing grub and changing hda1 to sda1 (its primary SATA drive) caused it to boot successfully. To make the change permanent we applied the following.

Alter the /boot/grub/menu.lst file to show the root at sda1

rossetti@Wakatipu:~$ sudo vi /boot/grub/menu.lst
rossetti@Wakatipu:~$ grep sda /boot/grub/menu.lst
# kopt=root=/dev/sda1 ro

Update grub

rossetti@Wakatipu:~$ sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
warning: grub-probe can't find drive for /dev/sda1.
Please check /boot/grub/device.map, you might have to regenerate it with grub-mkdevicemap.

Update devicemap

rossetti@Wakatipu:~$ cat /boot/grub/device.map
(hd0) /dev/hda
rossetti@Wakatipu:~$ sudo grub-mkdevicemap
rossetti@Wakatipu:~$ cat /boot/grub/device.map
(fd0) /dev/fd0
(hd0) /dev/sda
(hd1) /dev/sdb

Update grub (again)

rossetti@Wakatipu:~$ sudo update-grub
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /boot/vmlinuz-2.6.26-2-686
Found kernel: /boot/vmlinuz-2.6.26-1-686
Found kernel: /boot/vmlinuz-2.6.18-4-686
Updating /boot/grub/menu.lst ... done

Check grub and reboot

rossetti@Wakatipu:~$ grep sda /boot/grub/menu.lst
# kopt=root=/dev/sda1 ro
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/sda1 ro
kernel /boot/vmlinuz-2.6.26-2-686 root=/dev/sda1 ro single
kernel /boot/vmlinuz-2.6.26-1-686 root=/dev/sda1 ro
kernel /boot/vmlinuz-2.6.26-1-686 root=/dev/sda1 ro single
kernel /boot/vmlinuz-2.6.18-4-686 root=/dev/sda1 ro
kernel /boot/vmlinuz-2.6.18-4-686 root=/dev/sda1 ro single
rossetti@Wakatipu:~$ sudo reboot


Categories: HowTos, Snippets