55

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?

58

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
  • 5
    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 '15 at 10:33
  • Just to be explicit: GRUB_HIDDEN_TIMEOUT is an environment variable that needs to be set when running 'update-grub' ? – Jonathan Hartley Apr 28 '16 at 10:47
  • 1
    @JonathanHartley GRUB_HIDDEN_TIMEOUT is defined in /etc/default/grub – wjandrea Aug 8 '16 at 19:35
20

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 '16 at 15:04
  • 1
    what if the older kernels are not shown in grub (they were removed)? Does this mean these kernels are not accessible? – Kalamalka Kid Dec 7 '16 at 5:26
  • 1
    I had to use escape (rather than shift) – Jonathan King Feb 11 at 13:40
5

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

3

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

  2. 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

GRUB_DEFAULT="1>2"

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

2

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

GRUB_HIDDEN_TIMEOUT=0

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?

1

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.

1
  1. Immediately after the BIOS/UEFI splash screen during boot, 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

  3. 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

0

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' {
recordfail
savedefault
load_video
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
else
search --no-floppy --fs-uuid --set=root b40b3925-70ef-447f-923e-1b05467c00e7
fi
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:

GRUB_DEFAULT=0

and change it to this:

GRUB_DEFAULT="1>9"

Then save the file and run

sudo update-grub

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.