Changing boot order in Ubuntu 13.04 (or Debian) – the easy way

I wanted nice, concise instructions on changing the boot order in Ubuntu 13.04, which uses Grub 2. Being a newbie focused OS however, Googling “ubuntu boot order” results in SEO blogs with lots of fluff, and then the actual instructions start out with “install package from ppa”…

What the hell, I just want to change the boot order!

You could just edit /etc/default/grub, change the GRUB_DEFAULT variable, run update-grub and you’re away, but you’ll note that by default this is set to “saved”. Debian provides a set of shell scripts for managing grub configurations, and it makes sense to take advantage of them, so I would suggest leaving this alone and doing the following:
[shell]grub-set-default ‘<menu item string>'[/shell]

E.g.
[shell]
root@al-core:/etc/grub.d# grub-set-default ‘Windows 7 (loader) (on /dev/sda1)’
[/shell]

After this run update-grub.

If you can’t remember the menu item string (understandable) you can dump a list like so:
[shell]
root@al-core:~# grep “menuentry ‘” /boot/grub/grub.cfg
menuentry ‘Ubuntu’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-simple-9fcdf8fb-6194-4694-ac21-9d122afe4676’ {
menuentry ‘Ubuntu, with Linux 3.8.0-25-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.8.0-25-generic-advanced-9fcdf8fb-6194-4694-ac21-9d122afe4676’ {
menuentry ‘Ubuntu, with Linux 3.8.0-25-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.8.0-25-generic-recovery-9fcdf8fb-6194-4694-ac21-9d122afe4676’ {
menuentry ‘Ubuntu, with Linux 3.8.0-23-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.8.0-23-generic-advanced-9fcdf8fb-6194-4694-ac21-9d122afe4676’ {
menuentry ‘Ubuntu, with Linux 3.8.0-23-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-3.8.0-23-generic-recovery-9fcdf8fb-6194-4694-ac21-9d122afe4676’ {
menuentry ‘Windows 7 (loader) (on /dev/sda1)’ –class windows –class os $menuentry_id_option ‘osprober-chain-54CAE1FFCAE1DD6C’ {
[/shell]

Look for the string encapsulated in single quotes after “menuentry”.

Yes I know I’m blasphemous for setting Windows as default, but this is my Windows desktop for Adobe Lightroom… doesn’t spend much time in Ubuntu sadly.

2 thoughts on “Changing boot order in Ubuntu 13.04 (or Debian) – the easy way

  1. Eric

    Very nice! Not sure why it is so hard to find a simple answer to a simple question like this on the internets (mainly, I wanted to figure out what value to use for GRUB_DEFAULT without rebooting and looking at the grub menu!)…

    One thing to note, for some reason, I couldn’t get grub-set-default to work. Didn’t really dig in to see why… but I just ended up setting GRUB_DEFAULT in /etc/default/grub, running grub-update, and all is well.

    Thanks again!

    Reply

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.