{"id":580,"date":"2009-11-28T12:11:59","date_gmt":"2009-11-28T03:11:59","guid":{"rendered":"http:\/\/www.joewein.net\/blog\/?p=580"},"modified":"2010-04-16T08:25:45","modified_gmt":"2010-04-15T23:25:45","slug":"fix-windows-as-default-boot-on-ubuntu-9-10-with-grub2-loader","status":"publish","type":"post","link":"https:\/\/joewein.net\/blog\/2009\/11\/28\/fix-windows-as-default-boot-on-ubuntu-9-10-with-grub2-loader\/","title":{"rendered":"Fix Windows as default boot on Ubuntu with Grub2 loader"},"content":{"rendered":"<p>If you install Ubuntu on a machine that came with Windows pre-installed you have the choice of preserving Windows and chose each time you boot which operating system to run. By default, the boot menu will list the current Linux kernel, followed by any older Linux kernel versions, followed by a memory test and finally the original Windows version. By changing a GRUB boot loader configuration file you can chose which one is the default that gets booted when you just wait and don&#8217;t touch the keyboard. <\/p>\n<p><em>(NOTE: The following instructions assume the Grub2 loader used in Ubuntu 9.10 &#8211; earlier versions are different)<\/em><\/p>\n<p>For example, the menu might look like this:<\/p>\n<blockquote><p>Ubuntu, Linux 2.6.31-14-generic<br \/>\nUbuntu, Linux 2.6.31-14-generic (recovery mode)<br \/>\nmemory test (memtest86+)<br \/>\nmemory test (memtest86+, serial console 115200)<br \/>\nWindows Vista (loader) (on \/dev\/sda1)\n<\/p><\/blockquote>\n<p>You can configure Linux to &#8212; unless you tell it otherwise &#8212; always boot Vista by setting GRUB_DEFAULT in \/etc\/default\/grub to the number of lines above the entry you want to boot (4 in this case), instead of 0 (zero) for the top entry. After any change to \/etc\/default\/grub you need to also run sudo update-grub:<\/p>\n<blockquote><p>joe@ubuntu910:~$ gksudo gedit \/etc\/default\/grub<br \/>\n&#8230;<br \/>\nGRUB_DEFAULT=4<br \/>\n&#8230;<br \/>\njoe@ubuntu910:~$ sudo update-grub\n<\/p><\/blockquote>\n<p>The problem with that is, when the next kernel update comes out, two lines will be inserted at the top and your default value now selects the wrong entry:<\/p>\n<blockquote><p>Ubuntu, Linux 2.6.31-15-generic<br \/>\nUbuntu, Linux 2.6.31-15-generic (recovery mode)<br \/>\nUbuntu, Linux 2.6.31-14-generic<br \/>\nUbuntu, Linux 2.6.31-14-generic (recovery mode)<br \/>\nmemory test (memtest86+)<br \/>\nmemory test (memtest86+, serial console 115200)<br \/>\nWindows Vista (loader) (on \/dev\/sda1)\n<\/p><\/blockquote>\n<p>You would need to manually select the latest kernel and repeat the above steps with a new value of 6 in this case. This is clearly a problem. Fortunately, there&#8217;s a simple workaround: use a name instead of a number for selecting the default. Here is how it works:<\/p>\n<p>1) List the bootable operating systems:<\/p>\n<blockquote><p>joe@ubuntu910:~$ fgrep menuentry \/boot\/grub\/grub.cfg<br \/>\nmenuentry &#8220;Ubuntu, Linux 2.6.31-15-generic&#8221; {<br \/>\nmenuentry &#8220;Ubuntu, Linux 2.6.31-15-generic (recovery mode)&#8221; {<br \/>\nmenuentry &#8220;Ubuntu, Linux 2.6.31-14-generic&#8221; {<br \/>\nmenuentry &#8220;Ubuntu, Linux 2.6.31-14-generic (recovery mode)&#8221; {<br \/>\nmenuentry &#8220;Memory test (memtest86+)&#8221; {<br \/>\nmenuentry &#8220;Memory test (memtest86+, serial console 115200)&#8221; {<br \/>\nmenuentry &#8220;Windows Vista (loader) (on \/dev\/sda1)&#8221; {\n<\/p><\/blockquote>\n<p>2) Mark and copy the entry you want to stay bootable, including double quotes, for example <code>\"Windows Vista (loader) (on \/dev\/sda1)\"<\/code>.<\/p>\n<p>3) Edit the Grub configuration and paste the new value after the GRUB_DEFAULT= (in place of 0 or 4 or whatever number):<\/p>\n<blockquote><p>joe@ubuntu910:~$ gksudo gedit \/etc\/default\/grub<br \/>\nGRUB_DEFAULT=&#8221;Windows Vista (loader) (on \/dev\/sda1)&#8221;<br \/>\njoe@ubuntu910:~$ sudo update-grub\n<\/p><\/blockquote>\n<p>Note: Make sure to close the <code>gedit<\/code> window before doing <code>sudo update-grub<\/code><\/p>\n<p>That&#8217;s it, no more Grub configuration tinkering required! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you install Ubuntu on a machine that came with Windows pre-installed you have the choice of preserving Windows and chose each time you boot which operating system to run. By default, the boot menu will list the current Linux &hellip; <a href=\"https:\/\/joewein.net\/blog\/2009\/11\/28\/fix-windows-as-default-boot-on-ubuntu-9-10-with-grub2-loader\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16,14,24,23],"tags":[],"class_list":["post-580","post","type-post","status-publish","format-standard","hentry","category-linux","category-software","category-windows-vista","category-windows-xp"],"_links":{"self":[{"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/posts\/580","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/comments?post=580"}],"version-history":[{"count":11,"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/posts\/580\/revisions"}],"predecessor-version":[{"id":702,"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/posts\/580\/revisions\/702"}],"wp:attachment":[{"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/media?parent=580"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/categories?post=580"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/joewein.net\/blog\/wp-json\/wp\/v2\/tags?post=580"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}