How to read Arch Wiki?

I started one topic about Nvidia but it seems that I should learn how to read Arch Wiki.
I’ll try not to do too long topic but I would like to start with:

Custom kernel

If you are using a custom kernel, compilation of the Nvidia kernel modules can be automated with DKMS.

Install the nvidia-dkms package (or a specific branch). The Nvidia module will be rebuilt after every Nvidia or kernel update thanks to the DKMS pacman hook.

DRM kernel mode setting

nvidia 364.16 adds support for DRM (Direct Rendering Manager) kernel mode setting. To enable this feature, add the nvidia-drm.modeset=1 kernel parameter. For basic functionality that should suffice, if you want to ensure it’s loaded at the earliest possible occasion, or are noticing startup issues you can add nvidia , nvidia_modeset , nvidia_uvm and nvidia_drm to the initramfs according to Mkinitcpio#MODULES.

If added to the initramfs do not forget to run mkinitcpio every time there is a nvidia driver update. See #Pacman hook to automate these steps.

  1. Custom kernel and DRM kernel mode settings are not connected right?
    I can do one or another or both. I don’t need to do DRM kernel mode setting if I install Custom kernel?

  2. To enable DRM with nvidia-drm.modeset=1
    I need to edit /etc/default/grub
    And change cmdline to tool like this:
    GRUB_CMDLINE_LINUX_DEFAULT="nvidia-drm.modeset=1"
    add

  3. I can finish at this point but I can
    I can but not have to?
    add nvidia , nvidia_modeset , nvidia_uvm and nvidia_drm modules to my mkinitcpio.conf file and it should look like this:
    MODULES=( nvidia nvidia_modeset nvidia_uvm nvidia_drm)

  4. I don’t understand if it is:

  • only 2 or only 3
  • it can be just 2 or just 3
  • if I want 3 I have to do 2 first
  1. If I add modeulse like in point 3 then I’ll have to run mkinitcpio -P with every Nvidia update manually or
    In /etc/pacman.d/hooks/ I can create nvidia.hook with:
    [Trigger]
    Operation=Install
    Operation=Upgrade
    Operation=Remove
    Type=Package
    Target=nvidia
    Target=linux

    [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’

And change linux for linux-zen or any other kernel I have

I believe that I get it quite right but I’m not sure about points 3 and 4

Yes, you do need to enable DRM, even with a custom kernel.

You do not have to add those hooks to /etc/mkinitcpio.conf if you load those modules by way of files under /etc/modprobe.d/.

Correct.

Could you please tell me how to do this?
It’s probably here:
https://wiki.archlinux.org/index.php/Mkinitcpio#MODULES
But I don’t understand this.

Your mkinitcpio.conf contains the following, near the top… :arrow_down:

# 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=()

So, put the list of modules in between the two elipses on that last line, separated by a space. :arrow_down:

MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm)

But this is exactly what I said.

Isn’t it?

And you said:

So I thought that I need to create some config files or symlinks in /etc/modprobe.d/

You do not need to create anything under /etc/modprobe.d/ if you add the modules to /etc/mkinitcpio.conf and rebuild your initramfs.

It’s an either/or situation. They are two different methods for doing the same thing.

1 Like

Ok thank you.
And in wiki there is:

  1. To enable DRM with nvidia-drm.modeset=1
    I need to edit /etc/default/grub
    And change cmdline to tool like this:
    GRUB_CMDLINE_LINUX_DEFAULT=“nvidia-drm.modeset=1”

And wiki says:

For basic functionality that should suffice, if you want to ensure it’s loaded at the earliest possible occasion, or are noticing startup issues you can add nvidia , nvidia_modeset , nvidia_uvm and nvidia_drm to the initramfs according to Mkinitcpio#MODULES.

Is that men that I should have enabled (in grub config) nvidia-drm.modeset=1 and add modules to mkinitcpio.conf
or I should delete nvidia-drm.modeset=1 from grub and add those modules?

No, leave it in your /etc/default/grub.

1 Like

There is:

To avoid the possibility of forgetting to update initramfs after an NVIDIA driver upgrade, you may want to use a pacman hook:

And hook sample looks like this:

[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’

If I have two kernels (mainline and zen) do I need two hooks for both kernels?

:arrow_down:

Target=nvidia
Target=linux
Target=linux-zen
1 Like

I checked with: mkinitcpio -v
At the end of an output there is:
==> ERROR: module not found: nvidia' ==> ERROR: module not found: nvidia_modeset’
adding module: nvidia-uvm (/lib/modules/5.9.6-arch1-1/kernel/drivers/video/nvidia-uvm.ko.xz)
==> ERROR: module not found: nvidia' ==> ERROR: module not found: nvidia_drm’

I have nvidia-dkms currently installed. I did as mentioned above
Modules(nvidia …)

You have to specify the path to the files. See the Wiki page.

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'

adding a line with Target=linux-zen is quite understandable.
But it should be changed in Exec to.
If I would have to guess
Exec=/bin/sh -c 'while read -r trg; do case $trg in linux or linux-zen) exit 0; esac; done; /usr/bin/mkinitcpio -P'

[quote=“Aragorn, post:12, topic:36630, full:true”]
You have to specify the path to the files. See the Wiki page.
[/quote]>

BINARIES and FILES

These options allow users to add files to the image. Both BINARIES and FILES are added before hooks are run, and may be used to override files used or provided by a hook. BINARIES are auto-located within a standard PATH and are dependency-parsed, meaning any required libraries will also be added. FILES are added as-is . For example:

FILES=(/etc/modprobe.d/modprobe.conf)
This page?
And I should know where those files are?

I tried with locate but have no idea which files should I use

That is syntactically not correct. Below is the corrected version.

Exec=/bin/sh -c 'while read -r trg; do case $trg in linux | linux-zen) exit 0; esac; done; /usr/bin/mkinitcpio -P'

Well, then I can’t help you, because I don’t have any Nvidia hardware in this machine. :man_shrugging:

Note: The complication in the Exec line above is in order to avoid running mkinitcpio multiple times if both nvidia and linux get updated. In case this doesn’t bother you, the Target=linux and NeedsTargets lines may be dropped, and the Exec line may be reduced to simply Exec=/usr/bin/mkinitcpio -P .

I read this just a second ago. My fault.
So I can just create file:

[Trigger]
Operation=Install
Operation=Upgrade
Operation=Remove
Type=Package
Target=nvidia
Target=linux
Target=linux-zen

[Action]
Description=Update Nvidia module in initcpio
Depends=mkinitcpio
When=PostTransaction
NeedsTargets
Exec=/usr/bin/mkinitcpio -P

Yes. :slight_smile:

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.