[SOLVED] What is the procedure for upgrading a kernel on Slackware?
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
What is the procedure for upgrading a kernel on Slackware?
I ask because slackpkg tells me there is a new kernel available: 4.4.190. I assume this is to provide protection against spectre. Now most distros, when told to "upgrade" a kernel, actually install the new kernel alongside the old for safety. But I have a nasty feeling that slackware, which tends to take instructions very literally, might actually upgrade the working kernel and perhaps mess up my next boot. So what does one do in such cases?
One thing I've already tried is to fetch and install this specific version (kernel-generic-4.4.190-x86_64-1) by name using slackpkg. That doesn't work. Should I download the kernel image by hand and then use installpkg? The subsequent bootloader configuration isn't an issue; I know how to do that. I just want to know, as a fairly new slacker, what the normal procedure is for upgrading the kernel itself.
More generally it is recommended to register to the Slackware Security mailing list, following instructions given here: http://www.slackware.com/lists/
But I have a nasty feeling that slackware, which tends to take instructions very literally, might actually upgrade the working kernel and perhaps mess up my next boot. So what does one do in such cases?
Take a look at my blog post on this, it will give you an idea:
I always download the source and build from scratch. Takes about 5 minutes to build the kernel and a total of 25-30 minutes to build everything - headers, modules, firmware. Usually keep the last three or four kernel releases in /boot as backups.
I always download the source and build from scratch. Takes about 5 minutes to build the kernel and a total of 25-30 minutes to build everything - headers, modules, firmware.
Wow! How much memory do you have? It takes my machine about an hour to build a generic slackware kernel with all the modules (a lot less in LFS where I don't include drivers for hardware that I don't have).
@ Didier, Lysander. Thank you, gentlemen. Basic installation of kernel and modules now done and initrd created. The rest is just handwork. I'm going to switch refind to the new kernel and leave the old one in elilo for the time being. Belt and braces!
you could take inspiration from these
blacklist kernels and
script to get latest kernel ( assumes slackpkg update has been done )
Code:
#!/bin/bash
Kernels="${HOME}/Kernels"
[[ -e ${Kernels} ]] || mkdir -p "${Kernels}"
cd "${Kernels}" || exit
mirror="$(grep -m1 -v ^# /etc/slackpkg/mirrors)"
while read pkg
do
for ext in .txt .txz.asc .txz
do
[[ -e ./${pkg##.*/}${ext} ]] && continue
GetList+=(${pkg#./}${ext})
[[ ${ext} != \.txz ]] && continue
#Install+=(${pkg##*/}${ext})
# Edit: I only hacked in Kernels dir for this post
# this adds full path
Install+=("${Kernels}/${pkg##*/}${ext}")
done
done < <(awk '/kernel-[gmh][eo]/{print $7"/"$6}' /var/lib/slackpkg/pkglist)
xargs -r echo wget -c <<<${GetList[@]/#/ ${mirror}}
xargs -r echo sudo installpkg <<<${Install[@]}
I use grub
with multiple kernels ( I manually remove older ones )
so I gen. initrd for each kernel version
( which thankfully grub-mkconfig understands )
Kernel build times range from 10 minutes on my newest computer to 3 hours on my oldest. It is entirely CPU-bound. This is why you want a powerful computer.
The amazing thing is that my oldest computer can still compile the kernel.
Ed
I, too, prefer manual building. I don't use slackpkg and don't prefer the concept. The only automation I allow is what I put in Chron... simple stuff. Initially I manually buolt kernels to be extremely lean back before loadable modules. Once ALSA was handled within the kernel I preferred to have newer kernels than mainstream and early WiFi only made that more valuable. I'm currently running 5.0.20 on 14.2 Slackware as well as a separate install of -Current.
I've built a couple 5.4.x kernels but a change in layout of Module.symvers caused nVidia drivers to fail to build so I'm awaiting resolution either from kernel.org or, more likely, nVidia. If one web searches for anything like "build slackware kernel" one will get several hits, including Alien Bob's old page created back during 2.4.x kernels but even it still works just fine. It just has a step or two that have since been streamlined a bit. In that page he mentions what amounts to the case that an initrd is only really required if one encrypts the /boot filesystem. I'm curious about encryption so I may soon for the first time need to go through the extra complications of initrd, but I like not having to. It's just slightly more KISS without one.
For me the best case for manual building is the expanding of comprehension and power that comes from visiting each option. For this reason I especially like Alien Bob's page since it shows how to be able to use "make xconfig" as root which means one can see each and every help section for every option that has one. That is a very helpful learning tool in my experience.
On my home system I run Slackware-current. I have the kernels comented out in /etc/slackpkg/blacklist and just let slackpkg update the kernels along with everything else. I use grub as boot loader so, the only thing I do is create a new initrd.gz when kernels are upgraded. I think I have had only one hiccup in the last 10 years.
On a side note if this was a critical system, I wouldn't do this. I use to customize kernels when hardware wasn't so robust and could see a difference in stock kernel and a custom kernel.
Last edited by colorpurple21859; 10-28-2019 at 05:40 AM.
After reading this thread I had a look at times for compiling a kernel by hand on my own system, which I built in part to assist such compiling. I am following the 5.3.x series so this test is with 5.3.8.
I normally script this but running this in 2 parts so I can 'time' it:
Code:
time make -j 32 bzImage
[...]
real 1m4.256s
user 22m39.439s
sys 2m40.084s
and then:
Code:
time make -j 32 modules
[...]
real 4m43.485s
user 131m47.440s
sys 14m35.555s
Plus the actual installation of the kernel to /boot, modules to /lib/modules and editing of Lilo which adds some relatively inconsequential time to the adventure. This is using an AMD Threadripper 2950X which will be eclipsed soon enough when the 3rd Generation Threadripper CPUs come out...
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.