Extremely long boot times due to akmods.service

Since the last week, fedora has been taking 4 to 5 minutes to boot. When I ran systemd-analyze critical chain, I got the following:

graphical.target @5min 33.608s
└─sddm.service @5min 33.608s
  └─akmods.service @1min 29.358s +4min 4.226s
    └─akmods-keygen.target @1min 29.357s

I tried reinstalling the drivers, to no avail and none of the solutions outlined in other topics works.

System specs:
OS: Fedora Linux 41
Kernel: Linux 6.12.11-200.fc41.x86_64
CPU: Intel(R) Core™ i5-8265U
GPU 1: NVIDIA GeForce MX130

Any help is appreciated!

1 Like

The first time you install a new kernel akmods is used to compile the nvidia kernel module. This takes time. If you did not wait for this to happen before rebooting after the update then it happens on the first boot.

This should is a one-off slow down. If it is not them it is possible that the nvidia drivers are not building.

The thing is that this happens every single boot, regardless of whether the kernel/drivers were updated or not.

also, when I try to rebuild the drivers using sudo akmods --force, I get
Checking kmods exist for 6.12.11-200.fc41.x86_64 [ OK ]

$ sudo mokutil --sb-state
SecureBoot disabled
$ sudo mokutil -t /etc/pki/akmods/certs/public_key.der
/etc/pki/akmods/certs/public_key.der is not enrolled
$ sudo akmods --force --rebuild
Checking kmods exist for 6.12.11-200.fc41.x86_64           [  OK  ]
Building and installing nvidia-kmod	                   [  OK  ]

This is the output.

Can you run the command systemctl status akmods.service? That would tell you something about what the akmods service did.

I ran the commands mentioned earlier, but unfortunately, the boot time didn’t improve. I encountered a similar issue with a previous Fedora installation about three months ago, which led me to reinstall the OS. That previous install was about four months old. Given that my current install is now three months old, could there be some accumulated stuff affecting performance?

The output of systemctl status akmods.service is below:

