4

Running Ubuntu 18.04 LTS I got a notice that an upgrade was needed and I consented. The upgrade updated my kernel from 5.4.0-91-generic to ...-92 and broke things. I can still boot to ...91 from GRUB.

I'm unable to spend any more time trying to resolve the upgrade problem at this time and would like to just uninstall it. However, I realize uninstalling is not the same a reverting and I am reluctant to just uninstall the ...92 upgrade as other things may be lost.

What can I do to remove the ...92 upgrade and get my machine back without damaging the OS?

The machine boots and I can SSH into it.

access123
  • 51
  • 6
  • 1
    Would you mind telling, why did you post the duplicate of your previous post again? – Error404 Jan 07 '22 at 06:16
  • 1
    My reply to @Someone: It was rather late last night and I might have inadvertently posted twice. But I see no duplicate post to remove. What have I missed? – access123 Jan 07 '22 at 17:03
  • I saw your previous question addressing the same problem with the kernel, which IMO is similar to this. But now, let's forget that... You already got 2 answers, so it doesn't matter. I took my downvote back and upvoted :D – Error404 Jan 08 '22 at 06:44
  • Thank you,@Someone and thanks for the insight. I'll try to be more careful in the future – access123 Jan 09 '22 at 03:56
  • No problem :D.... Have you tried the provided answers? – Error404 Jan 09 '22 at 04:02
  • I was researching the grub-customizer and only found it available for 18.04 from a private repository. i wasn't sure which approach and wanted to look at it. But, I'm not much into using private repositories. Hence, I'm now stepping through the answer from nobody. – access123 Jan 09 '22 at 04:53
  • You can install Grub customizer using sudo apt install grub-customiser. My answer also provides a CLI solution. It's your choice both the answers are correct :D BTW there is nothing wrong with that PPA. As its tested and trusted. – Error404 Jan 09 '22 at 04:55
  • I took the non-GUI approach and am back in business. Thanks for your help and up-votes – access123 Jan 09 '22 at 18:34

2 Answers2

4

It is better to do that without a GUI. GRUB is too important for me to trust a program which hides what it is doing exactly behind a GUI.

  1. First, create a backup of the /etc/default/grub file:

    cp /etc/default/grub $HOME
    
  2. Now, open /etc/default/grub with a text editor and add:

    GRUB_DEFAULT=saved
    GRUB_SAVEDEFAULT=true
    
  3. Update GRUB to save the changes:

    sudo update-grub
    
  4. Reboot to your working kernel, so that GRUB can save your choice for the next reboot.

  5. Now, list all the kernel packages:

    dpkg -l | egrep linux-'[g|i|m|h]'
    
  6. Once identified, you can remove any kernel package with 5.4.0-92 in its name (e.g. linux-image-5.4.0-92-generic, linux-headers-5.4.0-92, linux-modules-extra-5.4.0-92-generic, linux-modules-5.4.0-92-generic) via apt remove.

  7. If you want to avoid the problematic kernel coming with a future update, then run:

    sudo apt-mark hold linux-image-generic linux-headers-generic
    

    This will put a hold on the current linux-image-generic package and stop it from being updated.

    You can undo it with:

    sudo apt-mark unhold linux-image-generic linux-headers-generic
    

    but you may not want to do this, as it's possible that the following kernel update will boot without problems, and this stops the kernel from being updated to a newer version.

  8. To avoid that your running kernel gets uninstalled by apt autoremove, you can mark the kernel and header versions you want to keep on your system as manual. In your case the version you want to keep using is 5.4.0-91, so:

    sudo apt-mark manual linux-image-5.4.0-91-generic linux-headers-5.4.0-91-generic
    
nobody
  • 5,437
2

Graphical User Interface

You can do that using the grub-customizer Package. You can install it using:

sudo apt install grub-customizer

After installing the package you can launch the application using:

grub-customizer

You'll get an interface like:

enter image description here

Right-click on the kernel causing errors( 5.4.0-92-generic), and select remove:

enter image description here

Now, right-click on the working kernel ( 5.4.0-91-generic) and select move up:

enter image description here

Click on the save button to save the changes:

enter image description here

After doing the above run this in a terminal:

sudo update-grub
sudo apt autoremove

That's it!

Reference

Note: To get support and correct drivers for the device I'm using Ubuntu 21.10 with a custom kernel. Don't mind the kernel versions in the image, they're just for reference.

Error404
  • 7,440