Wednesday, October 10, 2007

grub got your goat?

GParted decided to balls up before finishing a move and resize job where I wanted to decrease my oversized swap partition from about 4 gigs down to 1.2 gigs and increase the size of the partition I used for storing big media files (immediately next on the disk).

So I was left with a slightly knacked partition table and decided to burn a proper GParted livecd which also contained a program called Testdisk. This was able to rebuild the partition table (although it disturbingly seemed to think the drive had 16 heads every time I loaded it, and complained that either this setting was wrong or the disk layout was crazy until I changed it to 255... every time), but at some point I managed to overwrite the MBR as well by picking the wrong option.

Attempts to reconstruct the GRUB bootloader's MBR claimed success, but actually trying to boot from the hard disk resulted in just a cursor flashing indefinitely. No message from GRUB, even.

Eventually, I found that the instructions I'd been following didn't tell me enough and that making the bootloader was a bit more involved than just:
"root (hd0, 1)
setup (hd0)",
and certainly more difficult than just running "grub-install /dev/hda2", which wasn't at all happy.

In the end, I started copying an entry from my boot partition's old GRUB menu.lst and replacing the now-inaccurate drive references:

The final sequence of commands to fix the thing was something like this:

root@gparted:~# grub
[ Minimal BASH-like line editing is supported. For
the first word, TAB lists possible command
completions. Anywhere else TAB lists the possible
completions of a device/filename. ]

grub> root (hd0,1)
grub> kernel /boot/vmlinuz-2.6.20-16-386 root=/dev/hda2 ro quiet splash
grub> initrd /boot/initrd.img-2.6.20-16-386
GRUB Error 16: Inconsistent filesystem structure
grub> setup (hd0)
[snip a few lines of blah followed by "success"!]
grub> quit

root@gparted:~# reboot


The "error 16" line when I tried to set up the initrd threw me, but after running e2fsck on the partition at least twice I decided it was just GRUB being a bollox and went ahead with it. GRUB's own filesystem mini-tests suggested things were okay anyway. So after rebooting everything was ok.... although once I logged in, I ran a command called "update-grub" which may be Ubuntu-specific. This seems to have incorrectly specified the root partition, but we'll see...

So anyway, try that more verbose tactic before executing GRUB's setup command, if you run into a similar problem.

Thursday, October 04, 2007

swiping a computer

After a few days of limbo, having started my postgraduate course in DCU, I still wasn't able to get into the secure(ish) research bay. Nagging to the school office did no good, so I went to the Estates office in person against the recommendation of the school secretary. Handily, the lass in the Estates office swiped my card, noted that I hadn't had privileges to open those doors added and dragged the equivalent permissions onto my set - all of 2 minutes' work.
Then I went back to my desk, without having to wait for someone to let me in like an orphan boy, and waiting around for someone to set my nicked (from someone who hopefully wasn't using it anymore) crappy Pentium III PC to allow network logins.

I'm going to assume that this amount of hassle, bureaucracy and poor inter-department communications is a normal thing.