Score:4

VNC doesn't work in Ubuntu 21.10!

uy flag

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 install mutter, and after doing that, it complained that mutter was already running and the command crashed. This happened because GNOME's compositor already runs inside GNOME itself (in the process Xwayland), so running mutter 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.

Igor Foxly avatar
sg flag
All of them are made for X-org, Ubuntu recently switched to Wayland session. So, you need an app that uses pipewire which is used to share screen via Wayland.
marcocipriani01 avatar
uy flag
@Igor Foxly, Ubuntu moved to Wayland back in 2017, with Ubuntu 17.10 Artful Aardvark. That's 5 years ago and we still don't have a working VNC server. I find it unacceptable and frustrating. And even with Xorg, it doesn't work without a monitor attached. If you know of a working VNC server, please suggest it to me. Thanks.
Igor Foxly avatar
sg flag
Ubuntu switched to Wayland in 21.04, before it was not ready to be used as daily stuff. Even take a look at Red Hat's Fedora, only Fedora 33 was ready with Wayland as daily driver since pipewire could be used to share the screen. This stuff isn't Canonical's fault frankly speaking, they try to make just working distro and that's it. Sorry, I don't use such apps so I can't suggest anything. If your x11 session won't work that you could reinstall system (separated /home would make it easier) or to wait for 22.04 with probably new installer that supports reinstalling feature
marcocipriani01 avatar
uy flag
My X11 session works just fine, no problems there, I bricked it only when I applied the workaround described, but I was able to recover it and delete the workaround. The problem is that X11 doesn't create a display when there's no monitor attached, so there's nothing for VNC to view. This is more of a design flaw, although I understand why it was done so (performance, memory usage and usage in servers with no monitors). I guess I'll switch to Windows 11 Pro, which has a wonderful built-in RDP server. I'll say bye to Linux now, I'm fed up of testing lots of VNC servers.
Igor Foxly avatar
sg flag
Okay, sadly that you don't want to figure it out. Leaving for spyware OS is easier, of course. You could try out Linux Mint Cinnamon that is more similar for win10/11 users, and it uses x11 plus it's user-friendly
marcocipriani01 avatar
uy flag
It isn't about spyware or X11 or ease of use. I'm an experienced user and I want to control my telescope's computer both remotely and in the observatory with a portable monitor. Linux Mint won't have a better VNC server than Ubuntu (it has the same ones infact), and that's all I'm looking for. The problem is similar no matter if I use Xorg or Wayland. The former doesn't work without a monitor and the latter isn't supported. I've already spent a full day installing Ubuntu and trying various VNC servers. If time is money, I would rather buy a Windows Pro license than waste another day.
Score:0
cn flag

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.

marcocipriani01 avatar
uy flag
Thanks, I'll give it a try later. Does it work even with no monitor connected as far as you know? From what I was able to see, Xorg doesn't even start without a monitor (it waits for a monitor at boot and the desktop environment isn't executed).
patricks avatar
cn flag
Yes, I tested remote access after rebooting that computer with and without the monitor plugged in. The Remote Desktop through x2go also works even if ubuntu on the server is set to boot to a console instead of to a graphical desktop.
Score:0
br flag

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.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.