The latest kernel is causing problems with my sound, which worked fine with an older version. As I have only Ubuntu installed, Grub is not getting displayed while booting. How can I manually choose my kernel version while booting?


10 Answers 10


The simplest way to display your Grub is to press and hold the SHIFT button while booting.

As an alternative, you can always display Grub without it booting any particular kernel:

gksudo gedit /etc/default/grub

change GRUB_TIMEOUT to -1 and comment out GRUB_HIDDEN_TIMEOUT

finish off by running

sudo update-grub
  • 9
    Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported. I commented GRUB_HIDDEN_TIMEOUT and set GRUB_TIMEOUT=0
    – acidghost
    May 4, 2015 at 10:33
  • 1
    @JonathanHartley GRUB_HIDDEN_TIMEOUT is defined in /etc/default/grub
    – wjandrea
    Aug 8, 2016 at 19:35
  • 3
    SHIFT does not work with UEFI. Try ESC.
    – yujaiyu
    Sep 14, 2021 at 22:34
  • 1
    Mmm, looks like GRUB_HIDDEN_TIMEOUT doesn't seem to exist anymore on 2.04-1ubuntu47. Setting GRUB_TIMEOUT=-1 works fine.
    – vmemmap
    Jan 8, 2022 at 8:07
  • 2
    In Grub 2.04 the setting is called GRUB_TIMEOUT_STYLE=hidden. Commenting it out is enough. Feb 14, 2022 at 15:10

Holding down the Shift key while booting, will display the Grub menu. You can now select an older kernel version.

For selecting an older kernel as the default kernel, please see this post

  • 2
    In my case (Ubuntu 16.04), it was left shift. Right shift didn't work.
    – Bob
    Aug 12, 2016 at 15:04
  • 2
    what if the older kernels are not shown in grub (they were removed)? Does this mean these kernels are not accessible? Dec 7, 2016 at 5:26
  • 2
    I had to use escape (rather than shift) Feb 11, 2019 at 13:40
  • 1
    Shift key does not work
    – Coder Guy
    Jan 8, 2021 at 9:15

If you have a few Kernels in your system you can set manually what Kernel version will start:

  1. Reboot your PC with pressed Shift button for display GRUB after BIOS will start. You will see something like: GRUB start page
  1. Select "Advanced options for Ubuntu" and memorize index of this menu line(count starts from 0) On the picture index is 1

Select concrete Kernel

  1. Select concrete kernel for boot and also memorize index of this menu line(count starts from 0) On the picture index of chosen Kernel is 2

  2. Start system. This action is for one boot on concrete kernel. If you want to start from concrete Kernel all time you should do next steps:

4.1. Open and edit GRUB setup file:

sudo nano /etc/default/grub

4.2. Find line GRUB_DEFAULT=... (by default GRUB_DEFAULT=0) and sets in quotes menu path to concrete Kernel (Remember menu indexes from steps 2 and 3). In my system first index was 1 and second was 2. I set in to GRUB_DEFAULT


Save file.

4.3. Update GRUB information for apply changes:

sudo update-grub

4.4. After reboot you automatically boot on Kernel by chosen menu path. An example on my machine 1 -> 2

4.5. Check Kernel version after reboot:

uname -r
  • I first used GRUB_DEFAULT="Advanced options for Ubuntu > Ubuntu, with Linux x.x.x-xx-generic" but that didn't work... Your version with GRUB_DEFAULT="1>2" did work! :) Mar 22, 2022 at 16:39
  • How to get more items in GRUB menu? What if I want the last four kernels? System is currently broken on last two now.
    – mathtick
    Nov 3, 2023 at 13:19
  • As far as I know all installed kernels should be displayed. Are you sure, another two have been installed or not removed etc?
    – Jackkobec
    Nov 3, 2023 at 16:45

Get the currently installed kernel menu entries using below command.

ubuntu:~$ sudo grub-mkconfig | grep -iE "menuentry 'Ubuntu, with Linux" | awk '{print i++ " : "$1, $2, $3, $4, $5, $6, $7}'

0 : menuentry 'Ubuntu, with Linux 5.4.0-80-generic' --class ubuntu
1 : menuentry 'Ubuntu, with Linux 5.4.0-80-generic (recovery mode)'
2 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic' --class ubuntu
3 : menuentry 'Ubuntu, with Linux 4.15.0-159-generic (recovery mode)'
4 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic' --class ubuntu
5 : menuentry 'Ubuntu, with Linux 4.15.0-45-generic (recovery mode)'

