Skip to main content

Make Grub2 Boot the Last Operating System You Used

system configuration boot
Table of Contents

The GRUB2 boot loader can seem confusing at first. Instead of one configuration file, there are several. You run one command update-grub to update the configuration file, another command (grub-install) to write the configuration to the Master Boot Record (MBR) on your hard drive.

On the plus side, GRUB2 can make life much easier if you’re running a dual or multiple boot system – say, switching between Linux and Windows, or hopping between multiple distros. update-grub scans your partitions, automatically detects operating systems, and adds them to the configuration. Yet, the choice of which OS to boot by default remains stupid: in Ubuntu 10.04, the menu highlights the first operating system listed (usually the latest kernel installed by Synaptic or Update Manager). If you don’t select another one within 10 seconds, the Ubuntu OS will boot with that kernel. I think most users want a “sticky” menu selection that boots the very last OS they chose. If you were running Windows XP last night, that’s probably what you want to boot this morning.

It’s very easy to make GRUB2 remember your last OS choice. First, edit the file /etc/default/grub.cfg. Change the GRUB_DEFAULT line and add a new line, GRUB_SAVEDEFAULT:

#GRUB_DEFAULT=0
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

Then run the two usual commands to update the configuration file /boot/grub/grub.cfg and write it to the MBR:

sudo update-grub
sudo grub-install /dev/sda1

Resources
#

Related

VNC Remote Desktop Connection Nvidia Display Problem
system configuration remote hardware
Ubuntu lets you share your desktop with remote computers.
Make Flash Video Run Smoothly With Ondemand CPU Frequency Scaling
system configuration video flash hardware
Watching streaming video in Linux can be frustrating.
Firefly: A Music Server For Mixed Marriages
multimedia audio music
For sharing your family’s music collection, it’s hard to beat the simplicity of the Firefly music server.