I am able to start x11vnc with the following command line as my user, but if I start it as sudo or a startup service I get an error message "XOpenDisplay("") failed."

/usr/bin/x11vnc -auth guess -forever -bg -rfbport 5900 -xkb -noxrecord -noxfixes -noxdamage -shared -norc -auth /home/lorensimon/.Xauthority -display :0 -rfbauth /etc/x11vnc.pass

1 Answer 1


It is currently not possible to use x11vnc on Ubuntu 17.10 if you use the Wayland DM. Various issues about security and exposing interfaces for frame grabbing.

References: [https://lists.freedesktop.org/archives/wayland-devel/2017-July/034551.html][1]

You can disable Wayland and implicitly enable x11 and it will work fine. I have tested this on a fresh installation of Ubuntu Desktop 17.10

sed --in-place --expression "s/^#WaylandEnable=false/WaylandEnable=false/g" ${MYFILE}
grep 'WaylandEnable' ${MYFILE}

#Logout/Login the Ubuntu Desktop session

# A quick test (you must add the security yourself)
x11vnc -display :0 -auth /var/run/lightdm/root/:0 -shared

@note It is also possible to login with X11, instead of Wayland, on the login screen (click the cog button) but that button is not always visible on various hardware.

I would also recommend to install & make the latest DEVelopment version x11vnc-0.9.14-dev instead of the package from the standard Ubuntu repository.

My general advice is actually to stay with Ubuntu 16 LTS or Ubuntu 17.04 because Wayland has lots of compat issues.

Let me know how it goes.

  • Hi Rolf, I wish I had stayed on Ubuntu 16, as it would have saved me quite some troubleshooting. Anyway, I was able to solve the problem by switching to xorg at login (as you suggested), and specifing my user in the x11vnc service script. Thanks for pointing me in the right direction.
    – larrysimon
    Commented Dec 4, 2017 at 3:55
  • Great. Would you accept my answer?
    – Rolf
    Commented Dec 4, 2017 at 10:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .