Ubuntu 17.10 Tip: Graphical Apps Doesn’t Launch via Root, Sudo, Gksu

October 11, 2017 — 2 Comments

Ubuntu 17.10 uses Wayland in the default session and Xorg for optional. However, many graphical applications need to run as root so far does not launch in Wayland.

You’ll get following similar errors while running graphical applications via root:

  1. For some applications, e.g., Synaptic Package Manager, Grub Customizer, Gparted, and Ubuntu Tweak, they does not launch in Wayland.

    Or you may get following error when trying to launch them via gksu command:

    Failed to run *** as user root. Unable to copy the user’s Xauthorization file.

  2. Starting graphical application via sudo in terminal window will get error:

    No protocol specified. Gtk-WARNING **: Cannot open display: :0

The most straightforward workaround is to use xhost to temporarily allow the root user to access the local user’s X session.

To do so, run command:

xhost si:localuser:root

After running the command, these graphical applications can be launched from app launcher or via sudo, gksu, pkexec commands until you log out.

To make this work automatically at login, search for and launch Startup Applications utility, click the “Add” button to run the command at startup:

  • name: whatever
  • command: xhost si:localuser:root
  • comment: whatever

I'm a freelance blogger who started using Ubuntu 5+ years ago and wishes to share my experiences and some useful tips with Ubuntu beginners and lovers. Please notify me if you find any typo/grammar/language mistakes. English is not my native language. Contact me on Google Plus or email to ubuntuhandbook1@gmail.com

2 responses to Ubuntu 17.10 Tip: Graphical Apps Doesn’t Launch via Root, Sudo, Gksu

  1. You can also use xhost + to allow and xhost – to return it to the default state.

  2. Thanks a lot !!

Leave a Reply

Text formatting is available via select HTML.

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

*