Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc fixes #371

Merged
merged 7 commits into from
Dec 6, 2023
Merged

Misc fixes #371

merged 7 commits into from
Dec 6, 2023

Conversation

anbe42
Copy link
Contributor

@anbe42 anbe42 commented Dec 6, 2023

a few small fixes for better cleaning up depmod generated files and for testing modules with AUTOINSTALL=""

avoid noise
	Module build for kernel <KVER> was skipped since the
	kernel headers for this kernel does not seem to be installed.
on removed kernels that still have a nearly empty /lib/modules/<KVER>
(w/o a build symlink) remaining
we just removed the last module from (no longer installed) kernel $1
so do not leave stale depmod files around
dkms autoinstall may produce multiline output
@scaronni
Copy link
Collaborator

scaronni commented Dec 6, 2023

Thanks!

@scaronni scaronni merged commit 2016493 into dell:master Dec 6, 2023
23 checks passed
@anbe42 anbe42 deleted the misc-fixes branch December 6, 2023 08:16
# no longer installed kernel $1, so do not leave stale depmod files around
rm -fv /lib/modules/$1/modules.{alias,dep,devname,softdep,symbols,*.bin}
rmdir --ignore-fail-on-non-empty /lib/modules/$1
test -d /lib/modules/$1 || echo $"Removed /lib/modules/$1"
Copy link
Collaborator

@evelikov evelikov Dec 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the series looks great, although this looks like a hack/workaround.

Namely: distros should kick off dkms remove/unbuild... before the actual kernel (modules) get removed. This is what Arch does at least - I didn't check others. If they use different order, then depmod shows some scary warnings:

depmod: WARNING: could not open modules.order at /some/path: No such file or directory
depmod: WARNING: could not open modules.builtin at /some/path: No such file or directory
depmod: WARNING: could not open modules.builtin.modinfo at /some/path: No such file or directory

If people manually remove modules after the kernel is gone, they will see the above warnings, which should be a flag that (minor) manual intervention is needed. That's perfectly fine IMHO.

In addition the empty /lib/modules/$1 can be owned by another package and removing it will cause package integrity checks to fail.

In a way I'm thinking that this should be handled at the depmod level - assuming you agree, can you open a proposal at https://github.com/kmod-project/kmod/ and I would have a look as time permits.

Few questions come to mind:

  • Toggle short/long name?
  • Omit output files when one or all input files are missing?
  • Opt-in or out of the new functionality?
  • Keep as-is or remove pre-existing output files?

Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only linux-headers-$KVER are installed (maybe linux-image-$KVER is already gone) dkms builds and installs modules and calls depmod creating these files. There is noone left responsible for cleaning up these bits ...

Ideally depmod should be deferred to a trigger from linux-image-$KVER ... but it's probably a long way to get there.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ack, can I ask you to open an issue (here dkms and/or in Debian) with a rough outline and link it in the code?

Thanks 🙇

@anbe42
Copy link
Contributor Author

anbe42 commented Dec 6, 2023

Thinking of it again, if there is initially no modules.dep because no linux-image-$KVER is installed, dkms should not call depmod to create one, so there would be no need for dkms cleaning that up afterwards. Preparing a patch.
(Removing linux-image-$KVERS cleans up all modules.dep and friends, so if dkms doesn't create new ones after that removal, we are fine as well in case dkms ran depmod to update them while the image package was installed))

So we would need the cleanup code only for old module installation that unnecessarily ran depmod.

@anbe42
Copy link
Contributor Author

anbe42 commented Dec 6, 2023

Let's continue this in #374

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants