Tag Archives: grub

XBMCbuntu: Recover from “Error: File Not Found. Grub Rescue” Fail Tips, Tricks and Tutorials 04 JUL 2014

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).

boot-repair screenshot

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! :)

xbmc-logo-banner

Ubuntu Server fstab Failed Tips, Tricks and Tutorials 19 JUN 2014

Oh dear. On return from a lovely long weekend away at Piekenierskloof Mountain Resort, we discovered that our XBMC media server had inexplicably died – essentially the primary hard drive just would’t load the XBMCbuntu operating system any more. With a very dejected Jessica (no My Little Pony: Friendship is Magic for her), I set about re-installing XBMC 13.0 “Gotham”, and of course, I became just a little too clever for my own boots.

There are two old hard drives in the old machine, one larger than the other. So naturally I installed XBMCbuntu on the smaller of the two, formatted the larger drive to ext4 and then symbolic linked the Movies and TV Shows folders on the primary drive so that they point to the second drive (essentially I want to store all video content on the larger drive, but without going through all the hassles of maintaining multiple sources in XBMC).

Knowing that I need to auto-mount the second drive in order for this to work, I added the UUID mount command in the /etc/fstab file as per norm, and it was at this time that I spotted some great tips on optimizing drive speed by adding parameters like noatime and data=writeback. Without doing any proper research, I added in the options to all my hard drive mounts in fstab, and of course, on reboot the system fell over.

So how do your recover from a mount fail because of a bad or corrupt fstab file?

Essentially you need to be able to boot into the system with write access and a mounted / path so that you can alter the fstab file and try and get it back into a stable state. To do this, you need to access the GRUB menu and alter the kernel parameters of your Ubuntu load string.

First, if your box doesn’t come up with the GRUB menu automatically before continuing, you can force this by rebooting your computer and holding down SHIFT. Once the GRUB menu is up, select the Linux entry you want to load and press ‘e’ to edit it.

In the edit view, locate the kernel entry – it should look something similar to this:

linux   /boot/vmlinuz-3.5.0-23-generic root=UUID=862e9bd8-8641-478a-96a3-d5ad9a53b104 ro find_preseed=/preseed.cfg noprompt  quiet

Add the following at the end of the kernel entry:

rw init=/bin/bash

Save your changes and launch the edited entry – your machine will boot and you should end up in a bash prompt environment. The / path is mounted in read/write mode, meaning you can now go ahead and edit (read: fix) /etc/fstab, save your changes, and reboot!

ubuntu black and orange logo