The problem with running your Media Center PC on the floor next to the television is that your little three year old girl who likes to do things without any assistance at all, will press every and any button at random in the hopes of loading up My Little Pony: Friendship is Magic.
One such session caused the boot flag to corrupt on my shiny XBMCbuntu installation, meaning that on boot, the PC simply sat there with the disastrous fail message of “Error: File not found. Grub rescue…” blinking back at me.
Right, so the Grub boot loader is broken. How do we fix?
Well first, you will need a LiveCD, which you should have because you would have used it to setup the media server in the first place. Once you’ve selected the try (no install) option from the LiveCD boot menu (remember, you’ve changed the BIOS to boot up from either the CD or USB drive in order to launch this menu), access a terminal by pressing ALT+CTRL+F1.
You need an Internet connection on the box because the next step is to download and install the very nifty Boot Repair utility:
sudo add-apt-repository ppa:yannubuntu/boot-repair sudo sed 's/trusty/saucy/g' -i /etc/apt/sources.list.d/yannubuntu-boot-repair-trusty.list sudo apt-get update sudo apt-get install -y boot-repair && (boot-repair &)
Note that we manually tweak the apt sources.list to change our entry from trusty to saucy before attempting to grab boot-repair. If you are using an older version of XBMC you can probably skip this, but I’m using XBMCbuntu 13 which is obviously build on top of the Trusty Tahir build of Ubuntu. (The reason for this is that Boot-Repair hasn’t yet been made available for the latest version of Ubuntu)
Also, actually running boot-repair might fail for you (failed to initiated graphics), in which case you need to attempt the following:
Hit ALT+CTRL+F7 to jump back to the visual XBMC application. Select Exit from the shutdown menu, which should then drop you into a Login menu. On the top right of the screen, change the selected login target from XBMC to XBMCbuntu. Login using username = xbmc and password = ” (blank). Once in the desktop, locate and run the boot-repair utility. If you can’t spot it, open the UXTerm terminal and run boot-repair.
With Boot Repair now up and running, click on the “Recommended Repair” option. This will reinstall Grub and set the pointer to point to the correct location, and in so doing fix your boot issue. (If it doesn’t, go into the “Advanced Option” and tinker around a bit to best suit your environment).
Once you see a message reading “Boot successfully repaired”, you can safely remove the LiveCD or USB drive, and reboot your machine.
Crisis averted, My Little Pony: Friendship is Magic is back on demand! :)