Delaying shutdown until pending kmods are compiled

As you may be aware, Fedora comes with a nasty “self-destruct trap” for NVIDIA users. After installing the drivers for the first time and after every kernel update, the OS begins compiling a kernel module in the background, and if the user shuts down or reboots the system before this completes, the driver will be broken and the user will be left with either safe-mode graphics or no graphics.

It’s especially insidious because nothing - not Fedora, not KDE, not even the driver’s own package description - tells you to wait for this invisible process or that it even exists. To the contrary, KDE’s Discover offers a tempting “Reboot now” button when a system update “completes,” leading users straight into the trap.

I’d like to see a safeguard against this, but I’m not sure where the right place would be to put it.

One option could be to put it in KDE. First, Discover would only say a system update is done once it’s actually done (= no more pending kmods). Also, if the user initiates a reboot or shutdown, KDE would check if there’s an installation or kmod compilation going on, display a message like “Finishing system update…”, and hold off the shutdown until it’s safe.

Another option would be to put the automatic wait deeper, in Fedora or even the Linux kernel. This would also serve users on other desktop environments… But depending on the implementation, it might result in the computer sitting on a nondescript loading screen/black screen for several minutes before powering off, which would just make users think it got stuck (and force it off with possibly even worse consequences than before).

Please let me know your thoughts and if/where I should file a request for such a feature.

Whatever package triggers the kmod build needs to block its installation routine until it is actually done.

Then any package manager, whether that is Doplhin or GNOME Software or dnf will consider it “not done” until it actually is.

I haven’t tried it, but in principle this seems to be possible by enabling a service.

The Fedora package docs for akmods say:

Akmods startup script will rebuild akmod packages during system
boot, while its background daemon will build them for kernels right
after they were installed.

The akmods systemd service provides both, and is enabled by default.

The akmods-shutdown service is disabled by default but can, in some
circumstances, provide an additional chance to build and install a kernel
module. Users who would prefer longer shutdowns over delayed startups
may wish to consider enabling it with the following command:

    sudo systemctl enable --now akmods-shutdown.service

Thank you for your replies. I’ve enabled the shutdown service for myself and filed an enhancement request with RPMFusion to (hopefully) save other Fedora newcomers from broken drivers in the future.