0

1. Problem summary I have an instance on AWS running Ubuntu 18.04. The kernel version is 5.4.0. I have installed kernel 4.15.0 but I am failing to set it as the default.

2. What I have tried

A) I set the following values in /etc/default/grub

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
GRUB_DISABLE_SUBMENU=y

and made sure there is no value for GRUB_DEFAULT in /etc/default/grub.d/50-cloudimg-settings.cfg

Created an environment variable for GRUB_CONFIG using

export GRUB_CONFIG=`sudo find /boot -name "grub.cfg"

I rebuilt grub.cfg using sudo update-grub and rebooted the instances, but no change in the active kernel observed from running uname -r.

B) I also tried the solution of deleting the kernel that I no longer want described [here] (https://stackoverflow.com/questions/25993363/how-to-remove-a-newly-installed-kernel) but the instance then fails status checks and I cannot connect to it using SSH.

C) I set the value for GRUB_DEFAULT to the menu_string as GRUB_DEFAULT="gnulinux-advanced-0d5e1897-19aa-4121-b1f8-2c7e0f833c4d>gnulinux-4.15.0-20-generic-advanced-0d5e1897-19aa-4121-b1f8-2c7e0f833c4d", rebuilt grub.cfg using sudo update-grub, but still no change after rebooting.

1 Answer 1

3

Open the terminal and write:

uname -r

This is your kernel version before starting. Now, let's change it!

Write in the terminal:

grub-install --version

Remember the GRUB version it's saying. Now open the file:

vi /boot/grub/grub.cfg 

Check what is the version you want, and take its name. For example:

    menuentry 'Ubuntu, with Linux 4.15.0-188-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-188-generic-advanced-7e6f0fb2-8fc4-4e31-92ef-912be559e099' {
            recordfail
            load_video

if the GRUB version you had is < 2.00 the name is:

Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-188-generic

otherwise is:

gnulinux-advanced-7e6f0fb2-8fc4-4e31-92ef-912be559e099>gnulinux-4.15.0-188-generic-advanced-7e6f0fb2-8fc4-4e31-92ef-912be559e099

Now, in the terminal:

sudo vi /etc/default/grub

Press key "i" in the keyboard to modify the file. Go to the line where it says GRUB_DEFAULT and paste the previous name. It should be for grub >2 (instead of GRUB_DEFAULT=0):

GRUB_DEFAULT="gnulinux-4.15.0-188-generic-advanced-7e6f0fb2-8fc4-4e31-92ef-912be559e099>gnulinux-4.15.0-188-generic-advanced-7e6f0fb2-8fc4-4e31-92ef-912be559e099"

Press key "Esc" in the keyboard. Write :wq and press enter. File has been saved. Now redo the grub. If you put it wrongly it will tell you how it should be!

sudo update-grub

Now reboot:

sudo reboot

Check your kernel version!

uname -r

I only did this, and worked for me. It's an EC2 with Ubuntu 18.04 and kernel 5.4.

You must log in to answer this question.

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