Trying to setup the nvidia pacman hook for zen kernel, did I do it right?

I’m troubleshooting some old issues and taking notes here :smiley: I lost my original notes file, and have an older backup which is full of lies, apparently! I took this note taking habbit to another level by writing them down in a local jekyll website in markdown!

So I’m using nvidia card, zen kernel, and I got it installed/configured like so:



sudo pacman -S linux-zen linux-zen-headers nvidia nvidia-libgl nvidia-dkms

sudo pacman -S lib32-nvidia-utils lib32-nvidia-libgl lib32-mesa-demos libva-vdpau-driver

sudo nano boot/loader/entries/arch.conf

title   Arch Linux ## Adding this seemed to add a new entry on boot?
linux   /vmlinuz-linux-zen
initrd  /initramfs-linux-zen.img
options root=/dev/sda2 nvidia-drm.modeset=1

sudo nano /etc/mkinitcpio.conf

# vim:set ft=sh
# MODULES
# The following modules are loaded before any boot hooks are
# run.  Advanced users may wish to specify all system modules
# in this array.  For instance:
#     MODULES=(piix ide_disk reiserfs)
modules (nvidia nvidia_modeset nvidia_uvm nvidia_drm)
# Don't think anything is missing!

And finally here is my OLD nvidia pacman hook file

Possible problem: I used this blatant copy-paste from wiki, with Zen kernel for some time. What I mean the Target= fields say nvidia and linux - but actually I am trying to use nvidia-dkms & linux-zen right?

Could running this pacman hook like I did, cause any potential problems? Other than getting nothing out of this config cause they are targeting the wrong stuff, which I am not using.

nano /etc/pacman.d/hooks/nvidia.hook

[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia
Target=linux
# Change the linux part above and in the Exec line if a different kernel is used

[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P'

I googled about it, and I found that you might want to change those Target= fields xD this is the new config:

sudo nano /etc/pacman.d/hooks/nvidia.hook

[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia-dkms
Target=linux-zen
# Change the linux part above and in the Exec line if a different kernel is used

[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P'

Is this the right way of including this pacman hook? :smiley:

Thanks!

Disclaimer: I wouldn’t use NVIDIA if they paid me so I don’t have any personal experience of this but…

The ArchWiki seems to suggest that the nvidia-dkms hook is only needed for custom kernels so I think just changing linux to linux-zen should be enough. I might be wrong though.

The hook is only used for early loading of the driver anyway, which isn’t really necessary.

3 Likes

The right way is to capitalize:
MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

3 Likes