Sometimes after updating the kernel of the system, some important services start to work incorrectly and in order not to look for a problem on the combat server, and to do it for example later on the virtual one, you can boot the system from the previous version of the kernel.
First, we will look at the current version (I have displayed 4.15.0-46-generic):
uname -a
uname -r
For the test, I took Ubuntu Server 18.04, the system was on a virtual stand and had not been updated for a long time, I specifically performed the update:
sudo apt update
sudo apt upgrade
Restart the system so that it boots from the new version of the kernel and then again we will see the version (I already have a newer version – 4.15.0-47-generic):
sudo reboot
uname -r
Logs of installing updates if you can see anything in /var/log/dpkg.log and /var/log/apt/.
If you have direct access to the server, you can select “Advanced options for Ubuntu” in the grub menu when you start the system and then select the correct kernel, but after restarting the system, the newest will still start.
To start the system from a previous kernel version, open the grub configuration file in a text editor:
sudo nano /etc/default/grub
And instead of “GRUB_DEFAULT = 0”, we specify (in the nano editor, to exit, press Ctrl+X and “y” to save the changes):
#GRUB_DEFAULT=0
GRUB_DEFAULT="1>2"
Since the numbering of the menu grub comes with 0, 0 is the usual system load, in the first menu “Advanced options for Ubuntu” will be number 1, and in the second menu where you need to select the kernel “4.15-46-generic” will be number 2. You can see the menu in the file /boot/grub/menu.lst.
Installed kernels are located in the /boot/ directory, you can also see the command:
sudo dpkg -l | grep linux-image
ls /boot/
Update grub to apply changes:
sudo update-grub
Restart the system and check the kernel version again (in my case the system booted from the old 4.15.0-46-generic kernel):
sudo reboot
uname -r
You can also find and install a different version of the kernel (see if there is enough memory in the /boot/ directory if it is located on a separate partition):
sudo apt-cache policy linux-image-4.15.0-45
sudo apt install linux-image-4.15.0-45-generic
This kernel will most likely be number 4 in the menu, so we’ll point it out in the /etc/default/grub file and then restart the system:
GRUB_DEFAULT="1>4"
You can also leave “GRUB_DEFAULT = 0” and delete the new kernel, after which the previous one will become the main one, but it’s better not to do so:
sudo apt remove linux-image-4.15.0-47-generic
See also my article:
Updating Ubuntu 14.04 to 16.04