Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Wiki / Kb_Grub

Kb_Grub

My GRUB-based Linux image no longer boots because I think my GRUB install is broken, how can I fix it?

NOTE: currently, the following directions only work if you are using the Linux-based admin MFS (at Utah, that means on a "d710" node).

If rebooting your machine does something like:

    Device info for hd0,2
    ==========================
    Partition map type: part_msdos
    Partition type: 83
    Filesystem type: ext2
    Filesystem label: /
    Filesystem UUID: a2dabcf1-ef6a-4936-8af3-5e362309398f
    Kernel command line:

    OS installed on hd0,2 is Linux
    Booting Linux on (hd0,2)...
    No kernel specified. Falling back to chain boot...

and then either reboots or hangs, then you may have messed up your GRUB installation. You can reinstall GRUB using the Linux admin MFS. From ops or boss do:

    node_admin on pcXXX

When the machine comes up, login and do:

    sudo mount -t ext3 /dev/sda2 /mnt
    sudo mount --bind /dev /mnt/dev
    sudo chroot /mnt grub-install /dev/sda2

Ignore any messages about /dev/mapper or unknown partition table signatures. It should ultimately say:

    Installation finished. No error reported.
    This is the contents of the device map /boot/grub/device.map.
    Check if this is correct or not. If any of the lines is incorrect,
    fix it and re-run the script `grub-install'.
  
  (fd0)   /dev/fd0
  (hd0)   /dev/sda
  (hd1)   /dev/sdb

at which point you can unmount the filesystem, turn off admin mode, reboot and see if that helps.

Note that one scenario in which you will need to reinstall GRUB is if you are loading a Linux image into partition 1 (or any other partition) rather than partition 2. In that case, before you run the chroot-ed grub-install, you will first need to make sure that the /etc/fstab on the disk (i.e., /mnt/etc/fstab) correctly reflects /dev/sda1 instead of /dev/sda2 (note that it may not mention /dev/sda* at all).