{"id":47717,"date":"2024-12-12T13:34:31","date_gmt":"2024-12-12T13:34:31","guid":{"rendered":"https:\/\/ubuntuhandbook.org\/?p=47717"},"modified":"2026-02-27T08:33:31","modified_gmt":"2026-02-27T08:33:31","slug":"os-kernel-boot-default-ubuntu-linux","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2024\/12\/os-kernel-boot-default-ubuntu-linux\/","title":{"rendered":"Configure which OS or kernel to Boot by Default in Ubuntu 24.04"},"content":{"rendered":"<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/11\/gpu-grub-logo.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-43363\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/11\/gpu-grub-logo-250x250.webp\" alt=\"\" width=\"250\" height=\"250\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/11\/gpu-grub-logo-250x250.webp 250w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/11\/gpu-grub-logo-300x300.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/11\/gpu-grub-logo-600x600.webp 600w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/11\/gpu-grub-logo-768x768.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2022\/11\/gpu-grub-logo.webp 1200w\" sizes=\"auto, (max-width: 250px) 100vw, 250px\" \/><\/a><\/p>\n<p>This is a step by step beginner&#8217;s tutorial shows how to set the default OS or kernel entry in Grub boot-menu in Ubuntu, Linux Mint, Debian or other Linux.<\/p>\n<p>Most Linux today uses <a href=\"https:\/\/www.gnu.org\/software\/grub\/\" target=\"_blank\" rel=\"noopener\">Grub2<\/a> to provide a menu on start-up, allowing to choose which operating system, which kernel, or recovery mode to boot.<\/p>\n<p>It by default boots the first entry, while user can configure to automatically boot another menu entries without user interaction. And, here&#8217;s how to do the trick in 2 ways: <b>from command line<\/b> or <b>use a graphical tool<\/b>.<\/p>\n<p><!--more--><\/p>\n<div id=\"attachment_47719\" style=\"width: 620px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub2-bootentries.webp\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-47719\" class=\"size-large wp-image-47719\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub2-bootentries-700x523.webp\" alt=\"\" width=\"610\" height=\"456\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub2-bootentries-700x523.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub2-bootentries-300x224.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub2-bootentries-768x574.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub2-bootentries.webp 794w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><p id=\"caption-attachment-47719\" class=\"wp-caption-text\">my Grub2 boot menu<\/p><\/div>\n<p><b>NOTE: You need to boot into the first entry (or Advanced options for the first), that handles the boot menu, then follow this tutorial. Or, set current OS&#8217;s boot menu as default in BIOS.<\/b><\/p>\n<h3>Option 1: Use command tool or edit Grub configuration file<\/h3>\n<p>The grub configuration tool has an option to set the default boot entry, and, there&#8217;s a command line tool <code>grub-set-default<\/code> allowing to change the default at any time as easy as a single command.<\/p>\n<p><b>1. Count your boot menu entries.<\/b><\/p>\n<p>Without remembering the full tiles of all the boot entries, you may count them and use the number instead to set which to boot as default.<\/p>\n<p><b>To preview the menu<\/b>, press <code>Ctrl+Alt+T<\/code> to open terminal window, then run commands below to install <code>grub-emu<\/code> tool and use it the simulate the boot menu:<\/p>\n<ul>\n<li>First, run command to install grub-emu:\n<pre>sudo apt install grub-emu<\/pre>\n<\/li>\n<li>Then, run grub-emu to start a window with system boot menu:\n<pre>sudo grub-emu<\/pre>\n<\/li>\n<\/ul>\n<p><b>NOTE: The simulated menu MAY not interactable. If you want to preview the sub-menu options, then try restart your computer and go to &#8220;Advanced options for &#8230;&#8221;.<\/b><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-emu-screen.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47720\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-emu-screen-700x409.webp\" alt=\"\" width=\"610\" height=\"356\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-emu-screen-700x409.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-emu-screen-300x175.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-emu-screen-768x449.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-emu-screen.webp 1077w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p>As you see in the screenshot above, <b>count starts from number 0<\/b>. The first entry is <b>0<\/b>, the second is <b>1<\/b>, and the third entry is <b>2<\/b> &#8230;<\/p>\n<p>If you want to set a sub-menu entries to boot another kernel as default, for example the <b>second<\/b> main menu option (Advanced options for Ubuntu in my case, count number 1) and <b>third<\/b> sub-menu entries (e.g., Ubuntu with Linux Kernel 6.x.x&#8230;, count number 2), then the target number is <b>1&gt;2<\/b>.<\/p>\n<p><b>2. Edit configuration file for default OS\/Kernel<\/b><\/p>\n<p>Next, open terminal (Ctrl+Alt+T) and run command to edit the grub configuration file:<\/p>\n<pre>sudo nano \/etc\/default\/grub<\/pre>\n<p>Here I use the universal <code>nano<\/code> command line text editor that works in most Linux. You may replace it with <code>gnome-text-editor<\/code> for Ubuntu with default GNOME Desktop, or other text editor according to your DE.<\/p>\n<p>And, when file opens, set <b>GRUB_DEFAULT=&#8221;0&#8243;<\/b> by replacing number <b>0<\/b> (meaning the first) with the corresponding number you got in last step.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-configdefault.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47721\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-configdefault-700x505.webp\" alt=\"\" width=\"610\" height=\"440\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-configdefault-700x505.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-configdefault-300x216.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-configdefault.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>Tips: you may set <code>GRUB_DEFAULT=saved<\/code> plus new line <code>GRUB_SAVEDEFAULT=true<\/code>, so it remembers and boots the last boot entry automatically.<\/b><\/p>\n<p>Finally, press <code>Ctrl+S<\/code> to save file and <b>Ctrl+X<\/b> to exit. And,\u00a0run the command below to <b>update changes<\/b>.<\/p>\n<pre>sudo update-grub<\/pre>\n<p>NOTE: for Fedora you may run <code>grub2-mkconfig -o \/boot\/grub2\/grub.cfg<\/code> instead to update grub configuration changes.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/update-grub-noble.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47722\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/update-grub-noble-700x505.webp\" alt=\"\" width=\"610\" height=\"440\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/update-grub-noble-700x505.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/update-grub-noble-300x216.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/update-grub-noble.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<p><b>3. Set default boot entry via grub-set-default command<\/b><\/p>\n<p>Without editing the file again and again, you may use the built-in <code>grub-set-default<\/code> command to do the job at any time.<\/p>\n<p>First, you need set <b>GRUB_DEFAULT=saved<\/b> and <b>GRUB_SAVEDEFAULT=true<\/b> (skip if this line does not exist) in Grub configuration file and update grub.<\/p>\n<p>Then, run the command line tool at any time to set default boot OS. For example, set 4th menu entry as default:<\/p>\n<pre>sudo grub-set-default 3<\/pre>\n<p><i>Replace number 3 in command according to which menu entry you want to set as default<\/i>.<\/p>\n<p><b>Tips 1: Without reboot, you may run <code>sudo grub-emu<\/code> afterward to simulate boot menu and see which entry is selected by default.<\/b><\/p>\n<p><b>Tips 2: By replacing <code>grub-set-default<\/code> command with <code>grub-reboot<\/code>, it can immediately reboot your computer with the specified entry selected by default, though for next boot only.<\/b><\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-setdefault.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47723\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-setdefault-700x285.webp\" alt=\"\" width=\"610\" height=\"248\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-setdefault-700x285.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-setdefault-300x122.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grub-setdefault.webp 706w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>\n<h3>Option 2: Use graphical tool<\/h3>\n<p>For those who don&#8217;t like Linux commands, there&#8217;s a popular free open-source tool <a href=\"https:\/\/launchpad.net\/grub-customizer\" target=\"_blank\" rel=\"noopener\">Grub Customizer<\/a> that provides graphical options to do the job.<\/p>\n<p>Many Linux (e.g.,\u00a0 Arch, Debian, Fedora, and RHEL 9) include Grub Customizer in their system repositories. However, Ubuntu since 22.04 dropped it from system repository due to poor scripting issue (though fixed now).<\/p>\n<p><b>To install Grub Customizer in Ubuntu<\/b>, open terminal (Ctrl+Alt+T) and run the commands below one by one to get it from <a href=\"https:\/\/launchpad.net\/~danielrichter2007\/+archive\/ubuntu\/grub-customizer\" target=\"_blank\" rel=\"noopener\">developer&#8217;s PPA<\/a>.<\/p>\n<pre>sudo add-apt-repository ppa:danielrichter2007\/grub-customizer<\/pre>\n<pre>sudo apt-get update<\/pre>\n<pre>sudo apt-get install grub-customizer<\/pre>\n<p>Then, launch the tool and navigate to &#8220;General Settings&#8221; tab. Next, either choose a pre-defined entry or previously booted entry as default. Finally, click on &#8220;Save&#8221; button to apply changes.<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grubcustomizer-defaultos.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-large wp-image-47724\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grubcustomizer-defaultos-700x502.webp\" alt=\"\" width=\"610\" height=\"437\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grubcustomizer-defaultos-700x502.webp 700w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grubcustomizer-defaultos-300x215.webp 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grubcustomizer-defaultos-768x551.webp 768w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2024\/12\/grubcustomizer-defaultos.webp 928w\" sizes=\"auto, (max-width: 610px) 100vw, 610px\" \/><\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>This is a step by step beginner&#8217;s tutorial shows how to set the default OS or kernel entry in Grub boot-menu in Ubuntu, Linux Mint, Debian or other Linux. Most Linux today uses Grub2 to provide a menu on start-up, allowing to choose which operating system, which kernel, or recovery mode to boot. It by [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":43363,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[1901,2034,160],"class_list":["post-47717","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howtos","tag-boot-order","tag-grub","tag-kernel"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/47717","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=47717"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/47717\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media\/43363"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=47717"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=47717"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=47717"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}