wesbarnett / snap-pac

Pacman hooks that use snapper to create pre/post btrfs snapshots like openSUSE's YaST
GNU General Public License v2.0
180 stars 14 forks source link

Automatically detect current kernel package and symlink its modules #19

Closed AtosNicoS closed 5 years ago

AtosNicoS commented 6 years ago

Hi, I am switching often between linux and linux-lts. It would be nice to support multiple kernels for the new module resymlinking feature.

Also using uname here is dangerous, as you must always boot the selected kernel. If you for example boot linux-lts it will symlink to the linux modules which might cause problems. There must be another way to check the version of the previos installed kernels... https://github.com/wesbarnett/snap-pac/blob/24891dfce32bec57dbd25c02bbcaffbd355319ab/scripts/snap-pac#L136

Edit: Maybe you want to check if the specified kernel equals uname -s (to lower).

ckotte commented 5 years ago

Isn't this feature "just" used to link the modules for the current kernel to allow module load until you reboot and load the updated kernel? The modules of the previous, but still loaded, kernel are deleted after the update and the symlink allows to still access the old modules directory. As soon as you reboot, the symlink is not necessary anymore since the running kernel can't use it anyways.

NicoHood commented 5 years ago

I think you are right. So in order to make this feature more flexible it would make sense to not statically configure the kernel, but rather use the one from uname -s maybe?

ckotte commented 5 years ago

What benefit would you get with creating several symlinks if the link to the modules in the pre snapshot is only usable for the currently running kernel before you reboot the updated kernel?

If you boot the linux or linux-lts kernel, the modules in /usr/lib/modules/$(uname -r) are used and not the modules in the symlink that points to a snapshot!?

NicoHood commented 5 years ago

You are right it makes no sense.

If I remember correct, snap-pac does not use uname -r yet, but my suggestion was to use it instead fo configuring the kernel in the config. I might be wrong about that. Has it changed?

My usecase was to work in both cases: If i boot linux or linux-lts, to dynamically link to the kernel, that is in use, not the one statically configured.

wesbarnett commented 5 years ago

I get the issue now. I don't use multiple kernels. What is uname -s when you boot into linux-lts. uname -s in the linux kernel is Linux so I would have to convert that to the correct package name. I'm wondering if it's the same with other kernels and just needs to be made all lowercase.

wesbarnett commented 5 years ago

Multiple options:

wesbarnett commented 5 years ago

Closed via #22.