CQuirke’s Long View

Long lead times need long forward planning

Ubuntu: Editing grub’s menu.lst

Posted by cquirke on 5 October 2007

Technorati tags: , ,

If you’ve just set up a dual-boot between Windows and Ubuntu (in this case, 7.04) to try out the latter, then you will probably want to edit the settings file that controls the grub system-level boot manager.  You may want Windows to boot by default, and more menu time to override that default.

As seen from Ubuntu, the file you are after is in the /boot/grub directory, and is called menu.lst (where “l” is lower-case L, not the digit 1).  But because this is outside your home subtree, you will need root privileges to edit it. 

I didn’t find a way to do this in the GUI (e.g. an equivalent to Vista’s right-click, “Run as administrator”) so I pressed Ctl+Alt+F1 to get to a bash shell (a Linux equivalent to Command.com or Cmd.exe).  From here it is easy; precede any command needing root access with the sudo command, and after passing a root password prompt, that works.

After logging in to my user account, I entered the following commands to get to where the file was, list it to see what permissions were in effect, then change these to facilitate my changes:

cd /boot/grub

ls -g

sudo chmod 0777 menu.lst

ls -g

This took the safety catch off menu.lst so I could save changes to it.  Then I used vi to edit the file, changing the order of boot entries so that Windows came first (I could have left it where it was and specified it by number as the new default), and then changing the timeout statement to “timeout sec    20” for 20 seconds (the word “sec” is required). 

I’ll leave the gory details of editing in vi as an exercise for the reader, but basically it’s a to add text, Esc to go back to command mode, and :wq to save and exit.

Thereafter I restored safer attribute flags via this command…

sudo chmod 0644 menu.lst

…pressed Ctl+Alt+F7 to switch back to the GUI, and was done.  Whew!

Advertisements

One Response to “Ubuntu: Editing grub’s menu.lst”

  1. Cenk Kulacoglu said

    didn’t find a way to do this in the GUI (e.g. an equivalent to Vista’s right-click, “Run as administrator”) so I pressed Ctl+Alt+F1 to get to a bash shell (a Linux equivalent to Command.com or Cmd.exe).

    I wondered why you did not just open a Terminal under GUI but get out of the GUI environment? It is like opening a command prompt under Windows.

    Cheers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: