Tweaking grub settings : Ubuntu (5.10 / 6.06.1 / 6.10)
Most of you have probably at least heard of “grub” but may not be completely familiar with it. What it does or how to make it work for you is quite another story for most people. I’d like to outline a few minor tweaks that anyone can make to grub to update their boot-time options.
Your grub config on an Ubuntu system is outlined at /boot/grub/menu.lst. There is quite a lot of commenting in that file so, if you take the time to read through, you’ll should be able to figure out quite a bit on your own. I want to outline a couple things that I often tweak within grub.
First and foremost you should make a backup of the file before you make any changes. As always, there is a chance that you could make errors in your changes and it’ll save your day if you’ve made a backup. Make a backup using a command like:
sudo cp /boot/grub/menu.lst /boot/grub/menu.lst-backup
After you’ve made your backup copy you’ll want to edit the file to make a few changes. You would do that using the following:
sudo gedit /boot/grub/menu.lst
Now we get to the fun stuff! What to look at and what to change? So many questions. Below are some of the settings that can be changed within grub and what they do.
default – allows you to specify the default grub listing. This defaults to 0 and you generally don’t need to change this.
timeout – allows you to change the countdown before grub automagically boots into the default listing. By default it should be set to 3 (seconds). If you need more time to choose the kernel or OS to boot into you can change this. Simply change the entry from:
timeout 3
to something like
timeout 10
or, of course speed things up, setting it at
timeout 1
hiddenmenu – allows you to specify whether or not your grub menu will be hidden at boot time. By default it is hidden and prompts you to press ESC to see the menu. If you would prefer to see the menu each time you boot simply comment out the line. Example, you would change:
hiddenmenu
to
# hiddenmenu
The file then moves into some commented code to show you examples of listing and the style and options you can set. Below that underneath
## ## End Default Options ##
you’ll see the kernels or OS’ that you have listed for your system. These break down into four main options. This is an example of my current listing for the 2.6.17-10-generic kernel:
title Ubuntu, kernel 2.6.17-10-generic
root (hd0,0)kernel /boot/vmlinuz-2.6.17-10-generic root=/dev/hda1 ro quiet splash
initrd /boot/initrd.img-2.6.17-10-generic
quiet
savedefault
boot
A few of these settings are optional but the required options are:
title – this is the menu listing you will see at boot. You can change this to whatever you’d like. An example could be:
title Ubuntu - The best distro ever! (2.6.17-10-generic)
(the reason that I listed the kernel version is so I can tell future updates or other customizations apart from this. You generally want to run the latest kernel and, in certain situations, run a previous. It is generally a good idea to list the kernel version in whatever “nickname” you set for your grub listing title.)
root – this is where the root of the file systems is located. Your partitions may be someplace on hda, but hd is the very root. You won’t want to change this but you might notice a difference if you’re running a dual-boot system.
kernel – the kernel option is where to find and what kernel to use for this option. If you create a custom kernel you’ll need to specify the path to that file. Or, in some situations you might be booting multiple distributions and in that case you’d need to specify the path to each kernel.
Also, the root option specifies the partition to find the distribution or OS files. This must be set correctly in order to find the kernel and other options.
ro, quiet and splash – these are optional but load the pretty splash screen that you see at boot time.
initrd – this loads the image that goes along with the kernel option above. The kernel (vmlinuz) and initrd (img) file are generally stored in the same place. Make sure that your paths match the exact file if you are customizing your menu.lst.
savedefault – this refers to the default option listed above. As this is our default option and latest kernel it is specified as such. If you take a look at your file you’ll notice the first listing is the only one with the savedefault option.
You should be a little bit more confident in tweaking your grub listing at this point. There isn’t a lot to it but it is one of the most critical system settings. If you ruin your grub file your system (or any system on your machine!) will not boot. Be careful with it but, as usual, your system is only as powerful as you are educated so take the time to know how your system runs. In most cases you wont need to edit grub, but for those of you feeling adventureous perhaps try to change the timeout setting or change the title for your options. Best way to learn is to try!
technorati tags:grub, boot, linux, ubuntu, breezy, dapper, edgy
If this article has been helpful, please consider linking to it.