My apporach on how to keep Slackware-current upgraded
Earlier this month a fellow LQ newbie asked us How to maintain a sane slackware64-current with Eric Hameleers multilib and ktown? Well, I gave my two cents there.
Now I'm here to expand on how I keep up with Slacware-current evolution in a safe manner, i.e. by avoiding system breakage between upgrades. Keep in mind that even if all this works perfectly for me and I haven't had not a single glitch in this process in the past couple years, it is solely my approach to the task. I have no intention at all that this may become an ultimate approach to it. It's just my way of doing things that could eventually help others with ideas. The scripts are here: https://gist.github.com/denydias/a10...08b8c1bec63ac8 And this is how they work:
Code:
$ sudo minskyup mirror && sudo minskyup slack --force If the changelog entry also contains a new kernel version, then I run: Code:
$ sudo minskyup kernel As for the other minskyup options, they are pretty self explanatory. For instance, to upgrade virtualbox: Code:
$ sudo minskyup virtualbox But there are some other tools that do not provide a way to discover which the latest version is. In that case you have to check first, but it's quite simple too: Code:
$ sudo minskyup docker So, this is how I do it. WFM. Damn, really WFM! :D PS: why minskyup? My box is named after Marvin Minsky. :cool: |
1 Attachment(s)
Thank you for your highly interesting post!
I am taking a far less ambitious approach to keeping my Slackware systems up-to-date, but now that I finally got around to finishing my script for maintaining the Linux kernel under Slackware, I thought I’d share the procedure that I follow. Now, as you said: Quote:
I maintain a local copy of the Slackware repository, which I keep up-to-date with the rsync utility. I blacklisted the kernel packages (as well as ‘SBo’, ‘alien’, and ‘compat32’) in my ‘/etc/slackpkg/blacklist’ file, and to install the Slackware updates, I run the typical command sequence: Code:
# slackpkg update Code:
# upgrade-kernel.sh In case anyone is interested, I attach the script (with an extension of “.txt” instead of “.sh”) to this post. |
I'm glad you liked it. Thank you.
Quote:
|
Dear denydias,
thanks for sharing your workflow. I have one question concerning ktown. Is it really necessary to: Code:
# slackpkg upgrade ktown Code:
# slackpkg upgrade-all Greetings Marcus |
@luvr thanks for providing your script. Is it necessary in order to make it work to use a local mirror or does it also work with a remote? If the latter is the case, could you please share your opinion on why it's better to use a local mirror?
Greetings Marcus |
Quote:
In case anyone ever runs into the same issue: After you rsync your local repository, a new kernel (or, by extension, any new or updated package) won’t get picked up until you run Code:
# slackpkg update Code:
# slackpkg update |
That was exactly the point, thanks. Have you seen my additional question:
Quote:
|
For me it's usually:
Code:
slackpkg update |
@dugan what is the compat32pkg about that you are using? Are you converting the regular packages in multilib with that? Would it also be possible to use aliens multilib repository instead?
|
|
Quote:
The immediate reason is that it looks for an active “file:” line in your ‘/etc/slackpkg/mirrors’ file, and it will quit if it doesn’t find one. The more fundamental reason is that the ‘installpkg’ command (which the script runs to install the new kernel packages) only installs packages that are available locally. Therefore, to support a remote mirror, the script will have to download the packages to a local directory before installing them. While I did consider implementing this (using something like ‘wget’ or ‘curl’), I decided in the end that it wasn’t worth the hassle. After all, the script was really just meant for my own use—“just a hobby, won't be big and professional like gnu”… ;) Quote:
|
@luvr thanks for the reply. I can imagine that a local mirror is also a bit more 'safe' especially for upgrades from stable to -current. I am using it now as you have implemented and till now I am very happy with it. Thanks for the work.
|
@luvr I have noticed one little thing concerning your script: I had the local mirror configured without the trailing slash first, like: file://home/ftp/pub/Linux/Slackware/slackware64-current and your script exited when it tried to detect the local mirror. After modifying the slackpkg mirror configuration so that it looked like this: file://home/ftp/pub/Linux/Slackware/slackware64-current/ everything worked as expected.
|
Quote:
Code:
# Slackpkg only needs to point to the directory that contains Having said that, making the trailing slash optional requires just one simple change to the script (replacing a single ‘+’-sign with an asterisk), as implemented by the following patch: Code:
--- upgrade-kernel.sh_orig 2019-08-10 15:02:21.158041934 +0200 Code:
# patch < /tmp/plus2asterisk.patch |
@luvr thanks for pointing that out and for the patch. I think I will let it like this now as it works perfectly. I have to admit that I did not read the note in the slackpkg mirrors config. I have just tried the script without having the trailing slash set before and then I have realized that in your script there was one, so I have added it an it worked.
|
OOPS! My script does not pick up today’s upgraded kernel.
Today’s “Current (pre-release) ChangeLog for x86_64” announces availability of an upgraded kernel in the repositories:
Code:
Wed Aug 14 05:24:55 UTC 2019 That makes me wonder what would be the recommended way to install this new kernel version. If you used ‘installpkg’, then, surely, it would get installed, but I guess you would then end up with a “broken /var/log/packages - with two versions of the same package”, wouldn’t you? Even so, I’m not aware of any real problems that this would cause; the only irregularity, as far as I can tell, would be a seemingly innocent warning from ‘slackpkg’ about the issue. Anyway, to get my ‘upgrade-kernel.sh’ script, as it currently stands, to install this upgraded kernel, you can do the following:
|
@luvr thanks for pointing that out. It would be great if you could find a way that your script could handle those edge cases. Could you please elaborate how you handle the parallel installation? As far as I have seen on my system /var/log/packages shows several versions of the same package (which I have also expected to be like that). As I have blacklisted the kernels in slackpkg there is also no warning about it.
|
Quote:
A quick search in the ChangeLog's found a case in 14.1, where the kernel (3.10.17) even was rebuilt twice, within a few days: Quote:
BTW: the current (last) updated kernel for 14.1 is a -2 build too: linux-3.10.107/kernel-generic-3.10.107-i486-2.txz because of a security vulnerability. |
It seems to me that it is not an option to leave two (or even more) builds of the same kernel version installed side-by-side, since they use the exact same names for the files that they install.
For instance: Code:
$ tar -tvf kernel-generic-4.19.66-x86_64-1.txz In other words, I guess that if there’s a rebuild available of an already installed kernel version, then it shouldn’t be installed over the previous build, but the previous one should be removed first. Any thoughts? |
Quote:
|
If you use slackpkg then you get a dialog screen and the output from removepkg. The tools check the newer rebuilt package Skipping over duplicate file names. The net effect is that the older package is removed from the package list but the newer rebuilt files remain in place.
Code:
root@xxx:~# slackpkg remove kernel-generic-4.19.66-x86_64-1 Code:
root@xxx:~# removepkg kernel-huge-4.19.66-x86_64-1 |
Quote:
(I’m really just thinking aloud here. If no-one has the answer to these questions, I will try out the “oldpackagename%newpackagename” construct and see what gives.) |
Quote:
|
Quote:
I've been using scripts that follow that exact workflow for system upgrades (including the kernel). The scripts leverage slackpkg and manage the upgrade process from beginning to end including managing EFI & LILO files. |
Quote:
Quote:
It will never remove multiple old packages, only the one that is superceeded BY the newly installed one. |
@luvr one thing that would be nice is to automatically create symlinks to the previous kernel (the one which is actively running) like: /boot/vmlinuz-generic-prev
|
Hey! I'm sorry for the late reply. For an unknown reason I'm not receiving LQ's reply notification messages.
Quote:
Quote:
|
Quote:
|
From how I understood it, the only way to handle those edge cases is to replace the old version using the upgradepkg old2%new2 feature, right?
|
Quote:
Code:
removepkg kernel-source-$KCUR-1 On the other hand, the only way to preserve headers and source for the previous kernel is to copying their files before the installpkg/upgradepkg of them, but I don't really see the need for this. In the event of the new kernel don't boot, I'll use the previous one just to inspect the situation, fix it and boot into the new one asap. |
I would like to know how often it really happens that a new kernel does not boot. I must admit that i am using the huge kernel and never had any issues with it, neither on stable nor on -current. I can imagine that an upgrade could eventually cause issues when one is using LVM / Full-Disk-Encryption or things like that.
For me the the main issues when using the -generic kernel is that I always have to remember to run lilo afterwards, which I sometimes forget and then (and only then) I have to boot the old kernel and fix the initrd. So I am really interested in your real-life experience and would be happy if you could share some of the situations you had on kernel upgrades. |
Quote:
Quote:
|
autoslackpkg-0.4 RC1
I've been using my own Slackware upgrade scripts since last year. At that time I had 3 systems on current and the kernel upgrades were becoming robotic for me. Hopefully the scripts are ready for others to test drive. I named the scripts "autoslackpkg".
https://www.go4it2day.com/news/autoslackpkg-0.4.html The scripts leverage slackpkg and manage kernel changes from start to finish on both EFI or LILO systems. The key to successfully using the scripts is to make sure 4 config files are appropriately customized. There are rudimentary help screens that try to explain the config customizations. Code:
/etc/slackpkg/blacklist/usr/sbin/usermod Enjoy! |
Quote:
Quote:
|
I had some spare time today and could face the kernel build bump problem in my script. Follow are the results (with mocked values, of course).
First with a regular kernel upgrade, e.g. 4.19.66 to 4.19.67: Code:
$ minskyup kernel Code:
$ minskyup kernel |
Quote:
Code:
# upgradepkg kernel-source-4.19.66-noarch-1%kernel-source-4.19.66-noarch-2.txz Thus, a sequence of ‘removepkg’ and ‘installpkg’ will be the way to go in order to upgrade an installed kernel version to a newer build. |
Quote:
My approach is a little different: although I keep the previous kernel, I do so only to count on a booting system in case the worst happens, i.e. the just installed new kernel won't boot at all. As I have no intention to recompile the previous kernel, nor compile anything in the system against it anymore, I don't need kernel-source nor kernel-headers of the previous kernel. As such, when a new kernel arrives (like 4.19.67 to replace 4.19.66), my script just upgradepkg kernel-source and kernel-headers, effectively replacing them with the newer versions. On the other hand, when the kernel upgrade is just a bump (like 4.19.66-1 to 4.19.66-2), there is no need to touch kernel-source and kernel-headers, so my script just skip this step. In any case, version or bump upgrades, my script actively removepkg the selected kernel then installpkg the new one. I prefer this way to avoid conflicts that may left orphan files or dead links around in the system. |
Quote:
For now, it doesn’t hurt to keep them around either, but I’ll think it through a little further before I make up my mind about how to handle them in the future. Quote:
Quote:
Quote:
I do have an updated version of my script ready now, which maintains an additional set of links to the ‘previous’ kernel files (i.e., to the kernel version that is running when the script is being executed), but I’ll have to double-check that it doesn’t do any crazy things when it has to remove kernel packages. |
UPDATE to my 'upgrade-kernel.sh' script.
1 Attachment(s)
Attached to this post is an update to my ‘upgrade-kernel.sh’ script.
NEW FEATURE:
Caveat: When you remove one or more kernel versions while no new kernel version is available, these ‘-prev’ symlinks will be recreated to point to the kernel version that is running at that time. As a consequence, if you’re running the latest installed kernel version at that time (which you normally will), then the ‘-prev’ and the “new-kernel” symlinks will both be made to point to that latest version. I don’t consider this a significant problem, because:TO DO:
I will be testing this support on my Slackware-current install, which I temporarily reverted back to kernel version 4.19.66, Build 1. I’m using a test version of the script that I point to what it thinks is my local repository mirror, but is in reality a simple folder into which I can copy any kernel version and build that I want to test with. |
Quote:
|
Next update to my 'upgrade-kernel.sh' script.
3 Attachment(s)
Attached to this post is the next update to my ‘upgrade-kernel.sh’ script.
NEW FEATURE:
|
Thank luvr, I am going to try it out soon and give some feedback. The dangling symlinks is not so much an issue in my point of view.
Could you elaborate a bit more why exactly now three scripts are needed instead of one like before? Wouldn't it be possible to merge all the functionality into the main script? |
Quote:
I used the ‘fix-kernel-symlinks.sh’ while I was developing the latest version of my ‘upgrade-kernel.sh’ script, so I could verify if the latter behaved properly under various conditions. I haven’t encountered a situation in which the ‘rebuild-kernel-initrd.sh’ was useful, but you never know. Thus, to recapitulate: Under normal conditions, you should still only really need the main ‘upgrade-kernel.sh’ script. |
Thanks for pointing that out. I have to add some options to the mkintrd generation. Can I just modify the following line to look e.g. like this:
$(/usr/share/mkinitrd/mkinitrd_command_generator.sh -a -l sg-latin1 -h /dev/cryptvg/swap '-o '"${INITRD}" --run "${KERNEL}") Greetings Lioh |
Quote:
|
@luvr. I am actually not sure what caused this situation but currently the following broken symlink has been created:
initrd-*-prev -> initrd-*-4.19.80* I have used the script for the first time on a newly installed system and this link has been generated on the first kernel update. The 'old' initrd was named just initrd.gz, maybe that's the root cause. |
Quote:
I now have an updated version of the script available, which I will upload later. (I don't have my Slackware system handy at the moment, but the solution is as simple as inserting an appropriate "shopt" command near the top of the script.) Thanks for reporting this issue. It reminds me to upload the new version. |
Thanks for the reply. I will wait for the updated version. As far as I understood this can only happen on the first run/migration to your script.
|
Quote:
|
UPDATE to my 'upgrade-kernel.sh' script: BUG FIX.
3 Attachment(s)
Attached to this post is the next update to my ‘upgrade-kernel.sh’ script. It fixes a bug where, the first time that it is run on a freshly installed Slackware system, it will create a broken symlink, such as:
Code:
initrd-*-prev -> initrd-*-4.19.81* To fix this bug, the script now sets the ‘nullglob’ shell option when it begins execution: Code:
shopt -s nullglob As before, only the main script, ‘upgrade-kernel.sh’, is required. Helper scripts ‘fix-kernel-symlinks.sh’ and ‘rebuild-kernel-initrd.sh’ let you recreate the symbolic links to the installed kernel files and rebuild the initrd, respectively, just in case. |
All times are GMT -5. The time now is 04:57 PM. |