Customise Ubuntu with GRUB


GRUB has been with us for a while replacing LILO (Linux Loader) before it and adequately performs its task of allowing you to boot multiple operating systems (including Windows) and even multiple kernels within operating systems (at least with respect to Linux) without too much hassle.

But it had its limitations. It wasn’t particularly pretty it was hard to make custom menus and most importantly didn’t natively recognise drive UUIDs (universally unique identifier) so it was dependent on the system’s BIOS to correctly identify drives. The latter is a useful feature: as every drive has its own UUID and you can add or remove drives from a system or even take them to another computer and you will always be able to boot the correct drive regardless of how the BIOS identifies them.

Change your default boot with Startup Manager.

And so GRUB2 was born. But it wasn’t a small change – ostensibly to fix a range of legacy issues both the configuration files and their structure changed rendering users who were familiar with GRUB as newbies in a foreign GRUB2 land. And we had no choice but to switch – GRUB2 became the default boot loader from Ubuntu 9.10 onwards.

Most users on the whole don’t need to deal with GRUB2 much. Usually changes are related to fixing Windows boot problems managing multiple distributions on the one machine or adding and removing kernel boot entries. But every now and then you might find yourself needing to make some changes. As the feature set and complexity of GRUB2 is enough to warrant whole online manuals I’ll focus on the easier ways of making the type of changes you’re likely to want over the course of using your Ubuntu system. In fact I promise to stay away from the command line to do so!

Changing boot order
Especially if you’re playing with different kernels or you’ve decided you want to change your default boot option to/from Windows and Linux there’s no need to edit the GRUB2 configuration file and directory ordering – a simple tool called Startup Manager can do this for you. To install simply search for ‘Startup Manager’ in the Ubuntu Software Center.

Startup Manager was originally designed for GRUB and provides for quite a range of configurable and tweakable settings. It’s recently been updated for GRUB2 and while not all the same features are supported as with GRUB the most useful changes are – such as setting your default boot.

Re-order and re-name boot entries for GRUB2.

Launch Startup Manager from System > Administration. After performing some setup tasks simply use the drop-down box for ‘Default operating system’ to choose your default.

There’s also the option to tweak the resolution GRUB2 uses – for setting it to be higher such as 1280 x 1024 – which can help if you have long lists or simply want a less DOS-looking boot selection screen. However if you use NVIDIA cards and the official NVIDIA drivers see ‘Fixing Plymouth with NVIDIA/ATI’ below which will do this for you in the process too.

Removing old kernels
If you’re diligent with your Ubuntu updates you’ll inevitably end up with many kernel entries in your GRUB2 boot menu every time Ubuntu updates to a new kernel. Chances are you only want to keep the latest so how do you remove the old kernel clutter from your boot menu?

Clean out old kernels from GRUB2 with Ubuntu Tweak.

The quickest and easiest method is just to use the ‘Clean kernels’ function and uninstall them in the process too (this freeing up disk space) of Ubuntu Tweak an excellent tool I’ve covered here in the past. If you don’t already have Ubuntu Tweak installed grab it from ubuntu-tweak.com.

Once installed run it from Applications > System Tools. Click on Package Cleaner from the left-hand menu then the Clean Kernels button. You’ll need to click ‘Unlock’ at the bottom before you can make changes. This function will automatically pick up all kernel entries in GRUB2 except for your currently booted kernel. Click ‘Select All’ and then ‘Cleanup’ to zap them. If you want to be super-organised click ‘Clean Config’ next and remove any leftover related files.

Advanced menu ordering
GRUB2 is powerful but not easy to get the hang of especially when editing the configuration file and mucking around with the directory-ordering to set menu order. Thankfully there’s another GUI-based tool that can save you some headache if you need to do more advanced menu editing.

First install the PPA for the Grub Customizer package: click System > Administration > Update Manager and then click Settings. On the Other Software tab click ‘Add’ and enter:

deb http://ppa.launchpad.net/danielrichter2007/grub-customizer/ubuntu maverick main

Click Close and opt to Reload when prompted. Launch the Ubuntu Software Centre and expand the Get Software tree. You should see a new entry called “Launchpad PPA for Grub Customizer”. Click on this and choose to install the package.

Adding Grub Customiser to the Software Center.

To launch it head to Applications > System Tools. There are a number of useful functions you can do here. To re-order entries select one and use the Up and Down arrow buttons at the top. Note you may need to move the parent entry to move some entries (such as ‘OS prober’ to move a Windows entry).

To re-name an entry (handy as the default GRUB entries can be convoluted!) simply left-click on a title.

Choosing Edit > Preferences allows you to timeout default boot selection kernel parameters and basic theming such as the background image and text colours.

Fixing Plymouth with NVIDIA/ATI
If you choose to install the accelerated 3D drivers for your NVIDIA and ATI cards – and you should they provide much better performance and will enable acceleration for 3D desktop effects – one unfortunate side-effect is the Ubuntu boot splash screen and cycling dots no longer works properly. This is a function of Plymouth which provides the boot splash effect.

Fix Ubuntu’s boot splash with accelerated Nvidia and ATI drivers.

Fixing it however is relatively easy thanks to a script developed by Kyle Baker and Marius Nestor. Grab the script and make it executable so from a terminal type:

wget http://launchpadlibrarian.net/57638460/fixplymouth
chmod a+x fixplymouth
sudo ./fixplymouth

It will first try and detect your available resolutions for your display though this doesn’t always work. From the list or if you know what resolution and colour depth you want enter it in the format AAxBB-CC. For example: 1280×1024-24. It’s important there are no spaces.

The script will take care of the rest and when you next reboot GRUB2 will use your new resolution and Plymouth should now work as before.