● akmods.service - Builds and install new kmods from akmod packages
     Loaded: loaded (/usr/lib/systemd/system/akmods.service; enabled; preset: enabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf, 50-keep-warm.conf
     Active: active (exited) since Fri 2025-02-14 16:21:45 IST; 11min ago
 Invocation: d727f2f9f2d64749a0fa98f4ec5b0ae6
    Process: 1335 ExecStart=/usr/sbin/akmods --from-init (code=exited, status=0/SUCCESS)
   Main PID: 1335 (code=exited, status=0/SUCCESS)
   Mem peak: 1.6G
        CPU: 11min 22.395s

Feb 14 16:08:42 fedora akmods[1335]: Checking kmods exist for 6.12.11-200.fc41.x86_64[  OK  ]
Feb 14 16:08:25 fedora systemd[1]: Starting akmods.service - Builds and install new kmods from akmod packages...
Feb 14 16:09:17 fedora runuser[1531]: pam_unix(runuser:session): session opened for user akmods(uid=972) by (uid=0)
Feb 14 16:14:52 fedora runuser[1531]: pam_unix(runuser:session): session closed for user akmods
Feb 14 16:21:42 fedora akmods[1335]: Building and installing nvidia-kmod[  OK  ]
Feb 14 16:21:45 fedora systemd[1]: Finished akmods.service - Builds and install new kmods from akmod packages.

The runuser commands is unexpected.

Feb 14 16:09:17 fedora runuser[1531]: pam_unix(runuser:session): session opened for user akmods(uid=972) by (uid=0)
Feb 14 16:14:52 fedora runuser[1531]: pam_unix(runuser:session): session closed for user akmods

I get following, although not of nvidia

● akmods.service - Builds and install new kmods from akmod packages
     Loaded: loaded (/usr/lib/systemd/system/akmods.service; enabled; preset: enabled)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf, 50-keep-warm.conf
     Active: active (exited) since Fri 2025-02-14 13:42:18 CET; 3min 53s ago
 Invocation: b10fd44bb6f14712bb0f426f8a32cbff
   Main PID: 1007 (code=exited, status=0/SUCCESS)
   Mem peak: 13.4M
        CPU: 76ms

Feb 14 13:42:18 newbox systemd[1]: Starting akmods.service - Builds and install new kmods from akmod packages...
Feb 14 13:42:18 newbox akmods[1007]: Checking kmods exist for 6.12.11-200.fc41.x86_64 [  OK  ]
Feb 14 13:42:18 newbox systemd[1]: Finished akmods.service - Builds and install new kmods from akmod packages.
```

For the time being, you can disable that service as the nvidia is already built correctly.

Also, journalctl -u akmods.service indicates a steady increase in the duration required to start akmods.service. Is that normal?

journalctl -u akmods.service

Upon inspecting journalctl, the user session thing only appeared when I forcibly rebuilt the kernel

There are further logs in /var/log/akmods, and also individual build logs in /var/cache/akmods/*/*. In /var/cache/akmods/*/* there should only be build logs for the current installed kernel.

If the module was previously installed then the command should be
sudo akmods --force --rebuild to remove the earlier modules and build it completely new.

You also can import the key into bios by following the instructions shown in the file
/usr/share/doc/akmods/README.secureboot
or on the rpmfusion page Howto/Secure Boot - RPM Fusion

these are the log files. They do not seem to show any failures

No, but the timestamps are interesting.

  • Checking if the module is already built from 16:09:13 to 16:14:52
  • Running the build process from 16:14:52 to 16:14:52
  • Installing the built rpm from 16:14:52 to 16:21:42

Sometimes rebuilding the rpm data base can help when the rpm and dnf commands gets a bit slow. You can do that using sudo rpm --rebuilddb. Unfortunately, there seems not to be a rebuild command for the dnf database, but the conversion from dnf4 to dnf5 basically created the database from scratch.

But on my computer, I have disabled secure boot.

You can also use lsmod to prove beyond any doubt that the nvidia modules have been generated and also loaded as a module.

nvidia_drm            147456  2
nvidia_modeset       1671168  1 nvidia_drm
nvidia_uvm           3989504  2
nvidia              77516800  11 nvidia_uvm,nvidia_modeset
drm_ttm_helper         16384  1 nvidia_drm
video                  81920  4 dell_wmi,dell_laptop,i915,nvidia_modeset

This is the output of lsmod.
In sudo journalctl -b | grep -i nvidia , we get the following:

Feb 14 21:31:29 fedora kernel: nvidia: loading out-of-tree module taints kernel.
Feb 14 21:31:29 fedora kernel: nvidia: module license 'NVIDIA' taints kernel.
Feb 14 21:31:29 fedora kernel: nvidia: module verification failed: signature and/or required key missing - tainting kernel
Feb 14 21:31:29 fedora kernel: nvidia: module license taints kernel.
Feb 14 21:31:29 fedora kernel: nvidia-nvlink: Nvlink Core is being initialized, major device number 234
Feb 14 21:31:29 fedora kernel: nvidia 0000:02:00.0: enabling device (0000 -> 0003)
Feb 14 21:31:29 fedora kernel: NVRM: loading NVIDIA UNIX x86_64 Kernel Module  565.77  Wed Nov 27 23:33:08 UTC 2024
Feb 14 21:31:29 fedora kernel: nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint.
Feb 14 21:31:29 fedora kernel: nvidia-uvm: Loaded the UVM driver, major device number 510.
Feb 14 21:31:29 fedora kernel: nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  565.77  Wed Nov 27 22:53:48 UTC 2024
Feb 14 21:31:29 fedora kernel: [drm] [nvidia-drm] [GPU ID 0x00000200] Loading driver
Feb 14 21:31:29 fedora kernel: [drm] Initialized nvidia-drm 0.0.0 for 0000:02:00.0 on minor 0
Feb 14 21:31:29 fedora kernel: nvidia 0000:02:00.0: [drm] No compatible format found
Feb 14 21:31:29 fedora kernel: nvidia 0000:02:00.0: [drm] Cannot find any crtc or sizes
Feb 14 21:31:34 fedora systemd[1]: nvidia-fallback.service - Fallback to nouveau as nvidia did not load was skipped because of an unmet condition check (ConditionPathExists=!/sys/module/nvidia).
Feb 14 21:31:34 fedora systemd[1]: Started nvidia-powerd.service - nvidia-powerd service.
Feb 14 21:31:34 fedora audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nvidia-powerd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Feb 14 21:31:35 fedora /usr/bin/nvidia-powerd[1271]: nvidia-powerd version:1.0(build 1)
Feb 14 21:31:35 fedora /usr/bin/nvidia-powerd[1271]: SBIOS support not found for NVPCF GET_SUPPORTED function
Feb 14 21:31:35 fedora /usr/bin/nvidia-powerd[1271]: No matching GPU found
Feb 14 21:31:35 fedora /usr/bin/nvidia-powerd[1271]: Failed to initialize Dynamic Boost
Feb 14 21:31:35 fedora /usr/bin/nvidia-powerd[1271]: Failed to detach GPU id 512
Feb 14 21:31:35 fedora /usr/bin/nvidia-powerd[1271]: Failed to initialize Dynamic Boost
Feb 14 21:31:35 fedora /usr/bin/nvidia-powerd[1271]: Failed to detach GPU id 512
Feb 14 21:31:35 fedora systemd[1]: nvidia-powerd.service: Deactivated successfully.
Feb 14 21:31:35 fedora audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=nvidia-powerd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
Feb 14 21:36:45 fedora systemd[1492]: Starting app-nvidia\x2dsettings\x2duser@autostart.service - nvidia-settings...
Feb 14 21:36:45 fedora systemd[1492]: Started app-nvidia\x2dsettings\x2duser@autostart.service - nvidia-settings.

More specifically:

Feb 14 21:31:29 fedora kernel: nvidia-uvm: Loaded the UVM driver, major device number 510.
Feb 14 21:31:29 fedora kernel: nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  565.77  Wed Nov 27 22:53:48 UTC 2024
Feb 14 21:31:29 fedora kernel: [drm] [nvidia-drm] [GPU ID 0x00000200] Loading driver
Feb 14 21:31:29 fedora kernel: [drm] Initialized nvidia-drm 0.0.0 for 0000:02:00.0 on minor 0
Feb 14 21:31:29 fedora kernel: nvidia 0000:02:00.0: [drm] No compatible format found
Feb 14 21:31:29 fedora kernel: nvidia 0000:02:00.0: [drm] Cannot find any crtc or sizes
Feb 14 21:31:34 fedora systemd[1]: nvidia-fallback.service - Fallback to nouveau as nvidia did not load was skipped because of an unmet condition check (ConditionPathExists=!/sys/module/nvidia).