You are not logged in.

#1 2017-08-24 23:05:10

spease
Member
Registered: 2017-08-24
Posts: 6

Keep old kernel modules around until next kexec/reboot?

I've been using Arch for about 5 years now, and there's one consistent issue I've noticed. When you upgrade the kernel, the old kernel modules are uninstalled and replaced with the newer ones. As a consequence, the currently running kernel can't load any new modules (eg if you plug in a USB stick that needs to use exfat). Is there any way to configure things so that the current kernel's modules are kept around until the system is restarted and the upgraded kernel is in use? Thanks.

Offline

#2 2017-08-24 23:08:20

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,597
Website

Re: Keep old kernel modules around until next kexec/reboot?

I don't think so... have you poked around in the pacman man page?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2017-08-25 02:44:01

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Keep old kernel modules around until next kexec/reboot?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#4 2017-08-25 18:26:08

olive
Member
From: Belgium
Registered: 2008-06-22
Posts: 1,490

Re: Keep old kernel modules around until next kexec/reboot?

@Eschwartz This is a very old thread.

@all I have had problems with other things that the kernel and systemd make that worse. Systemd depends on a lot of daemon that get sometimes launched on demand. If you have a old daemon running with the new systemd files, it can leads to problems. Same for Xorg and many other things. Generally I just sync and reboot after each upgrade, which takes only a few seconds on my machines by the way. I understand this can be a problem with servers that must stay on 100% of the time but handling that properly would ask major investments and an added complexity.

Offline

#5 2019-03-17 06:53:41

epitron
Member
Registered: 2016-08-19
Posts: 2

Re: Keep old kernel modules around until next kexec/reboot?

@spease I have a hacky workaround that you might find helpful -- on boot, you can make kernel's modules directory immutable (unable to be deleted, even by root), eg:

MOD_PATH="/lib/modules/`cat /lib/modules/extramodules-ARCH/version`"
chattr -R +i $MOD_PATH

When the kernel package gets upgraded, pacman isn't able to delete the old modules (and, thankfully, doesn't fail with an error). The current kernel will keep running nicely.

On the next reboot, the boot script can notice that there is a new modules directory, make *that* one immutable, and remove the old modules directory.

Tell me how this works for you!

Offline

#6 2019-03-17 08:18:31

epitron
Member
Registered: 2016-08-19
Posts: 2

Re: Keep old kernel modules around until next kexec/reboot?

Here's a quick Ruby script I whipped up to accomplish this:
https://github.com/epitron/scripts/blob … el-modules

(I did it in Ruby because it's a lot easier to diff arrays of directories; if you're a bash wizard, I'd enjoy a ported version!)

Offline

#7 2019-03-17 09:10:09

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 1,985
Website

Re: Keep old kernel modules around until next kexec/reboot?

Without having tried it, I would just write a script with two ALPM hooks that are executed before and after a kernel update to backup and restore the modules. However this issue is 1½ years old and OP might even no longer be interested in a solution.


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

#8 2019-03-17 13:12:26

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,718

Re: Keep old kernel modules around until next kexec/reboot?

There are n+1 solutions to this problem, pick any one of them. Please don't necrobump.

Closing.

Last edited by V1del (2019-03-17 13:13:05)

Offline

Board footer

Powered by FluxBB