Friday, September 29, 2006

GRUB reinstall woes

I recently had to reinstall Windows on my dual boot (Windows/Ubuntu 6.06) system. This of course wiped out the GRUB loader in the MBR. Now, the normal method of restoring GRUB is to do this:
1. Boot from your linux installation CD (In case of Ubuntu just go through the Start or Install Ubuntu routine till you get the desktop)
2. Open up a terminal and mount your boot partition
3. Switch the system root and do a grub-install to restore the grub from the boot partition on your MBR.

Now the normal commands to do this do not work in Ubuntu for some reason. For example, doing
$ sudo mkdir /mnt/ubuntu
$ sudo mount /dev/sda8 /mnt/ubuntu #(/dev/sda8 is my / partition)
$ chroot /mnt/ubuntu
$ grub-install /dev/sda #(install grub to the MBR)

This kept giving me errors like "/dev/sda: Not found or not a block device". After some searching I landed up at this Ubuntu Wiki page that lists a number of approaches to reinstall GRUB. Some of them still didn't work, but the one that did work is this:

1. Pop in the Live CD, boot from it until you reach the desktop.
2. Open a terminal window or switch to a tty (Ctrl + Alt + F1).
3. Type "sudo grub"
4. Type "root (hd0,7)", or whatever your harddisk + boot partition numbers are (my /boot is at /dev/sda8, which translates to hd0,7 for grub).
5. Type "setup (hd0)", or whatever your harddisk number is.
6. Quit grub by typing "quit".
7. Reboot.


Happy GRUBbing :)

Labels: , , ,

Friday, December 16, 2005

Mouse wheel scrolling in Linux

The default installation for Slackware Linux does not have mouse wheel scrolling enabled. This is what I did to enable mouse wheel scroll:

(You need to have root permissions for this procedure)
Open up the X-Server config file (/etc/X11/xorg.conf)
Find the mouse/input device section (generally identified by the Identifier "mouse")
Make sure it is using the IMPS/2 protocol. This can be done by adding or updating the Protocol option:
Option "Protocol" "IMPS/2"

You need to set up the server to recognise the wheel as another button on the mouse. This is done by setting the "Emulate3Buttons" option and the "Buttons" option to 5.
Option "Emulate3Buttons"
Option "Buttons" "5"

Finally, scrolling is enabled by setting the ZAxisMapping option
Option "ZAxisMapping" "4 5"

Restart the X-server (Ctrl+Alt+Backspace should do it) and the mouse wheel should start working.

Labels: ,