-1

I have a VPS server with a hosting company that I have ssh/root access. I recently tried to upgrade the kernel to the latest (4.18.5-041805-generic). I was running 4.4.0-169 and thought it was time to upgrade.

So I ran the following:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

After all of that, the kernel version still remained the same. So, after a search I found this set of instructions:

https://www.tecmint.com/upgrade-kernel-in-ubuntu/

I followed the instructions and attempted to install the latest kernel version. Near the end it generated an error indicating it was leaving it unconfigured, yet when I run "uname -rs" it lists the new kernel:

~$ uname -rs
Linux 4.18.5-041805-generic

However, now when I try to make sure everything else is also up to date again I get a dependency error:


~$ sudo apt-get update && sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-headers-4.19.0-041900rc1-generic : Depends: libssl1.1 (>= 1.1.0) but it is not installable
 linux-image-unsigned-4.19.0-041900rc1-generic : Depends: linux-modules-4.19.0-041900rc1-generic but it is not installable
E: Unmet dependencies. Try using -f.

So, I wanted to go back to the old 4.4.0-169-generic kernel but I cannot figure out how to do this. Every instruction that I can find in my searches says to use a keyboard shortcut to interrupt grub and then select a different kernel.

The problem is that I am running on a VPS cloud server and do not have a physical keyboard connected to the server. I only have the ssh window into the server to get anything done.

How do I delete the new kernel that generates the dependency issue and get back to booting with the previous kernel?

  • Don't mix apt repositories or packages made for other releases. – Ipor Sircer Aug 28 '18 at 3:18
0

Looking at for instance this answer, you can change the boot order of the two kernels from a terminal. The heavily upvoted comment in that answer also suggests using the full name of the kernel, rather than its numerical index, for better stability.

In short:

  1. sudo view /boot/grub/grub.cfg and copy the full name of your old kernel.
  2. sudo vi /etc/default/grub and, at the top, change GRUB_DEFAULT=0 to instead read GRUB_DEFAULT=your_kernel_name_from_grub.cfg, and save the change (you may like to keep a copy of the original file for safety).
  3. sudo update-grub.

Then rebooting should bring you back to your older kernel. If you wanted a quick fix, you could probably just change GRUB_DEFAULT=0 to GRUB_DEFAULT=1 in /etc/default/grub (and then sudo update-grub and reboot), but the above procedure is less brittle.

0

The tutorial you followed is better explained at the Kernel: Mainline Builds - Ubuntu Wiki. See also Section 4 of that same Wiki article for removal instructions.

Note: Just because there was a dist-upgrade doesn't necessarily mean there is a kernel upgrade in that upgrade. See the Ubuntu Package repository: linux-image-generic

  • Not exactly right... If you read that section on removing the offending kernel it indicates that once it is removed you are still dependent on the "GRUB boot menu" to change the booting kernel. ** I do NOT have access to the GRUB boot menu through a ssh window. That is only available by a keyboard shortcut (specifically the shift key during boot.) This is not a physical box on my desk, it is a cloud server. How can I alter the GRUB boot menu from a ssh window? – BKM Aug 28 '18 at 0:11
  • This is exactly correct. Try reading the manual, or see Phase 2 here. Tip: Just because Ubuntu forces/prefers it's users to depend on GUI tools, using SSH requires you to learn without X. – eyoung100 Aug 29 '18 at 16:42
  • I should also add that your cloud server instance still boots up with grub in some way as this is the preferred method in most Linux'es. The post-install phase in apt should have spit out a warning reminding you to run update-grub Have a look at /var/log/apt/history.log – eyoung100 Aug 29 '18 at 17:01

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.