My system randomly logs me out: turns out it's graphics card drivers! Don't know how to stop it

I would be doing something on my system and then suddenly I am logged out and presented with the login screen.

$ inxi -F                                                                                                                                                                       ✔ 
System:
  Host: pc0 Kernel: 6.3.9-arch1-1 arch: x86_64 bits: 64 Desktop: herbstluftwm
    v: 0.9.5 Distro: EndeavourOS
Machine:
  Type: Desktop Mobo: N/A model: N/A serial: <superuser required>
    BIOS: American Megatrends v: 080015 date: 11/07/2013
CPU:
  Info: dual core model: Intel Core2 Duo E7400 bits: 64 type: MCP cache:
    L2: 3 MiB
  Speed (MHz): avg: 2721 min/max: N/A cores: 1: 2659 2: 2784
Graphics:
  Device-1: NVIDIA GK208B [GeForce GT 710] driver: nouveau v: kernel
  Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.2 driver: X:
    loaded: nouveau unloaded: modesetting,vesa dri: nouveau gpu: nouveau
    resolution: 1920x1080~60Hz
  API: OpenGL v: 4.3 Mesa 23.1.3 renderer: NV106
Audio:
  Device-1: Intel NM10/ICH7 Family High Definition Audio driver: snd_hda_intel
  Device-2: NVIDIA GK208 HDMI/DP Audio driver: snd_hda_intel
  API: ALSA v: k6.3.9-arch1-1 status: kernel-api
  Server-1: PipeWire v: 0.3.72 status: active
Network:
  Device-1: Realtek RTL810xE PCI Express Fast Ethernet driver: r8169
  IF: ens32 state: up speed: 100 Mbps duplex: full mac: <mac>
Drives:
  Local Storage: total: 2.22 TiB used: 1.25 TiB (56.3%)
  ID-1: /dev/sda vendor: A-Data model: SP550 size: 111.79 GiB
  ID-2: /dev/sdb vendor: Seagate model: ST2000DM006-2DM164 size: 1.82 TiB
  ID-3: /dev/sdc vendor: Western Digital model: WD3200AAJS-22L7A0
    size: 298.09 GiB
Partition:
  ID-1: / size: 52.73 GiB used: 27.27 GiB (51.7%) fs: btrfs dev: /dev/sda4
  ID-2: /home size: 52.73 GiB used: 27.27 GiB (51.7%) fs: btrfs
    dev: /dev/sda4
  ID-3: /var/log size: 52.73 GiB used: 27.27 GiB (51.7%) fs: btrfs
    dev: /dev/sda4
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 43.0 C mobo: N/A gpu: nouveau temp: 51.0 C
  Fan Speeds (RPM): N/A gpu: nouveau fan: 2940
Info:
  Processes: 231 Uptime: 6m Memory: available: 3.4 GiB used: 1.52 GiB (44.6%)
  Shell: fish inxi: 3.3.27

My herbstluftwm config:

$ cat .config/herbstluftwm/autostart

#!/usr/bin/env bash

# this is a simple config for herbstluftwm

hc() {
    herbstclient "$@"
}

hc emit_hook reload

# xsetroot -solid '#5A8E3A'

# start up


# notifications
# dbus-launch dunst --config ~/.config/dunst/dunstrc &

# remove all existing keybindings
hc keyunbind --all

# keybindings
# if you have a super key you will be much happier with Mod set to Mod4
#Mod=Mod1    # Use alt as the main modifier
Mod=Mod4   # Use the super key as the main modifier

# prevent accidental killing for wm
# hc keybind $Mod-Shift-Alt-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-Shift-c close

# terminal
hc keybind $Mod-Return spawn kitty

# alternate terminal
hc keybind $Mod-Alt-Return spawn xfce4-terminal

# app launcher
hc keybind $Mod-Alt-l spawn rofi -modi drun -show drun -config ~/.config/rofi/rofidmenu.rasi

# power menu
hc keybind $Mod-Alt-p spawn rofi -show power-menu -modi power-menu:~/.config/rofi/rofi-power-menu

# ebook management
hc keybind $Mod-Shift-b spawn calibre
hc keybind $Mod-Alt-b spawn ebook-viewer

# calculator
hc keybind $Mod-Shift-s spawn speedcrunch

# web browser
hc keybind $Mod-Alt-i spawn chromium %U

# web browser - alternate
hc keybind $Mod-Shift-Alt-i spawn google-chrome-stable

# telegram
hc keybind $Mod-Shift-t spawn telegram-desktop

# editor
hc keybind $Mod-g spawn geany

# file explorer
hc keybind $Mod-e spawn doublecmd

# refresh wallpaper
hc keybind $Mod-Shift-w spawn feh --bg-fill --randomize ~/Pictures/walls/* &

# screenshot
hc keybind $Mod-Alt-s spawn gscreenshot -f '/home/moss/Pictures/screenshots/ss_$hx$w_%Y-%m-%d_%H-%M-%f.png'

# basic movement in tiling and floating mode
# focusing clients
hc keybind $Mod-Left  focus left
hc keybind $Mod-Down  focus down
hc keybind $Mod-Up    focus up
hc keybind $Mod-Right focus right
hc keybind $Mod-h     focus left
hc keybind $Mod-j     focus down
hc keybind $Mod-k     focus up
hc keybind $Mod-l     focus right

# moving clients in tiling and floating mode
hc keybind $Mod-Shift-Left  shift left
hc keybind $Mod-Shift-Down  shift down
hc keybind $Mod-Shift-Up    shift up
hc keybind $Mod-Shift-Right shift right
hc keybind $Mod-Shift-h     shift left
hc keybind $Mod-Shift-j     shift down
hc keybind $Mod-Shift-k     shift up
hc keybind $Mod-Shift-l     shift right

# splitting frames
# create an empty frame at the specified direction
hc keybind $Mod-u       split   bottom  0.5
hc keybind $Mod-o       split   right   0.5
# let the current frame explode into subframes
hc keybind $Mod-Control-space split explode

# resizing frames and floating clients
resizestep=0.02
hc keybind $Mod-Control-h       resize left +$resizestep
hc keybind $Mod-Control-j       resize down +$resizestep
hc keybind $Mod-Control-k       resize up +$resizestep
hc keybind $Mod-Control-l       resize right +$resizestep
hc keybind $Mod-Control-Left    resize left +$resizestep
hc keybind $Mod-Control-Down    resize down +$resizestep
hc keybind $Mod-Control-Up      resize up +$resizestep
hc keybind $Mod-Control-Right   resize right +$resizestep

# tags
tag_names=( {1..9} )
tag_keys=( {1..9} 0 )

hc rename default "${tag_names[0]}" || true
for i in "${!tag_names[@]}" ; do
    hc add "${tag_names[$i]}"
    key="${tag_keys[$i]}"
    if [ -n "$key" ] ; then
        hc keybind "$Mod-$key" use_index "$i"
        hc keybind "$Mod-Shift-$key" move_index "$i"
    fi
done

# cycle through tags
hc keybind $Mod-period use_index +1 --skip-visible
hc keybind $Mod-comma  use_index -1 --skip-visible

# layouting
hc keybind $Mod-r remove
hc keybind $Mod-s floating toggle
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-Shift-f set_attr clients.focus.floating toggle
hc keybind $Mod-Shift-d set_attr clients.focus.decorated toggle
hc keybind $Mod-Shift-m set_attr clients.focus.minimized true
hc keybind $Mod-Control-m jumpto last-minimized
hc keybind $Mod-p pseudotile toggle
# The following cycles through the available layouts within a frame, but skips
# layouts, if the layout change wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame, the grid layout is skipped.
hc keybind $Mod-space                                                           \
            or , and . compare tags.focus.curframe_wcount = 2                   \
                     . cycle_layout +1 vertical horizontal max vertical grid    \
               , cycle_layout +1

# mouse
hc mouseunbind --all
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize

# focus
hc keybind $Mod-BackSpace   cycle_monitor
hc keybind $Mod-Tab         cycle_all +1
hc keybind $Mod-Shift-Tab   cycle_all -1
hc keybind $Mod-c cycle
hc keybind $Mod-i jumpto urgent

# theme
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
hc set frame_border_active_color '#222222cc'
hc set frame_border_normal_color '#101010cc'
hc set frame_bg_normal_color '#565656aa'
hc set frame_bg_active_color '#345F0Caa'
hc set frame_border_width 1
hc set show_frame_decorations 'focused_if_multiple'
hc set frame_bg_transparent on
hc set frame_transparent_width 5
hc set frame_gap 1

hc attr theme.title_height 15
#hc attr theme.title_when always
hc attr theme.title_when never
hc attr theme.title_font 'Dejavu Sans:pixelsize=12'  # example using Xft
# hc attr theme.title_font '-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
hc attr theme.title_depth 3  # space below the title's baseline
hc attr theme.active.color '#345F0Cef'
hc attr theme.title_color '#ffffff'
hc attr theme.normal.color '#323232dd'
hc attr theme.urgent.color '#7811A1dd'
hc attr theme.tab_color '#1F1F1Fdd'
hc attr theme.active.tab_color '#2B4F0Add'
hc attr theme.active.tab_outer_color '#6C8257dd'
hc attr theme.active.tab_title_color '#ababab'
hc attr theme.normal.title_color '#898989'
hc attr theme.inner_width 1
hc attr theme.inner_color black
hc attr theme.border_width 3
hc attr theme.floating.border_width 4
hc attr theme.floating.outer_width 1
hc attr theme.floating.outer_color black
hc attr theme.active.inner_color '#789161'
hc attr theme.urgent.inner_color '#9A65B0'
hc attr theme.normal.inner_color '#606060'
# copy inner color to outer_color
for state in active urgent normal ; do
    hc substitute C theme.${state}.inner_color \
        attr theme.${state}.outer_color C
done
hc attr theme.tiling.outer_width 1
hc attr theme.background_color '#141414'

hc set window_gap 0
hc set frame_padding 0
hc set smart_window_surroundings off
hc set smart_frame_surroundings on
hc set mouse_recenter_gap 0

# rules
hc unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3
hc rule focus=on # normally focus new clients
hc rule floatplacement=smart
#hc rule focus=off # normally do not focus new clients
# give focus to most common terminals
#hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
hc rule fixedsize floating=on

# changes by moss START

# set layout algorithm
hc set default_frame_layout vertical

# focus follows mouse
hc attr settings.focus_follows_mouse 1

#  new windows will be placed into empty frames
hc rule index=e

# changes by moss END

# hc set tree_style '╾│ ├└╼─┐'

# unlock, just to be sure
hc unlock

# do multi monitor setup here, e.g.:
# hc set_monitors 1280x1024+0+0 1280x1024+1280+0
# or simply:
# hc detect_monitors

# find the panel
#panel=~/.config/herbstluftwm/panel.sh
#[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
#for monitor in $(hc list_monitors | cut -d: -f1) ; do
#    # start it on each monitor
#    "$panel" "$monitor" &
#done


# panel
killall -9 polybar
polybar --reload & #reloads when config is changed

# set wallpaper
feh --bg-fill --randomize ~/Pictures/walls/* &

# set numlock on
numlockx on

EDIT

It could be related to my graphics card. I am using the open source nvidia drivers, nouveau. My graphics card is GeForce GT 710.

This is the log right after I was logged out:

$ sudo journalctl -r

Aug 06 08:59:35 pc0 kernel: nouveau 0000:01:00.0: fifo: fault 01 [WRITE] at 0000000000068000 engine 03 [IFB] client 08 [HUB/HOST_CPU_NB] reason 02 [PTE] on channel 2 [007fba2000 Xorg[20352]]
Aug 06 08:59:35 pc0 lightdm[20396]: pam_unix(lightdm:session): session closed for user moss
Aug 06 08:59:34 pc0 systemd[1]: systemd-coredump@2-26359-0.service: Deactivated successfully.
Aug 06 08:59:34 pc0 systemd-coredump[26360]: [🡕] Process 20352 (Xorg) of user 0 dumped core.
                                             
                                             Stack trace of thread 20352:
                                             #0  0x00007ffb21a8a83c n/a (libc.so.6 + 0x8a83c)
                                             #1  0x00007ffb21a3a668 raise (libc.so.6 + 0x3a668)
                                             #2  0x00007ffb21a224b8 abort (libc.so.6 + 0x224b8)
                                             #3  0x000055d32fc765a0 OsAbort (Xorg + 0x1535a0)
                                             #4  0x000055d32fc77a0b FatalError (Xorg + 0x154a0b)
                                             #5  0x000055d32fc7e516 n/a (Xorg + 0x15b516)
                                             #6  0x00007ffb21a3a710 n/a (libc.so.6 + 0x3a710)
                                             #7  0x00007ffb21a8a83c n/a (libc.so.6 + 0x8a83c)
                                             #8  0x00007ffb21a3a668 raise (libc.so.6 + 0x3a668)
                                             #9  0x00007ffb21a224b8 abort (libc.so.6 + 0x224b8)
                                             #10 0x00007ffb21a223dc n/a (libc.so.6 + 0x223dc)
                                             #11 0x00007ffb21a32d26 __assert_fail (libc.so.6 + 0x32d26)
                                             #12 0x00007ffb22090b48 nouveau_pushbuf_data (libdrm_nouveau.so.2 + 0x4b48)
                                             #13 0x00007ffb22090aa7 nouveau_pushbuf_data (libdrm_nouveau.so.2 + 0x4aa7)
                                             #14 0x00007ffb22090bcd n/a (libdrm_nouveau.so.2 + 0x4bcd)
                                             #15 0x00007ffb22090e47 n/a (libdrm_nouveau.so.2 + 0x4e47)
                                             #16 0x00007ffb22091b82 n/a (libdrm_nouveau.so.2 + 0x5b82)
                                             #17 0x00007ffb20d3aa68 n/a (nouveau_drv.so + 0x24a68)
                                             #18 0x00007ffb20d025cd n/a (libexa.so + 0x65cd)
                                             #19 0x00007ffb20d0c887 n/a (libexa.so + 0x10887)
                                             #20 0x000055d32fbf32a0 n/a (Xorg + 0xd02a0)
                                             #21 0x000055d32fbd76ec n/a (Xorg + 0xb46ec)
                                             #22 0x000055d32fbd790f n/a (Xorg + 0xb490f)
                                             #23 0x000055d32fb9f997 ProcessWorkQueue (Xorg + 0x7c997)
                                             #24 0x000055d32fc716b0 WaitForSomething (Xorg + 0x14e6b0)
                                             #25 0x000055d32fb6134f n/a (Xorg + 0x3e34f)
                                             #26 0x00007ffb21a23cd0 n/a (libc.so.6 + 0x23cd0)
                                             #27 0x00007ffb21a23d8a __libc_start_main (libc.so.6 + 0x23d8a)
                                             #28 0x000055d32fb62465 _start (Xorg + 0x3f465)
                                             
                                             Stack trace of thread 20353:
                                             #0  0x00007ffb21a854ae n/a (libc.so.6 + 0x854ae)
                                             #1  0x00007ffb21a87d40 pthread_cond_wait (libc.so.6 + 0x87d40)
                                             #2  0x00007ffb1ecc76bc n/a (nouveau_dri.so + 0xc76bc)
                                             #3  0x00007ffb1ed145cc n/a (nouveau_dri.so + 0x1145cc)
                                             #4  0x00007ffb21a889eb n/a (libc.so.6 + 0x889eb)
                                             #5  0x00007ffb21b0d23c n/a (libc.so.6 + 0x10d23c)
                                             
                                             Stack trace of thread 20355:
                                             #0  0x00007ffb21b0d666 epoll_wait (libc.so.6 + 0x10d666)
                                             #1  0x000055d32fc761ab n/a (Xorg + 0x1531ab)
                                             #2  0x000055d32fc79849 n/a (Xorg + 0x156849)
                                             #3  0x00007ffb21a889eb n/a (libc.so.6 + 0x889eb)
                                             #4  0x00007ffb21b0d23c n/a (libc.so.6 + 0x10d23c)
                                             ELF object binary architecture: AMD x86-64
Aug 06 08:59:33 pc0 systemd[1]: Started Process Core Dump (PID 26359/UID 0).
Aug 06 08:59:33 pc0 kernel: nouveau 0000:01:00.0: Xorg[20352]: channel 2 killed!
Aug 06 08:59:33 pc0 kernel: nouveau 0000:01:00.0: fifo:000000:0002:0002:[Xorg[20352]] errored - disabling channel
Aug 06 08:59:33 pc0 kernel: nouveau 0000:01:00.0: fifo:000000: rc scheduled
Aug 06 08:59:33 pc0 kernel: nouveau 0000:01:00.0: fifo:000000:0002:[Xorg[20352]] rc scheduled
Aug 06 08:59:33 pc0 kernel: nouveau 0000:01:00.0: fifo: fault 01 [WRITE] at 0000000000241000 engine 00 [GR] client 0f [GPC0/PROP_0] reason 02 [PTE] on channel 2 [007fba2000 Xorg[20352]]

Is it possible you are hitting this keybind by mistake?

https://wiki.archlinux.org/title/Herbstluftwm#Troubleshooting

  • To log out of herbstluftwm, use the command herbstclient quit or the default keybind of $mod+shift-q

That was one of my first thoughts. I actually disabled it. Nothing happens when I press $mod+shift-q now. I also I can say with confidence that it happens even when I am not using the keyboard.

I think it’s the grahpics cards drivers after looking at the logs but I am no expert!

Can someone tell me what’s happening with the graphics card drivers and why I am being logged out?

Humor me:

At the lighdm login, have you checked which type of session your logging into? I ask because this is a critical step for lighdm and most other display managers. It tells them where to look for the .xsessions file.

secondly, disable lighdm (not uninstall, disable) and try another display manager and see if the logouts continue.

sudo systemctl disable lightdm.service

You already have a decent replacement in the form of systemd. Since your only using a window manager, I dont think you need a full blown display manager.

sudo systemctl enable systemd-logind.service

reboot, login, and see if the random logouts continue.

When I made this post I was using herbstluftwm but I thought it could be the window manger so I switched to awesomewm. The logout happens when I select either of those sessions in the LightDM login screen.

Awesome WM xsessions file:

$ cat /usr/share/xsessions/awesome.desktop 
[Desktop Entry]
Name=awesome
Comment=Highly configurable framework window manager
TryExec=awesome
Exec=awesome
Type=Application

herbstluftwm WM xsessions file:

$ cat /usr/share/xsessions/herbstluftwm.desktop
[Desktop Entry]
Encoding=UTF-8
Name=herbstluftwm
Comment=Manual tiling window manager
Exec=herbstluftwm --locked
Type=Application

I will switch to systemd-logind and let you know what happened!

UPDATE 1:

I disable lightdm and used systemd-logind but it doesn’t start the xserver. How can I start the xserver (and start my window manager) with systemd-logind?!

To launch X-server after logging in at the tty, you need to use xinit.

For this to happen, you need to execute startx inside the initialization file of your login shell. If your login shell is bash, then you need to add the following lines into your ~/.bash_profile:

if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
  exec startx
fi

Alternatively, you can replace [ "${XDG_VTNR}" -eq 1 ] with ["$(tty)" = "/dev/tty1"] or any tty you want to launch x-server from.

Personally, I’d just run startx manually after logging in.