`xrandr` returns RandR extension missing on Ubuntu 22.04 on Raspberry Pi 4

My RPI 4 has Ubuntu 22.04 LTS running on it with xfce4 and Tightvnc for a GUI. I can stream music using Firefox over the audio output to my stereo set.
So far so good.
I did not explicitly set the resoluion, so I wanted to use xrandr to set it.
But when I start it from a terminal it returns RandR extension missing. I kooked up on the internet and found that I have to start VNC server (which is started in @reboot in the crontab of the pi user with @reboot sleep 20 && loginctl enable-linger pi && cd /home/pi && sh -c "/home/pi/vnc.sh") with a shell script:

#!/bin/bash
export XDG_SESSION_TYPE=tty
export XDG_SESSION_CLASS=user
export XDG_RUNTIME_DIR=/run/user/1000
export XDG_DATA_DIRS=/usr/local/share:/usr/share:/var/lib/snapd/desktop
export USER=pi
export HOME=/home/pi
export XDG_SESSION_TYPE=tty
export MOTD_SHOWN=pam
export XDG_SESSION_CLASS=user
export LC_CTYPE=C.UTF-8
export XDG_RUNTIME_DIR=/run/user/1000
/usr/bin/vncserver -geometry :1 &

The exports (plus the enable-linger pi in the @reboot line) I had to add otherwise some apps (including Firefox) do not start in the VNC session.
I found an answer on stackexchange that I have to specify the resolution in the start script, so I changed that to /usr/bin/vncserver -geometry 1440x900 :1 &.
But after reboot I still cannot run xrandr or the GUI variant for setting display resolution xfce4-display-settings.
After running gtf 1920 1080 60 it did not run either.
Here the xstartup:

pi@raspberrypi:~$ cat .vnc/xstartup 
#!/bin/sh

xrdb "$HOME/.Xresources"
export XAUTHORITY=$HOME/.Xauthority
xsetroot -solid grey
# Allow copy & paste when ClientCutText is set to true on the client side
autocutsel -fork
#x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#x-window-manager &
# Fix to make GNOME work
export XKL_XMODMAP_DISABLE=1
/etc/X11/Xsession

What am I doing wrong here ?

Leave a Comment