Solve the "kernel modules are missing after upgrade" problem
** Situation
- After `apk upgrade` kernel modules from the current kernel are removed
- Loading modules late, f.i. from a kubernetes cluster, fails
- This forces a reboot even though the machine is in a good state otherwise
- Recovering from this by downgrading is often impossible, as the
source package has been deleted upstream (especially when
following edge)
** Solution proposal
*** Assume we have linux-lts-MAJORVERSION as a "meta package"
- This will be the same during one Alpine Linux release
- For instance linux-lts-5.10-rX
*** linux-lts depends on linux-$version that we deem to be LTS compatible
- For instance linux-lts-5.10.0
- That kernel packages deploys /boot/vmlinuz-5.10.0-rY
*** Updating the kernel version
- If there is a new LTS compatible kernel version, we do the following:
- Create a new package linux-lts-5.10.Z
- Update linux-lts-5.10 to depend on linux-lts-5.10.Z
*** Expected behaviour
- apk should notice that linux-lts-5.10 now depends on something
else / newer
- Running apk upgrade should install linux-lts-5.10.Z
- apk upgrade should *not* remove linux-lts-5.10.0
*** Conflict with current setting
- At the moment, -lts as well as -edge "randomly" change the version
- This leads to missing modules during the system run and makes
f.i. kubernetes clusters fail that load modules late (weeks after
uptime)
- If we deem the existing behaviour to be worthy for keeping, a new
name can be introduced, such as 'linux-stable' or 'linux-boring'
or something else indicating it does behave differently
- The new behaviour will leave old kernels behind, which will
accumulate
*** Cleaning up old kernels
- There could be a very easy heuristic that we could apply for the
specific case of kernels:
- Keep the version that is running at the moment
- Keep the new version that we depend on
- Remove everything else
- This logic might be non-trivial to mirror in apk and maybe a
custom script, either called as a post-install or even manually
("clean-up-my-kernels") could solve this
- This could potentially even added in cron