How to dowgrade linux(ubuntu) kernel to previous version

Recently we are bitten by the OOM bug in the ubuntu kernel version 4.4.0-59-generic. The fix will be released in updates channel tentatively on Feb 20 2017. We can’t wait till that time. So  We decided to roll back to the previous kernel version 4.4.0-57-generic.

To install the previous version

sudo apt-get install linux-image-4.4.0-57-generic linux-headers-4.4.0-57-generic

Now we need to select the installed kernel as default kernel to boot in the grub.

Finding out the offset of out kenel menu entry in /boot/grub/grub.cfg

 cat /boot/grub/grub.cfg  | grep "menuentry"

The output would be

 

if [ x”${feature_menuentry_id}” = xy ]; then
menuentry_id_option=”–id”
menuentry_id_option=””
export menuentry_id_option
menuentry ‘Ubuntu’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-simple-cfda0544-9803-41e7-badb-43563085ff3a’ {
submenu ‘Advanced options for Ubuntu’ $menuentry_id_option ‘gnulinux-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {

menuentry ‘Ubuntu, with Linux 4.4.0-59-generic‘ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-59-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-59-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-59-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-57-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-57-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-57-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-57-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-53-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-53-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-53-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-53-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-51-generic’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-51-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-51-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-51-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-45-generic’ –-class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-45-generic-advanced-cfda0544-9803-41e7-badb-43563085ff3a’ {
menuentry ‘Ubuntu, with Linux 4.4.0-45-generic (recovery mode)’ –class ubuntu –class gnu-linux –class gnu –class os $menuentry_id_option ‘gnulinux-4.4.0-45-generic-recovery-cfda0544-9803-41e7-badb-43563085ff3a’ {

 

The boot kernel we want to select is menuentry ‘Ubuntu, with Linux 4.4.0-57-generic’ which is submenu of Advanced options for Ubuntu.

Now change GRUB_DEFAULT=0 in  /etc/default/grub to GRUB_DEFAULT=”Advanced options for Ubuntu>Ubuntu, with Linux 4.4.0-57-generic” and execute update-grub & reboot the machine.

After the machine comes up  check the kernel version using the command uname -r 

 

Advertisements

About hack4geek

The quieter you become the more you are able to hear
This entry was posted in kernel, Linux, system administration. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s