Friday 11 November 2011

Fixing a fucked Grub2

I have recently encountered a fucked Grub2. This is the latest version of Grub that comes with, amongst other things, Ubuntu Natty. You can't fix it the way I described in the past. That's for Grub1 only.

Why did I end up with a fucked grub? I was stupid. It was entirely my fault. You see, I BELIEVED that this time, when I upgraded my Ubuntu installation from Natty to Oneiric, I wouldn't end up with an unresponsive pile of crap as the result. More fool me.

Because I am not a total buffoon, I made a drive image before attempting the upgrade. I thought I would give True Image Home 2011 another go at being an actual backup program rather than a pointless waste of time. Surprisingly it actually worked. Just about. It had a funny check box thing with some nonsensical question about hard drive ID or some such other thing. I didn't check it. In my experience checking boxes when you do not know what they do is a bad thing.

I now know what this box was asking. It was asking "do you want me not to fuck up your grub when I restore this image?". Oh dear.

So, I was left with a non-working grub. Helpfully I managed to sort it all out, by running these commands from a terminal window on a LiveUSB system.

First of all I mounted the recalcitrant drive into the LiveUSB environment. That's sounds scary. In practice, it means I clicked on the "Places" menu and selected the anonymous drive that was the same size as my Ubuntu, rather than Home, partition on the disk in question.

I then got my terminal window open, and found out where this partition had been mounted by running

mount | tail -1


This command prints the last line [tail -1] of the output of the command to tell you about all [mount]ed partitions. The partition we are interested in should be the last one, because we only just mounted it.

The output I got was along these lines:

/dev/[sdxy] on /media/[string of letters and numbers] type ext4 (rw,nosuid,nodev,uhelper=devkit)


That told me the name of the partition [/dev/[sdxy]] and where it was mounted [/media/[string of letters and numbers]]. That's all I need to know. The next job was to double check that this was the right partition. To do that I just [l]i[s]ted the contents of the [boot] folder on that partition as follows:

ls /media/[string of letters and numbers]/boot


This properly displayed the contents of the boot folder, so I knew I was on the right track. The last step was to run the command to fix everything. This was:

sudo grub-install --boot-directory=/media/[string of letters and numbers]/boot /dev/[sdx]


Please note that I was installing the grub to /dev/[sdx] and NOT /dev/[sdxy], for whatever x and y I got.

And then, surprisingly, it worked fine.

Friday 4 November 2011

More Ubuntu Wifi Joy

My neighbours are flooding my house with super strength wifi signals. or so it seems. I can't get a reliable signal in the upstairs room where the desktop machine is located. My routers is already set on the "I hate my neighbours, make my signal as loud as possible", setting and that is no longer doing the business.

The obvious solution is to change the channel on which the router is broadcasting. The router I use has an auto setting for this, which I presume means is scans around to find a clear channel and then uses that.

This would be an excellent solution if solving IT problems was completely unlike playing fucking Jenga. Yes, this setting change has fixed the reception problem upstairs, but now the netbook refuses to detect the wifi at all. Fucking spiffing.

This is a driver and software problem. I know this because I can boot to a USB Key, and it works find. I can dual boot to my LFS installation (see posts passim) and that works fine as well. It's just the installed ubuntu that doesn't fucking work. All I did was change the wifi channel for fucks sake. No amount of cursing and swearing appeared to fix this.

I eventually decided to manually install the same network drivers as I have running on the LFS installation. This worked fine. Until the next time I rebooted, when they were overwritten by later drivers, which don't fucking work. I have tried to uninstall the newer drivers, but it's as hard to get rid of the fuckers as it is Michael Meyers. Every time I reboot, the bastards pop into existence once more. Pain in the arse.

(Incidentally the fucking useless drivers, on whatever channel my router is now using because they worked find on the old one, are the broadcom hybrid sta drivers 5.100.something.something. The drivers that actually fucking work are version 5.60.48.36)

All of this explains why I now have a script on my desktop called "get_my_fucking_network_working.sh" which contains the following commands:

cd /tmp
cp '/home/[user]/Dropbox/Essential Drivers/Wireless Drivers/hybrid-portsrc-x86_32-v5.60.48.36.tar.gz' .
mkdir hybrid_wl
cd hybrid_wl
tar -xzvf ../hybrid-portsrc-x86_32-v5.60.48.36.tar.gz
unzip '/home/[user]/Dropbox/Essential Drivers/Wireless Drivers/sta_5.60.48.36_2.6.33_kernel_patch.zip'
patch -p0 < patch
unzip '/home/[user]/Dropbox/Essential Drivers/Wireless Drivers/sta_5.60.48.36_2.6.34_multicast_kernel_patch.zip'
patch -p0 < patch_hybrid_multicast
make clean
make
sudo rmmod b43
sudo rmmod b44
sudo rmmod b43legacy
sudo rmmod wl
sudo rmmod ssb
sudo rmmod ndiswrapper
sudo rmmod lib80211_crypt_tkip
sudo rmmod lib80211
sudo modprobe lib80211
sudo insmod wl


I have to run this script every time I boot. Joy of all joys.