Workaround sudo GUI for Wayland-X11 apps

less than 1 minute read

Related: SSH Agent on WSL/Ubuntu 17.10


Ubuntu 17.10 defaulted to Wayland and Gnome-based Desktop, with the abandonment of Mir and Unity Desktop. Ubuntu 18.04 once again defaults to X11. The reasons for defaulting to X11 on Ubuntu 18.04 include:

  • Screen sharing
  • Remote Desktop (RDP / VNC)
  • Better stability/recovery from Shell crashes

Select X11 or Wayland at Ubuntu login screen–at this time, X11 is generally recommended.

Wayland GUI sudo workaround

sudo synaptic or other GUI programs on Wayland results in error:

No protocol specified. Unable to init server **: cannot open display: :0.

This is a workaround for the GUI sudo permissions issue with Wayland in Ubuntu:

Add to ~/.bashrc

xhost +si:localuser:root > /dev/null

Note, this defeats non-root security advantages of Wayland over X11.

Notes

Leave a Comment