[solved] Nvidia driver is not loading on first login, I have to relog every time to get it to load

Hello :slight_smile:

This has been bugging me for awhile. When I reboot the machine, and login via LightDM the nvidia driver doesn’t seem to be active. Then I have to log out and log back in again.

I can notice this if booting VMware or when I play NWN:EE (the game is maybe 5fps) but once I log out & back in, everything is fine. Is there any way I can solve this issue? I have also done this (not sure it helps) sudo systemctl enable nvidia-persistenced.service but no help.

This is what is loaded after a system reboot:

user@universe: glxinfo|egrep "OpenGL vendor|OpenGL renderer*"
OpenGL vendor string: VMware, Inc.
OpenGL renderer string: llvmpipe (LLVM 9.0.1, 128 bits)

After simple relog:

user@universe: glxinfo|egrep "OpenGL vendor|OpenGL renderer*"
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce GTX 1070/PCIe/SSE2

//Edit: if anyone stumbling here from the future, scroll a bit down!

Try enabling KMS.

1 Like

It’s enabled & started by default when using Nvidia driver.
Did you install nvidia-settings too?

"I realised that this didn’t turn off secure boot and you have to use the dialog and enter your password in order to disable it. So I did.

A final reboot and everything worked!"

Have you tried disabling secure boot as well?

Thanks for the help and replies!

@ColsonP2 My secure boot was already disabled (for a long time) even during arch install
@archus I already had nvidia-settings installed

@Head_on_a_Stick Thank you! You guided me on the right direction :slight_smile: the problem is solved now and I am happy, but I don’t know exactly why it is solved now! Below is precisely all what I did.



EDIT: Adding this IS recommended!
I added nvidia modules into mkinitcpio.conf

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)

EDIT2: Adding this is also recommended!
Added the kernel mode setting (KMS - thanks @Head_on_a_Stick)
sudo nano /boot/loader/entries/arch.conf

option root=/dev/sda2 nvidia-drm.modeset=1

EDIT3: This step is still recommended from ArchWiki if you are running an nvidia card
Added the Pacman hook: https://wiki.archlinux.org/index.php/NVIDIA#Pacman_hook then I ran sudo pacman -Syu and it did more things which updating normally doesn’t do.

sudo 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'

EDIT: I edited my post, because what I first wrote was very mysterious that these points didn’t help at first. And originally left I look like only this pacman hook solved the problem, the problem came back now almost 5-7 days later. Now I added the modules, and kernel parameter in addition to using this pacman hook.

As of writing this, the problem seems to be solved again after applying the first 2 points.

Ok fine, if you make any changes with nvidia-settings and want to load them at startup, put this line in your .xinitrc or .profile if you use those.

nvidia-settings -l &

This will read your .nvidia-settings-rc file. :wink: Glad you managed good :+1:

1 Like