How to Change the Default Ubuntu Kernel(ubuntu jammy example)

In this post we change(minor downgrade) default boot kernel from 5.15.0-47-generic – >5.15.0-46-generic

Install the Generic Kernel (if neccesary. ubuntu jammy example below )

sudo apt-get update
sudo  apt install -y linux-image-5.15.0-46-generic

Backup First

sudo cp /etc/default/grub /etc/default/grub.bak

Show Loaded Kernel

uname -r

Show Availalbe options

grep -A100 submenu  /boot/grub/grub.cfg |grep menuentry

output

submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942' {
    menuentry 'Ubuntu, with Linux 5.15.0-47-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-47-generic-advanced-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942' {
    menuentry 'Ubuntu, with Linux 5.15.0-47-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-47-generic-recovery-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942' {
    menuentry 'Ubuntu, with Linux 5.15.0-46-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-46-generic-advanced-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942' {
    menuentry 'Ubuntu, with Linux 5.15.0-46-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-46-generic-recovery-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942' {
    menuentry 'Ubuntu, with Linux 5.15.0-25-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.15.0-25-generic-advanced-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942' {

Create the default menu entry

find the ids of parent and child menu entries. For example, menu entry id for Advanced options for Ubuntu is gnulinux-advanced-4a67ec61-9cd5-4a26-b00f-9391a34c8a29

menu entry for Ubuntu, with Linux 5.15.0-46-generic is gnulinux-5.15.0-46-generic-advanced-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942

Concat those two strings with >. Result would be like

"gnulinux-advanced-4a67ec61-9cd5-4a26-b00f-9391a34c8a29>gnulinux-5.15.0-46-generic-advanced-4a67ec61-9cd5-4a26-b00f-9391a34c8a29"

Edit Grub

vim /etc/default/grub

and replace GRUB_DEFAULT with above value (With Quotes)

File would look like

GRUB_DEFAULT="gnulinux-advanced-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942>gnulinux-5.15.0-46-generic-advanced-3f11ae79-8ac4-4cc8-aaf5-a87ac00c2942"
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0"
GRUB_CMDLINE_LINUX=""

Update and Reboot

sudo update-grub
sudo reboot

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *

 

Этот сайт использует Akismet для борьбы со спамом. Узнайте, как обрабатываются ваши данные комментариев.