Arch Linux: NVIDIA driver installation for GeForce GTX 1050 Ti

By | 03/25/2019
 

The main goal when I was buying a new PC with NVIDIA GeForce GTX 1050 Ti was an ability to play games on Arch Linux without reboots into Windows.

For this need to install NVIDIA drivers so Linux will use it instead of nouveau (although I didn’t even try to run any game with nouveau).

After a couple of my attempts to install NVIDIA drivers on my laptop a few years ago, I expected issues here as well and was ready for long and deep dive into X.Org configs and logs. Suddenly, everything went almost without problems – the only one I faced with was caused by my own mistake, see about it below.

Documentation is here>>>.

NVIDIA driver installation – attempt #1 (wrong)

Find a video card and a driver used now::

[setevoy@setevoy-arch-pc ~]$ lspci -k | grep -A 2 -E "(VGA|3D)"
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)
Subsystem: ASUSTeK Computer Inc. GP107 [GeForce GTX 1050 Ti]
Kernel driver in use: nouveau

Check old cards list here тут>>>.

Actually, the only issue was caused by the fact that I was tempted by the “lts” postfix in the nvidia-lts package name.

Install it (no):

[setevoy@setevoy-arch-pc .config]$ sudo pacman -S nvidia-lts

Reboot PC and absolutely expected for me as I was waiting for problems – Openbox won’t start.

Check the driver used now:

[setevoy@setevoy-arch-pc ~]$ lspci -k | grep -A 2 -E "(VGA|3D)"
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)
Subsystem: ASUSTeK Computer Inc. GP107 [GeForce GTX 1050 Ti]
Kernel modules: nouveau

Kernel modules: nouveau

Ummm…

And X.Org log /var/log/Xorg.0.log:

...
[    32.079] (==) Matched nouveau as autoconfigured driver 0
[    32.079] (==) Matched nv as autoconfigured driver 1
[    32.079] (==) Matched modesetting as autoconfigured driver 2
[    32.079] (==) Matched fbdev as autoconfigured driver 3
[    32.079] (==) Matched vesa as autoconfigured driver 4
[    32.079] (==) Assigned the driver to the xf86ConfigLayout
[    32.079] (II) LoadModule: "nouveau"
[    32.107] (WW) Warning, couldn't open module nouveau
[    32.107] (EE) Failed to load module "nouveau" (module does not exist, 0)
[    32.107] (II) LoadModule: "nv"
[    32.107] (WW) Warning, couldn't open module nv
[    32.107] (EE) Failed to load module "nv" (module does not exist, 0)
[    32.107] (II) LoadModule: "modesetting"
[    32.107] (II) Loading /usr/lib/xorg/modules/drivers/modesetting_drv.so
[    32.123] (II) Module modesetting: vendor="X.Org Foundation"
[    32.123]    compiled for 1.20.3, module version = 1.20.3
[    32.123]    Module class: X.Org Video Driver
[    32.123]    ABI class: X.Org Video Driver, version 24.0
[    32.123] (II) LoadModule: "fbdev"
[    32.123] (WW) Warning, couldn't open module fbdev
[    32.123] (EE) Failed to load module "fbdev" (module does not exist, 0)
[    32.123] (II) LoadModule: "vesa"
[    32.123] (WW) Warning, couldn't open module vesa
[    32.123] (EE) Failed to load module "vesa" (module does not exist, 0)
[    32.123] (II) modesetting: Driver for Modesetting Kernel Drivers: kms
[    32.123] (EE) open /dev/dri/card0: No such file or directory
[    32.123] (WW) Falling back to old probe method for modesetting
[    32.123] (EE) open /dev/dri/card0: No such file or directory
[    32.123] (EE) Screen 0 deleted because of no matching config section.
[    32.123] (II) UnloadModule: "modesetting"
[    32.123] (EE) Device(s) detected, but none match those in the config file.
[    32.123] (EE)
Fatal server error:
[    32.123] (EE) no screens found(EE)
...

Okay… Google? 🙂

Found this>>> discussion – let’s try.

Need to update initramfs as mentioned here>>> and here>>>.

Edit the /etc/mkinitcpio.conf, add modules there:

...
MODULES=(nouveau, nv)
...

Build a new kernel with a custom name to not overwrite the existing one:

[root@setevoy-arch-pc setevoy]# mkinitcpio -g /boot/linux-nv.img
==> Starting build: 4.20.11-arch2-1-ARCH
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [autodetect]
-> Running build hook: [keyboard]
-> Running build hook: [keymap]
-> Running build hook: [modconf]
-> Running build hook: [block]
-> Running build hook: [lvm2]
-> Running build hook: [filesystems]
-> Running build hook: [fsck]
==> ERROR: module not found: `nouveau,'
==> ERROR: module not found: `nv'
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/linux-nv.img
==> WARNING: errors were encountered during the build. The image may not be complete.

Well… There is something wrong with this solution and as  I did it in the evening – didn’t want to waste time looking for reasons and/or correct modules names.

NVIDIA driver installation – attempt #2 (correct)

Check NVIDIA-related packages installed now and pay attention to descriptions:

[root@setevoy-arch-pc setevoy]# pacman -Qs nvidia
local/libvdpau 1.1.1+3+ga21bf7a-1
Nvidia VDPAU library
local/nvidia-lts 1:418.43-1
NVIDIA drivers for linux-lts
local/nvidia-utils 418.43-2
NVIDIA drivers utilities

NVIDIA drivers for linux-lts

And here I got my mistake: the kernel’s package linux-lts != linux and respectively nvidia-lts != nvidia and isn’t driver version with  Long term Support but just driver for another kernel’s version.

Remove this driver:

[setevoy@setevoy-arch-pc ~]$ sudo pacman -Rsn nvidia-lts

Install the common nvidia package:

[setevoy@setevoy-arch-pc ~]$ sudo pacman -S nvidia

Reboot PC one more time and check the driver used now:

[setevoy@setevoy-arch-pc ~]$ lspci -k | grep -A 2 -E "(VGA|3D)"
01:00.0 VGA compatible controller: NVIDIA Corporation GP107 [GeForce GTX 1050 Ti] (rev a1)
Subsystem: ASUSTeK Computer Inc. GP107 [GeForce GTX 1050 Ti]
Kernel driver in use: nvidia

Kernel driver in use: nvidia

Okay.

Monitors configuration

The last thing to do now is to update my monitors’ settings.

With the nouveau they had names:

[setevoy@setevoy-arch-pc ~]$ cat .config/openbox/autostart
xrandr --output HDMI-1 --primary
xrandr --output HDMI-1 --left-of DVI-D-1

But now:

[setevoy@setevoy-arch-pc .config]$ xrandr --listmonitors
Monitors: 2
0: +DVI-D-0 1920/530x1080/300+0+0  DVI-D-0
1: +HDMI-0 1920/531x1080/299+1920+0  HDMI-0

Update Openbox’s config and set them with the new names:

[setevoy@setevoy-arch-pc ~]$ cat .config/openbox/autostart
nouveau
xrandr --output HDMI-1 --primary
xrandr --output HDMI-1 --left-of DVI-D-1
nvidia
xrandr --output HDMI-0 --primary
xrandr --output HDMI-0 --left-of DVI-D-0
tools
setxkbmap -layout us,ru -option grp:lctrl_lshift_toggle,grp_led:scroll -variant winkeys &
volumeicon &
qxkb &

In fact, better to do it with the udev rules – but still can’t find to realize it.

Done.