some gui programs like gparted (very nice harddisk partitioning program) won’t start as root.

hostnamectl; # tested on
  Operating System: Debian GNU/Linux 10 (buster)
            Kernel: Linux 4.19.0-13-amd64
      Architecture: x86-64

su - root; # become root

gvim; # fails with
E233: cannot open display

gparted; # fails with
(gpartedbin:10160): Gtk-WARNING **: 22:38:52.297: cannot open display: 

# how to fix this
export DISPLAY=':0.0'
cp -v /home/user-running-x11-session/.Xauthority /root/.Xauthority

# then try to start it
gparted


# or
gvim

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin