I recently replaced my old Nvidia graphics card with a newer one.
Upon booting up, I ran
glxgears to test that 3D graphics
were working properly and got an error like
X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 155 (NV-GLX) Minor opcode of failed request: 4 () Resource id in failed request: 0x1200003 Serial number of failed request: 34 Current serial number in output stream: 34
/etc/X11/xorg.conf or edit it and remove (or
comment out) the
"Files" section; that is, the lines
Section "Files" ... EndSection
Doing a search on the error message, I found suggestions that this was a sign the Nvidia driver installation was corrupted and a reinstall might fix it. Other posts pointed me at the Xorg logs.
Looking at the Xorg log file in
I found messages like
(II) LoadModule: "glx" (II) Loading /usr/lib/xorg/modules/extensions/libglx.so (II) Module glx: vendor="X.Org Foundation" (II) Loading extension GLX ... (EE) NVIDIA(0): Failed to initialize the GLX module; please check in your X (EE) NVIDIA(0): log file that the GLX module has been loaded in your X (EE) NVIDIA(0): server, and that the module is the NVIDIA GLX module.
indicating the wrong
libglx.so was being loaded.
This leads to the question of which
libglx.so should be loaded.
$ locate libglx.so /etc/alternatives/glx--linux-libglx.so /etc/alternatives/nvidia--libglx.so /usr/lib/nvidia/current/libglx.so /usr/lib/nvidia/current/libglx.so.390.87 /usr/lib/nvidia/libglx.so /usr/lib/xorg/modules/extensions/libglx.so /usr/lib/xorg/modules/linux/libglx.so
whichpkg sub-command found
$ wajig whichpkg libglx.so INSTALLED MATCHES (x3) ---------------------- xserver-xorg-video-nvidia: /usr/lib/nvidia/current/libglx.so xserver-xorg-video-nvidia: /usr/lib/nvidia/current/libglx.so.390.87 xserver-xorg-core: /usr/lib/xorg/modules/extensions/libglx.so
libglx.so is the one from the Nvidia-related package
xserver-xorg-video-nvidia), not the general Xorg package
xserver-xorg-core), which suggests that
is not actually where Xorg should be looking for modules (at least not
as the first choice).
/usr/lib/xorg/modules/linux/libglx.so isn't an installed file?
/usr/lib/xorg/modules/linux/libglx.so is not actually listed
wajig whichpkg. Looking at that file reveals that it's
a symbolic link:
$ ll /usr/lib/xorg/modules/linux/ total 0 lrwxrwxrwx 1 root root 38 Jan 26 2018 libglx.so -> /etc/alternatives/glx--linux-libglx.so
As the correct
libglx.so to use depends on the system setup, Debian's
alteratives system is used to select which one to use.
A quick check in the
/etc/alternatives directory shows that is indeed
pointing at an Nvidia-related file as expected.
$ ll /etc/alternatives | grep glx--linux-libglx.so lrwxrwxrwx 1 root root 25 Oct 17 20:05 glx--linux-libglx.so -> /usr/lib/nvidia/libglx.so
We also could have used
readlink to skip to the final
target of the chain of links:
$ readlink -f /usr/lib/xorg/modules/linux/libglx.so /usr/lib/nvidia/current/libglx.so.390.87
Looking in more detail at
/var/log/Xorg.0.log, I noticed the line
(==) ModulePath set to "/usr/lib/xorg/modules"
To help interpret this line, looking toward the top of the log is the legend for the prefixes of the lines in this log:
Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) means it's the default setting. Looking at my
xorg.conf, I found
Section "Files" EndSection
Given that Debian intentionally put
/usr/lib/xorg/modules/linux/—and that was not getting included in the
ModulePath list—I figured that empty
"Files" section was overridding
a settings file from Debian. Indeed, after removing it,
Xorg.0.log contained the line
(**) ModulePath set to "/usr/lib/xorg/modules/linux,/usr/lib/xorg/modules"
indicating that path was now being correctly included in
(**) indicates that it's from a config file.
Why did that work?
Looking further, the log file contains the information on the config files it uses:
(==) Using config file: "/etc/X11/xorg.conf" (==) Using config directory: "/etc/X11/xorg.conf.d" (==) Using system config directory "/usr/share/X11/xorg.conf.d"
/usr/share/X11/xorg.conf.d/, the file
Section "Files" ModulePath "/usr/lib/xorg/modules/linux" ModulePath "/usr/lib/xorg/modules" EndSection
which is apparently where
ModulePath is supposed to be set.