Are we supposed to execute reinstall-kernels after installing nvidia drivers for the first time?

I am on a brand new install of EndeavourOS, running with the systemd-boot bootloader

So the issue I was seeing was that gamescope was not spawning an X11 window

I installed nvidia drivers with: nvidia-inst --32 --conf

I saw that nvidia-inst was going to add nvidia-drm.modeset=1 to /etc/kernel/cmdline for me, this kernel parameter is a requirement for gamescope to function properly.

When I saw that gamescope was not working, on a hunch I just executed sudo reinstall-kernels I found this by looking up the new documentation (suspecting that perhaps kernel parameter was not loaded properly) and sure enough it worked

I feel like this should have been in the release notes. or… did I encounter a bug with nvidia-inst? Should nvidia-inst have executed reinstall-kernels for me?

Edit: the docs I was referring to: https://discovery.endeavouros.com/installation/systemd-boot/2022/12/

1 Like

I do not know if there is a bug or documentation problem about this

Should nvidia-inst have executed reinstall-kernels for me?

but yes, you are supposed to run reinstall-kernels after changing cmdline so good suspicion :slightly_smiling_face:

I think it is. :thinking:

sudo reinstall-kernels

We have package nvidia-hook that runs reinstall-kernels if package kernel-install-for-dracut is installed.
It runs when an nvidia driver, e.g. nvidia-dkms package is installed, updated, or removed.

I definitely have nvidia-hook installed:

$ pacman -Q | grep nvidia
lib32-nvidia-utils 525.60.11-1
nvidia-dkms 525.60.11-1
nvidia-hook 1.1-1
nvidia-inst 1.8-1
nvidia-installer-common 1.7-2
nvidia-settings 525.60.11-2
nvidia-utils 525.60.11-1

$ pacman -Q | grep kernel-install-for-dracut
kernel-install-for-dracut 1.6-1

I do not want to reinstall my system again, I do have a spare system I could try to replicate this on and see if I can reproduce it and report back later, but I’m not sure it is working. Am curious to hear if others have run into a similar issue.

I found the script you were referring to, I tested it out and it should have worked:

/etc/pacman.d $ cat /usr/share/libalpm/hooks/eos-nvidia-fix.hook 
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = nvidia-dkms
Target = nvidia
Target = nvidia-lts

[Action]
Depends = mkinitcpio
When = PostTransaction
Exec = /usr/bin/eos-nvidia-fix

/etc/pacman.d $ cat /usr/bin/eos-nvidia-fix
#!/bin/bash

Main() {
    local installed="$(pacman -Qq kernel-install-for-dracut eos-dracut mkinitcpio 2>/dev/null)"

    if [[ "$installed" =~ kernel-install-for-dracut ]] ; then
        reinstall-kernels
    elif [[ "$installed" =~ eos-dracut ]] ; then
        dracut-rebuild
    elif [[ "$installed" =~ mkinitcpio ]] ; then
        mkinitcpio -P
    else
        local progname="$(basename "$0")"
        echo "warning: $progname: cannot perform requested operation because required package(s) are missing."
    fi
}

Main "$@"

Edit: After reading through this the only glaring issue in the hook file is: Depends = mkinitcpio
That’s the thing, mkinitcpio is not installed anymore by default with systemd-boot, so it might make sense why the hook never executed… right?

1 Like

Nice catch! That sounds like the problem.
This was changed very recently, and looks like this went unnoticed.
If you simply remove that line, does it work better?

i have not had a chance to try this, please give me a few hours, I will get back to you

My apologies got a bit busy with work, I see that a new update was pushed out sometime today and has corrected the hook

1 Like

Thanks for testing and reporting! :+1:

I’m running systemd-boot, dracut
I updated my system, and nvidia-dkms got updated but the kernel did not rebuild! so I got an api mismatch when rebooted and no nvidia!

journalctl relevant log
...
ene 22 20:41:22 think kernel: NVRM: API mismatch: the client has the version 525.85.05, but
                              NVRM: this kernel module has the version 525.78.01.  Please
                              NVRM: make sure that this kernel module and all NVIDIA driver
                              NVRM: components have the same version.
...
pacman.log
...
[2023-01-20T17:59:39-0300] [ALPM] running '20-systemd-sysusers.hook'...
[2023-01-20T17:59:39-0300] [ALPM] running '30-systemd-daemon-reload.hook'...
[2023-01-20T17:59:40-0300] [ALPM] running '30-systemd-sysctl.hook'...
[2023-01-20T17:59:40-0300] [ALPM] running '30-systemd-tmpfiles.hook'...
[2023-01-20T17:59:40-0300] [ALPM] running '30-systemd-udev-reload.hook'...
[2023-01-20T17:59:40-0300] [ALPM] running '30-systemd-update.hook'...
[2023-01-20T17:59:40-0300] [ALPM] running '30-update-mime-database.hook'...
[2023-01-20T17:59:40-0300] [ALPM] running '70-dkms-install.hook'...
[2023-01-20T17:59:40-0300] [ALPM-SCRIPTLET] ==> dkms install --no-depmod nvidia/525.85.05 -k 6.1.7-1-cachyos
[2023-01-20T18:00:53-0300] [ALPM-SCRIPTLET] ==> depmod 6.1.7-1-cachyos
[2023-01-20T18:00:54-0300] [ALPM] running 'dbus-reload.hook'...
[2023-01-20T18:00:54-0300] [ALPM] running 'eos-reboot-required.hook'...
[2023-01-20T18:00:54-0300] [ALPM-SCRIPTLET] ==> INFO: Reboot is recommended due to the upgrade of core system package(s).
...