Robert K - 2023-10-24

I found a workaround which actually does not require the above code change. I'll leave this ticket open just case. Feel free to close it.

The workaround (which is not nice) is to start the X server with a script that launches another process which inserts the above statement as soon as X has started, like this:

#!/bin/sh
# Xsetup - run as root before the login dialog appears

X=
while [ "$X" == "" ]; do
  X=$( pidof X )
  if [ ${#X} -gt 0 ]; then
    break
  else
    sleep 0.1
  fi
done

sleep 1
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

Works but is a bit hacky.