Reorder your Boot Menu with KGRUBEditor

Maybe you've just installed a dual boot system. It's all going well and good, but when you start the computer, Windows appears at the bottom of the boot menu.

You might still want to use Windows as your primary operating system, and so pressing down a few times and Enter each boot time could get frustrating. You'd ideally like Windows at the top of the boot menu, and Linux second.

In this quick tutorial, I'm going to show you how to use KGRUBEditor, a program for editing your boot menu settings, to re-order the menu so that Windows is first, and the default choice.

(If you'd rather quickly edit the configuration file by hand, without installing new software, take a look at this alternative tutorial).

First of all, we need to install KGRUBEditor. You'll probably find it in your package manager if you search for kgrubeditor (help on installing packages).

Once it's installed, launch it, from the System category.

Kdesudo dialogue

You will be asked to give your (or root's) password to continue. A word of warning - through KGRUBEditor, you are editing important settings that tell your computer how to start up properly. Avoid changing settings you don't fully understand!

Once you're in, you'll see something a bit like this (your entries might look slightly different).

KGRUBEditor Interface

Each row in the top pane should correspond to one of the choices you see when the computer starts up.

Click on the Windows row, so that it is selected. Now go to the menu and choose Actions > Move to Top.

KGRUBEditor Actions menu

Once the Windows entry is at the top, you need to also set it as the 'default' entry, so it is the first choice to be selected (otherwise it will be at the top, but not selected).

Right-click the entry for Windows, and choose Set as default.

And that should be it. You can now close KGRUBEditor and reboot to find Windows your default choice. To boot Linux, you can just press down once to the first Linux entry and press Enter.

Adding System Services with Upstart

We took a look at upstart more than half a year ago, and at that point it was only beginning to emerge. In Ubuntu 7.10 and beyond, we are beginning to see the result of what eventually will be a complete replacement for System V. Since we'll be seeing more of upstart in future Ubuntu versions, in Fedora 9, and other distributions, let's take a look at how to make and manage Upstart jobs.

Note: Assume commands are prefixed with sudo if you are not root.

Before jumping into upstart, let's take a quick look at a common configuration of a SysV-style system. Most boot scripts are stored in /etc/init.d. There you will find many scripts for getting your system running. But, they don't actually do anything just sitting in there. You have to activate them into runlevels.

A runlevel is a state of the boot process that tells your system which programs to start, and which to stop. Usually when your computer boots, it will enter a runlevel anywhere between 2 to 5. (If you're anxious to know, run the command runlevel in a terminal.) While you are using your computer, it will usually stay at this level. However, once you reboot, runlevel 6 is entered, which tells most processes to prepare for shutdown and reboot the system. Runlevel 0 is similar, except the system is turned off instead of restarted. The only other notable level is 1, which in most cases is recovery, or single-user, mode.

rcd-context.png

Back to System V: The init.d scripts from above are linked to directories named /etc/rc#.d, where # is the runlevel being entered. These directories are usually full of different scripts, but they all link back to /etc/init.d. The style of them is beyond the scope of this tutorial, but know that upstart is still backwards-compatible with these should you have to use them.

Let's move on. cd to /etc/event.d and have a look at the files in there. You will most likely see a bunch of files that look similar to the rc# directories; these exist for backwards compatibility. You will also see some files like tty0 and tty1, which is what we will be working on.

upstart-eventd.png

If you have an Ubuntu server, most likely you will only have a tty0 file. In many situations, this is not a problem. Tty0 is the main console front-end used only for accessing your server or computer from a physical location. (On a desktop, tty7 is the X display, and all of the others are accessed with Ctrl+Alt+F#. Also note SSH connections are not affected by the amount of tty's available.) However, some web hosts have the option of a recovery console which might run on another terminal interface.

To enable another virtual terminal, such as tty1, in the SysV system, you would probably add a /etc/init.d script to start tty1. Sure, you can still do that, but why would you when you have upstart?

Let's make a new file called /etc/event.d/tty1. Don't make it executable, just write a plain text file. Now, throw this into it:

start on runlevel 2
start on runlevel 3
start on runlevel 4
start on runlevel 5
stop on shutdown
respawn
exec /sbin/getty 38400 tty1

Wait - that's it?

Yes, yes it is. If you read my introduction on runlevels above, this isn't hard to understand at all. We want tty1 to start on runlevels 2 through 5, and stop when the system is turned off. Respawn simply tells upstart to restart the service if it exits, and the exec line tells it what service to start.

Managing a service is even easier. In many systems, services were started by running something like /etc/init.d/service start. What do we do with upstart?

start tty1
status tty1
stop tty1

You probably don't want to run all of these commands in succession; they are just three separate commands to manage jobs. Start and stop do just that, and status tells you if a job is running.

There you have it - and really, this isn't as long as I made it. It really just involves the two black boxes above: upstart job files, and running the jobs. You don't have to run the jobs by yourself either on startup; upstart does this for you. Obviously there is more to just this if you want more complex options, but if you just want to be able to make and manage jobs, that's it. Enjoy.

Colour your GRUB boot menu

That boring white on black GRUB boot menu you get when you switch on your computer is a bit, well, boring, isn't it?

Thankfully, there's an easy way to change it if you go into your GRUB configuration file. A word of warning, though, editing the GRUB configuration file without knowing what you're doing can result in bad things happening and can cause you to not be able to boot your system. Tread with caution.

The configuration file will be located at either /boot/grub/menu.lst or /etc/grub.conf. Open it up, as root, in your favourite text editor.

The line we need to add is the color command. It works like this:

color normal [highlight]

The normal colour, is quite obviously, the colour that will be used normally, and the highlight colour will be the colour when that row is selected to show that it is selected.

For both normal and highlight, though, you can separate the foreground and background colours with a /.

An example of this is if we wanted the following - the normal colour is cyan on blue, and the highlight is white on blue. The code we'd need is this:

color cyan/blue white/blue

According to the relevant GRUB manual page, the available colours you can use are:

  • black

  • blue

  • green

  • cyan

  • red

  • magenta

  • brown

  • light-gray


    These below can be specified only for the foreground.

  • dark-gray

  • light-blue

  • light-green

  • light-cyan

  • light-red

  • light-magenta

  • yellow

  • white

Once you've got the color command you want, you need to put it somewhere in your GRUB configuration file. Your default colour scheme should be put somewhere near the top of the file and this will be used for all the entries in your boot menu unless you specify otherwise.

To have custom colours for an individual entry, just place the relevant color command under its title. For example, if I want my Fedora system to have a red and grey theme, I would have this:

title Fedora release 8 (Werewolf) (on /dev/sdb1)
color light-gray/red red/light-gray
root (hd1,0)
kernel /boot/vmlinuz-2.6.23.1-42.fc8 ro root=/dev/sdb1
initrd /boot/initrd-2.6.23-1-42.fc8.img
savedefault
boot

And that's about it. Have fun prettifying your boot sequence!

  1. 1
  2. 2

Sign In

    Enjoy FOSSwire's content? Have it delivered! Subscribe