Modify the GRUB_DEFAULT=0 value as per your need.

currently my server booted with 5.4.0-80-generic

ubuntu:~# uname -srn
Linux ubuntu 5.4.0-80-generic

so i want to boot my system with 4.15.0-45-generic which is menu entry 4

modified GRUB_DEFAULT="1>4" value in /etc/default/grub executed below command to regenerate a grub config file with modified GRUB_DEFAULT settings.

Explained "1>4" format here

sudo update-grub

rebooted the ubuntu system.

sudo systemctl reboot

post reboot my ubuntu server booted with old kernel 4.15.0-45-generic

ubuntu:~# uname -srn
Linux ubuntu 4.15.0-45-generic
  • 4
    This is the correct answer. Thank you very much
    – Tom
    Feb 19, 2022 at 15:16
  • So are you saying that you are changing /etc/default/grub by editing the value for GRUB-DEFAULT, changing it from 0 to 1>4?
    – Amanda
    Jul 19, 2023 at 16:16

While booting when GRUB appears with entries select the second entry i.e., Advanced options for Ubuntu there you can see different older kernel versions which was installed previously, you can select one among them which works good for you. Otherwise you go to the grub.cfg and paste your required kernel version on top of currently installed kernel entry. In both ways it works


Please install the previous kernel with the following command:

sudo apt-get install linux-image-3.0.0-12-generic linux-headers-3.0.0-12-generic

Then reboot. You will be prompted to choose your kernel.


