VNC doesn't work in Ubuntu 21.10!
I’m desperately trying to trying to enable remote desktop on Ubuntu 21.10, in a way that could allow me to view and control the desktop even when there is no monitor attached to the computer. I’ve tried all the following solutions and softwares:
- RealVNC server: doesn’t work with Wayland and requires an account
- TigerVNC: I wasn’t able to view the desktop, perhaps incompatible with Wayland?
- TightVNC: doesn’t even start
- Xrdp with X11 enabled: crashes because of some strange permission problem
- Vino: deprecated, no Wayland support
- GNOME’s built-in remote desktop server: works, but requires being enabled on a per-network basis, which makes it impractical when connecting the computer to a new network (I would need a physical monitor to enable that network). Moreover, it doesn’t work when no monitor is connected
I’ve also tried the following workarounds:
- Use GNOME 40’s new feature: virtual desktops. Running
mutter --wayland --headless --virtual-monitor 1920x1080
prompted me to installmutter
, and after doing that, it complained thatmutter
was already running and the command crashed. This happened because GNOME’s compositor already runs inside GNOME itself (in the processXwayland
), so runningmutter
directly seems to be forbidden. - Enabling X11 and using
xserver-xorg-video-dummy
(see Add Fake Display when No Monitor is Plugged In). The computer didn’t even boot with that Xorg configuration and it was a pain to fix. - Enabling X11 and creating a custom Xorg config file as describled here: Add VIRTUAL output to Xorg. GNOME’s remote desktop still closed when I unplugged the monitor.
I did’t remember that VNC/RDP on Ubuntu was such a frustrating experience. I am honestly disappointed. Hopefully someone knows how I can do it.
Update 1: RealVNC doesn’t even work with X11 for some unknown reason. It says it can’t connect to the 5900 port, which is, however, open (I even disabled ufw
!).
Update 2: I tried the ancient and ugly x11vnc
server (with X11 enabled), using the workaround found on this website, plus some more thinkering to get it working with the latest Ubuntu version. I had to change some permissions and create the following systemd
service:
[Unit]
Description=Start x11vnc.
After=multi-user.target
[Service]
Type=simple
User=<MY_USERNAME>
Group=<MY_USERNAME>
ExecStart=/usr/bin/x11vnc -display :0 -loop -forever -bg -rfbport 5900 -xkb -noxrecord -noxfixes -noxdamage -shared -norc -auth /run/user/1000/gdm/Xauthority -rfbauth /etc/x11vnc.pass
[Install]
WantedBy=multi-user.target
aaaand it doesn’t work… The VNC server stars on boot if, and only if, there’s a monitor plugged in. After that, I can unplug the monitor and it keeps working. This is not what I was looking for, however, and thus I am going to give up. I’ve already wasted too many hours getting this to work.
If you are willing to go with an alternate desktop, try x2go and the mate desktop. I’ve had good luck with that combination on ubuntu 20.04.
The specific packages to install are x2goserver, x2goserver-xsession, and ubuntu-mate-desktop.
More information on x2go is available here: https://wiki.x2go.org.
You’ll need to install the x2go client on whatever box you’re using to connect to the server.
I recognize the VNC struggles I either got a gray sceen or would not accept my password.
But Remote Desktop works for me. Goto Setting –> Sharing.
Then enable remote desktop. I had to fill in a user name down below in the screen and leave the password empty It did not work for me with a password set.
Then I used the windows Remote Desktop Connection app, That worked.
Note that each time after I login I have to go to these settings again because it keeps asking me for my keyring password (despite the setting to load it at login beind ticked)
Next I did most of what is listed here Ubuntu 17.10 VNC Server except the last line where X11 is started. Because when I logged in again but with Ubuntu – X- Org (the little I almost missed because it was all the way in the below tight corner, vague and small) the RealVNC icon showed up on the top bar. So logging in with the Ubuntu – Xorg session made my VNC work. It probably works for the other vnc servers too.