Friday, March 19, 2010

Ubuntu Wubi install fails to boot after kernel update

On the laptop I use at work, like in most big corporates, there's a Windows environment installed. Messing around with creating and deleting partitions is not a good idea when carrying ongoing projects around. So the best option for me to safely install a Linux system on that laptop was to use Wubi.

Installation went without a glitch, the setup ran fine for months. I installed Ubuntu 9.10 running on a 12GB image file on my NTFS partition. Sure I loose a little disc speed compared to an install on a dedicated partition, but not so much that it becomes annoying.

But then there was that kernel update, and the reboot, and within seconds I was looking at the GRUB prompt. Hrmmm, not good. Now what?

Fixing this problem was not so hard to do (I found a solution on the Ubuntu forums). At the GRUB prompt start typing the following (the lines starting with # are comments obviously):

# load the ntfs module
insmod ntfs
#set root depending on where you have wubi installed typically its (hd0,1) for the Windows c-drive
set root(hd0,3)
loopback loop0 /ubuntu/disks/root.disk
set root=(loop0)
#set the kernel, you can complete the "..." by pressing the "tab" key and pick your kernel
# /dev/sda3 is where my root is installed, also here typically use sda1 for the c-drive
linux /boot/vmlinuz... root=/dev/sda3 loop=/ubuntu/disks/root.disk ro
#set the initrd image, you can complete the "..." by pressing the "tab" key
initrd /boot/initrd/initrd.img...
#now boot the environment you just setup
boot

After entering the "boot" command, hopefully, you'll see your system waking up again from it's GRUB hibernation. After login redo the grup setup/configuration by executing the following command, so next time you see your old trusty Grub boot menu again:

sudo update-grub

It took me about half an hour to get my system running again.

Now, after reading up on it, it seems that the above solution might not be a permanent one. It could happen again on the next kernel update. Check out this wiki post: Wubi 9.10 boot problems

Tuesday, March 16, 2010

File system corruption

Normally when I power up my headless Ubuntu server, I wait 1 minute for it to boot and I'm in business. I have access to my files, SVN repository and backups. But not last week. I waited for 15 minutes... nothing happened.

Using SSH to connect to the box was not working. So I hooked up a monitor to the machine and found out it gave me errors that I figured out had to do with ext3 file system corruption. Ohhhh hell.

But because this machine is used as backup server and development environment, luckily, this issue is not the end of the world for me, because I still have 95% of the data that's on that server on other machines. It's just a time consuming job to get everything back and centralized again.

So the terminal greeted me with the "Enter root password or press Ctrl-D" prompt. I was clueless. I read a million different forum threads on using the fsck tool with a mix of command line options. I tried one fsck command that looked safe to execute, tried another, but after it ran the system was still in the same state.

Hrmmms... the next thing I tried was pull out the disc from the Ubuntu server and mount it into a Windows box. I installed the Ext2 FS driver, rebooted and *big smile*... the drive showed up and I was able to recover the data that was unique to the crashed system.

After getting the disc back in the machine and doing a full format of the drivers in the server everything looked fine. I reinstalled the machine with Debian 5.0.4 instead of Ubuntu and only got Samba going again for now, because that was most urgent. After that, I spent a few evenings backing up my data again.

So I now feel a little less secure with that backup server. But only because I still have no idea what's the best way to recover from an ext3 file system corruption. I know I succeeded using a Windows environment to recover parts of it, but still, I should be able to do it using that "Enter root password or press Ctrl-D" prompt.

Note: Trying to be prepare better if it ever happens again, I today Googled some more about the subject and I stumbled on a free Windows tool called R-Linux , that some other guy used to recover his data from an ext3 partition. But still no new on a pure Linux based solution.