Page 1 of 1

[HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 8:59 am
by vandykmarsu
How to upgrade the kernel to the latest via backports sources.


addition of necessary sources:

#stable

Code: Select all

echo "deb http://ftp.fr.debian.org/debian/ buster-backports main" >> /etc/apt/sources.list
echo "deb-src http://ftp.fr.debian.org/debian/ buster-backports main" >> /etc/apt/sources.list
#non-free

Code: Select all

echo "deb http://ftp.fr.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.fr.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list

Code: Select all

apt update

To know how kernel are installed:

Code: Select all

uname -a

Good news LMDE4 already has backports repository activated by default, we use later the backports sources to update our kernel.


To search a newest kernel:

Code: Select all

apt search linux-image

In the output we will see a lot of kernels, but we have interest to the latest, at this time the kernel 5.7:

Image


Lets do it and install the latest kernel:

Code: Select all

apt install linux-image-5.7.0-0.bpo.2-amd64 linux-headers-5.7.0-0.bpo.2-amd64 -t buster-backports -y

A reboot is needed to boot on the new kernel:

Code: Select all

reboot

We can check now:

Code: Select all

uname -a

The output:

Code: Select all

Linux my-pc 5.7.0-0.bpo.2-amd64 #1 SMP Debian 5.7.10-1~bpo10+1 (2020-07-30) x86_64 GNU/Linux

let's take it a step further by removing the old kernels, in general it is advisable to keep 2 kernels in case there is a problem with one of them.

To view the installed kernel:

Code: Select all

dpkg --list 'linux-image*'
In the output you will see how kernel you can purge, in my case i keep the 4.19 and the 5.7 and purge the 5.6.


Example to purge a kernel:

Code: Select all

apt autoremove --purge linux-image-5.6.0-0.bpo.2-amd64 linux-headers-5.6.0-0.bpo.2-amd64 -y

We need to upgrade the grub with the changes we made:

Code: Select all

update-grub2

After an reboot in the boot menu, select advanced options, you can also check the kernels who are usable.

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 9:56 am
by SwampRabbit
Thank you for making a HowTo.

But, why not use the MX Package Installer and Debian Backports tab?
For a new and novice user we already have a much simpler way.

You don't have to mess with your sources.list and you don't have to use the Debian mirror in France, not everyone lives in France.
I lived in Grenoble France in the early 2000s, I enjoyed my time there, but still not everyone needs to use the Debian mirror in France. ;)

If you want to make HowTos, it would be great if you did them using all the amazing tools that make it easy for new and novice users, which is the preferred MX way.

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 11:40 am
by sunrat
Apart from doing it the hard way instead of the easy MX way as SwampRabbit posted,
vandykmarsu wrote: Fri Aug 14, 2020 8:59 am addition of necessary sources:

#stable

Code: Select all

echo "deb http://ftp.fr.debian.org/debian/ buster-backports main" >> /etc/apt/sources.list
echo "deb-src http://ftp.fr.debian.org/debian/ buster-backports main" >> /etc/apt/sources.list
#non-free

Code: Select all

echo "deb http://ftp.fr.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
echo "deb-src http://ftp.fr.debian.org/debian/ buster-backports main contrib non-free" >> /etc/apt/sources.list
You only need one of those 4 lines and you don't need the deb-src lines to install a new kernel.
We need to upgrade the grub with the changes we made:

Code: Select all

update-grub2
No you don't, apt will do that automatically.

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 11:51 am
by asqwerth
re: update-grub2, the only 2 distros I've seen in the past few years still using "grub2" are Fedora and PCLinuxOS, both rpm-based distros.

When I installed PCLOS in 2015 on my machine, it was still on legacy grub when most other distros were already using grub2. For PCLOS, 'grub' was legacy grub with the menu.lst grub menu. So its /boot/grub folder held all the legacy grub stuff. WHen I subsequently installed their grub2, it installed all the grub2 stuff in the /boot/grub2 folder.

But Debian and Ubuntu had long moved to grub=grub2 by then, and grub.cfg was just stored in /boot/grub folder. And AFAIK, the update command has simply been "update-grub" for a long time. (probably a shortcut or alias, but still.... it's been that for yonks)

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 12:58 pm
by Huckleberry Finn
SwampRabbit wrote: Fri Aug 14, 2020 9:56 am Thank you for making a HowTo.

But, why not use the MX Package Installer and ...
Literally agree.

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 6:35 pm
by sunrat
asqwerth wrote: Fri Aug 14, 2020 11:51 amAnd AFAIK, the update command has simply been "update-grub" for a long time. (probably a shortcut or alias, but still.... it's been that for yonks)
It's still in Debian as a symlink, didn't check MX right now.

Code: Select all

$ file /usr/sbin/update-grub2
/usr/sbin/update-grub2: symbolic link to update-grub

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 7:57 pm
by andyprough
asqwerth wrote: Fri Aug 14, 2020 11:51 am re: update-grub2, the only 2 distros I've seen in the past few years still using "grub2" are Fedora and PCLinuxOS, both rpm-based distros.

When I installed PCLOS in 2015 on my machine, it was still on legacy grub when most other distros were already using grub2. For PCLOS, 'grub' was legacy grub with the menu.lst grub menu. So its /boot/grub folder held all the legacy grub stuff. WHen I subsequently installed their grub2, it installed all the grub2 stuff in the /boot/grub2 folder.

But Debian and Ubuntu had long moved to grub=grub2 by then, and grub.cfg was just stored in /boot/grub folder. And AFAIK, the update command has simply been "update-grub" for a long time. (probably a shortcut or alias, but still.... it's been that for yonks)
'update-grub2' is a valid command on Debian-based distros, as it is a "stub for running grub-mkconfig -o /boot/grub/grub.cfg to generate a grub2 config file" according to the update-grub manpage. Both 'update-grub2' and 'update-grub' do the same thing, they invoke the same stub.

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 10:51 pm
by Stevo
In my experience, it doesn't matter what command you use to update GRUB, because you don't need to issue one at all--adding, upgrading, or removing a kernel updates the menu automatically. So it's a non-issue.

It's also missing the warning that third party drivers like Nvidia, virtualbox-dkms, or broadcom-sta may not build with a new kernel, though we try to stay ahead of that in the AHS repo, at least. These instructions get a D- grade at best.

Re: [HowTo] Update your kernel to the latest

Posted: Fri Aug 14, 2020 11:02 pm
by asqwerth
Per my post above, I did guess that update-grub and update-grub2 do the same thing due to shortcuts or aliases (so now I know that in fact update-grub2 is a symlink to update-grub) , but the point was that it hasn't been necessary to include the '2' in Debian in ages.

I still use :

Code: Select all

grub2-mkconfig -o /boot/grub2/grub.cfg
In my fedora install to update grub.

ADDED: and Stevo is right that these instructions aren't the most appropriate and there are caveats/cautions attached.