Archive for December, 2008

Rescuing your Linux system from a failed grub install

It is bound to happen at some point. You’ve installed the latest kernel or you’re attempting an upgrade and now your system just won’t boot. The screen shows nothing more than GRUB. If your system isn’t able to get past the GRUB prompt and it isn’t because of a hard drive failure then chances are very good that you can rescue your system. This routine will work best if you created a non LVM boot partition or if your rescue cd includes the LVM tools.

This post assumes you are running a RedHat or Fedora based system but the concepts apply to all systems that use grub to boot. It also assumes you have a relatively recent install cd.

To get started, insert your install cd. In my rescue scenario I used a CentOS install cd. When the install has loaded to the initial screen enter ‘linux rescue’ and press enter. The cd will boot like normal and ask about your preferred language and keyboard layout. Continue until you are asked if the rescue routine should find any installed systems. If your root directory exists in LVM you should say no, unless you the rescue cd you using includes LVM tools. It isn’t important to mount root anyway, just your boot partition.

When you are at a prompt, create a boot directory at / and mount your boot partition there. In a typical RedHat/Fedora setup it will be on /dev/[h|s]da1. Next, rename the current device.map files to some other name. We’re now ready to reinstall grub.

Type grub and press enter. You’ll now be in the grub interface. Type ‘root (hd0,0)’ and press enter. Next, type ’setup (hd0)’ and press enter. Some text will flash by with, hopefully a success message. If you see success you should now be able to reboot into your Linux system.

Lets talk about this auto bailout

I want to take a small detour from the usual content and talk about the auto bailout that has been in the news. I have really mixed feelings about this bailout. On one hand I understand that there are indeed some jobs at stake but on the other hand, I really hate that nobody is talking about how these companies should have seen it coming.

Lets take GM as an example. A couple years ago they released all new SUV’s and trucks as well as the Acadia crossover (one of the heaviest ever produced) at a time when gas prices were clearly on the rise. Of course, in a classic case of brand engineering all of the GM divisions released their own versions of each. Since then we’ve seen little to nothing in the way of affordable, efficient cars that can compete with what other companies are producing. GM for too long has concentrated on the once lucrative SUV business and their smaller cars are suffering. Meanwhile companies like Toyota, Honda and even Kia (owned by Hyundai) are surviving just fine in the the current economic situation.

Time Machine saves me again

Lately I’ve been talking a lot of talk about how great the Mac platform is. At work I go back and forth with a coworker on the merits of Linux and OS X. Of course he claims that Linux is all you need and I’m confident that the Mac is where it’s at. The reality is that OS X suffers its own set of issues which I have talked about in the past. No OS is perfect, just a matter of which one best fits your needs.

Anyway, through no fault of my own I managed to royally screw up my iTunes library to the point where some of the files were pointing to random objects in my backup drive. I have no idea how. At the same time my iPod Touch would simply not cooperate. Many files that I normally sync were listed as missing including over half of my largest play list which is still just a small subset of my entire collection.

So anyway, what’s my point right? My point is that I was able to save myself a ton of work simply because I turned on Time Machine.

Everybody says, “make sure you make a backup” but lets be serious, who actually does? This is one of the many reasons I claim OS X to be one of the best operating systems available for “normal” people. No other system that I am aware of provides such a simple, easy to use and surprisingly robust backup AND restore system. It is so easy you might actually forget it is there.

Restoring my iTunes library to normality was as easy as entering the Time Machine interface, going to the previous point in time, clicking the iTunes library files in my Music folder and clicking the restore button. Done deal. I plugged my iPod in and all of my files were copied back to it as if nothing had happened.

Return top

About

Systems Administrator by trade, opinionated by nature.