Ubuntu Server 24.04.1 with added desktop - cannot get VNC working....
Bo Berglund
bo.berglund at gmail.com
Fri Jan 31 17:36:56 UTC 2025
On Fri, 31 Jan 2025 16:59:37 +0100, Bo Berglund <bo.berglund at gmail.com> wrote:
>My $HOME/.vnc/xstartup looks like this:
>
>#!/bin/sh
># Start up the standard system desktop
>unset SESSION_MANAGER
>unset DBUS_SESSION_BUS_ADDRESS
>/usr/bin/mate-session
>[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
>[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
>xsetroot -solid grey
>vncconfig -iconic &
>x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
>x-window-manager
>
>And the service file /etc/systemd/system/vncserver at .service like this:
>
>[Unit]
>Description=Start TigerVNC server at startup
>After=syslog.target network.target
>[Service]
>Type=forking
>User=bosse
>Group=bosse
>WorkingDirectory=/home/bosse
>PIDFile=/home/bosse/.vnc/%H:590%i.pid
>
>ExecStartPre=-/usr/bin/vncserver -kill :%i &> /dev/null
>ExecStart=/usr/bin/vncserver -depth 24 -localhost no -geometry 1680x1040 :%i
>ExecStop=/usr/bin/vncserver -kill :%i
>
>[Install]
>WantedBy=multi-user.target
>
>Is there something else I have to do in order to get this going???
>And where do I get rid of bluetooth in relation to vnc?
I realized that the server itself having a display attached might be using
display #1 (I thought numbering starts with 0 but maybe not...).
So I tried to manually start it manually on #2 instead:
sudo systemctl disable vncserver at 1 #Remove the service altogether
vncserver :2 #Start a session from cmd line
And lo-and-behold now it *was* possible to connect to the server from my PC.
So I modified the service to use display 2 insetad of 1:
sudo systemctl enable vncserver at 2
sudo systemctl start vncserver at 2
But I am getting this then:
$ sudo systemctl start vncserver at 2
Job for vncserver at 2.service failed because a timeout was exceeded.
See "systemctl status vncserver at 2.service" and "journalctl -xeu
vncserver at 2.service" for details
The text was output after a considerable time like a minute or so.
So there must be something that causes the startup of the service to hang, what
could that be? And how can I find out?
It is possible but not ideal to access the command line every time I want to use
the VNC and start the server after which a connection can be made.
But this is not what services should do, right????
Any ideas?
--
Bo Berglund
Developer in Sweden
More information about the ubuntu-users
mailing list