Friday, May 14, 2010

Customizing grub, Part 1

Ubuntu has upgraded grub to version 2 in their default install. The new version is more powerful than the old one, but the config interface has changed.

Aaargh! Where is menu.lst?!

The bad news is that it has been moved (to /boot/grub/grub.cfg), and you aren't supposed to modify it. The really good news is that it is automatically generated by scripts--which you can hack!

This is really nice, because now, whenever Ubuntu releases a kernel upgrade, you don't have to modify menu.lst anymore to get rid of those extra boot entries. Instead, just run

$ sudo rm *<old kernel version>*
$ sudo update-grub

and grub will regenerate grub.cfg, removing the old entries!

Now, where are the config scripts? They are in /etc/grub.d. When you run update-grub, each of the scripts in /etc/grub.d are run in order and their output is dumped into /boot/grub/grub.cfg.

To change the boot options, just change the scripts in /etc/grub.d. For example, I was having some display problems, so I went into 10_linux to set up some kernel boot arguments like so:

linux_entry ()
  args="$4 radeon.new_pll=0"

Next post, I'm going to be doing some advanced stuff to automatically generate cleaner boot menu entries. See you then!

No comments:

Post a Comment