16.04 and later

  1. Immediately after the motherboard / computer manufacturer logo splash screen appears when the computer is booting, with BIOS, quickly press and hold the Shift key, which will bring up the GNU GRUB menu. (If you see the Ubuntu logo, you've missed the point where you can enter the GRUB menu.) With UEFI press (perhaps several times) the Esc key to get to the GRUB menu. Sometimes the manufacturer's splash screen is a part of the Windows bootloader, so when you power up the machine it goes straight to the GRUB screen, and then pressing Shift is unnecessary.

  2. From the GRUB screen select Advanced options for Ubuntu and press Enter.

enter image description here

  1. A new purple screen will appear showing a list of kernels. Use the ↑ and ↓ keys to select which entry is highlighted. Press Enter to boot the selected kernel, 'e' to edit commands before booting or 'c' for a command line. Press Esc to return to the previous menu.

enter image description here

Prevent Ubuntu from uninstalling an old kernel version

If you have determined that you can successfully boot Ubuntu by using an older kernel version, the next thing to do is to prevent Ubuntu from automatically uninstalling that kernel version by following the instructions in this answer. If you want autoremove to not remove a specific kernel version package, you can mark it as installed manually with a command of the form sudo apt-mark manual package-name. For more information about which Linux kernel packages to mark as manually installed please read the linked answer.


By the https://help.ubuntu.com/community/Grub2:


This setting determines how long a screen without the GRUB 2 menu will be displayed. While the screen is blank, the user can press any key to display the menu.

The default behavior is to hide the menu if only one operating system is present. If a user with only Ubuntu wishes to display the menu, place a # symbol at the start of this line to disable the hidden menu feature.

Downgrade Kernel: How to downgrade the Kernel on 11.10

Upgrade kernel: How can I upgrade kernel to 3.1?


Jackkobec's Answer describes a method of viewing grub.cfg and scrolling through source code to find a menu number. An easier way is with this script:

Grub Version: 2.02~beta2-36ubuntu3.22

         ┌───────────┤ Use arrow, page, home & end keys. Tab toggle option ├────────────┐
         │ Menu No.     ----------- Menu Name -----------                               │ 
         │                                                                              │ 
         │  1>3  Ubuntu, with Linux 4.15.0-55-generic                                  ↑│ 
         │  1>6  Ubuntu, with Linux 4.15.0-54-generic                                  ▒│ 
         │  1>9  Ubuntu, with Linux 4.14.134-0414134-generic                           ▒│ 
         │  1>12 Ubuntu, with Linux 4.14.120-0414120-generic                           ▮│ 
         │  1>15 Ubuntu, with Linux 4.14.114-0414114-generic                           ▒│ 
         │  1>18 Ubuntu, with Linux 4.14.110-0414110-generic                           ▒│ 
         │  1>21 Ubuntu, with Linux 4.14.98-041498-generic                             ▒│ 
         │  1>24 Ubuntu, with Linux 4.14.89-041489-generic                             ▒│ 
         │  1>27 Ubuntu, with Linux 4.14.78-041478-generic                             ▒│ 
         │  1>30 Ubuntu, with Linux 4.14.70-041470-generic                             ▒│ 
         │  1>33 Ubuntu, with Linux 4.4.0-157-generic                                  ▒│ 
         │  1>36 Ubuntu, with Linux 3.16.60-031660-generic                             ▒│ 
         │  1>36 Ubuntu, with Linux 3.16.60-031660-generic                             ▒│ 
         │  2    Ubuntu 18.04.1 LTS (18.04) (on /dev/nvme0n1p10)                       ▒│ 
         │  3    Advanced options for Ubuntu 18.04.1 LTS (18.04) (on /dev/nvme0n1p10)  ▒│ 
         │  3>0  Ubuntu (on /dev/nvme0n1p10)                                           ↓│ 
         │                                                                              │ 
         │                                                                              │ 
         │                     [Display Grub Boot]            Exit                      │ 
         │                                                                              │ 

Note: In this example grub-menu.sh short was used to call the script. The short parameter suppresses these lines:

     │  1>10 Ubuntu, with Linux 4.14.134-0414134-generic (upstart)                 ▒│ 
     │  1>11 Ubuntu, with Linux 4.14.134-0414134-generic (recovery mode)           ▒│ 

Control keys

After scrolling through entries (you can use the mouse scroll wheel or arrow keys) press Escape to return to the command line.

If you press Enter the associate grub commands for the entry are displayed:

menuentry 'Ubuntu, with Linux 4.14.134-0414134-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.14.134-0414134-generic-advanced-b40b3925-70ef-447f-923e-1b05467c00e7' {
gfxmode $linux_gfx_mode
insmod gzio
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_gpt
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root b40b3925-70ef-447f-923e-1b05467c00e7
search --no-floppy --fs-uuid --set=root b40b3925-70ef-447f-923e-1b05467c00e7
echo 'Loading Linux 4.14.134-0414134-generic ...'
linux /boot/vmlinuz-4.14.134-0414134-generic root=UUID=b40b3925-70ef-447f-923e-1b05467c00e7 ro noplymouth fastboot acpiphp.disable=1 pcie_aspm=force vt.handoff=7 i915.fastboot=1 nopti nospectre_v2 nospec mem_sleep_default=deep
echo 'Loading initial ramdisk ...'
initrd /boot/initrd.img-4.14.134-0414134-generic
Press <Enter> to continue

Updating grub to boot previous kernel

A set of grub commands exist for each menu entry. The compiled entries are all stored in /boot/grub/grub.cfg file.

In this example we want menu number `1>9> set as the default so we use:

sudo -H gedit /etc/default/grub

and find this line:


and change it to this:


Then save the file and run

sudo update-grub

Reboot into a specific kernel, which version number and type could be get from ls /boot | grep vmlinuz command execution.

Create the script with the next content: $ vim.tiny kernboot.sh

    kernlist="$(grep -i "menuentry '" /boot/grub/grub.cfg|sed -r "s|--class .*$||g")"
    printf "%s$kernlist\n" | logger
    menuline="$(printf "%s$kernlist\n"|grep -ne $kernel | grep -v recovery | cut -f1 -d":")"
    grub-reboot "1>$menunum"
    echo "The next grub's menu entry will be choosen after the reboot:\n 1>$menunum" | logger


Add execution permissions to the script and run it:

$ chmod +x kernboot.sh
$ sudo ./kernboot.sh

The script could be placed to cron by sudo crontab -e and @reboot /path/to/script

I tried it on 19.10 and 20.04 and it works as expected. This script, but without reboot command could be even placed into root's cron with sudo crontab -e: @reboot /pathto/kernboot.sh and as a result, in case of the next boot the OS will be booted with kernel specified in the script.

  • Worked for me as well on Ubuntu20.04
    – Ryan w
    Sep 27, 2022 at 13:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .