Repairing a non booting Linux box

|

The other day my primary mail server was rebooted after some routine package upgrades and it refused to boot! Technically, the BIOS failed to handover to Grub2, so I had to reinstall Grub2 on the MBR of the Boot disk.

I thought I'd document it here, for posterity, and because I didn't see it explicitly called out elsewhere.

First thing to do is get a live linux USB stick: I use UNETBOOTIN, a handy tool which will download and install a live linux distro (or FreeDOS, BSD, etc) to a USB stick. You'll probably need a 4GB stick or larger, which is no big deal these days.

Once you've got your USB stick, go ahead and boot the Linux box using it to your distro of choice. I normally use a recent version of Fedora, because I've been a Redhat user since 1999, but any recent version of Linux should have the tools below available.

Once you're running your live linux, you'll need to open a terminal, and become root, then re-install the grub boot code to the MBR. The following assumes that your boot partition is /dev/sda1, and the boot device is /dev/sda. (you mount the partition, but you install the MBR on the device.)

$ sudo su -
# mkdir /mnt/sda
# mount /dev/sda1 /mnt/sda
# grub2-install --boot-directory /mnt/sda/boot /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.

That should be it. Reboot, and remember to remove your USB stick!

Aside: I have had problems with recent Live Installs where the UUID of the boot volume is reported wrongly, so that the USB stick won't boot, but instead fails to the DRACUT emergency Root Console. You need to run blkid and write down the UUID of the boot media and then manually edit the ubninit code to get the right UUID.

About Me

Contact

  • Unsolicited Bulk Email (spam), commercial solicitations, SEO related items, link exchange requests, and abuse are not welcome here and will result in complaints to your ISP.
  • Any email to the above address may be made public at the sole discretion of the recipient.

Other Stuff

  • Powered by Linux
  • (RedHat Linux)

Categories

Monthly Archives

About this Entry

This page contains a single entry by dave published on May 21, 2015 11:57 AM.

My history with Ultimate Ears earbuds was the previous entry in this blog.

HK Smart ID Cards, Three Stars and Right of Abode is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.