Gtk-WARNING ** cannot open display on CentOS 7 minimal server install

From the title I feel like I don’t need to give any extra background information. But here you have it. I have a server, and I need a minimal installation (that is, no desktop) but since I like windows after all, it should be possible to open a GUI via ssh.

My minimal server install, plus yum update, plus yum install epel-release net-tools gparted end up with a system that should deliver what I want. I do sync of other files from a graphical workstation, to be more specific, /etc/ssh/ and my sssd and krb5 configuration. Unfortunately, after the reboot to get the latest kernel, when I try to ssh -Y and run something, I get the damn error of the title:

gparted
(gpartedbin:2423): Gtk-WARNING **: cannot open display:

I check that the X11 configuration is right, by having a look to the ssh configuration:

> grep 'X11' /etc/ssh/sshd_config
 X11Forwarding yes
 # X11DisplayOffset 10
 # X11UseLocalhost yes
 # X11Forwarding no

Could it be that I miss something? Yes indeed. The fact that I did a minimal install is indeed a good hint. I try installing X11, but there is no such a package. The two ones missing to get my remote windows in the way I like it are xauth (and dependencies) and xorg-x11-fonts (and dependencies). It looks like this:

> yum install xauth
Installing:
 xorg-x11-xauth x86_64 1:1.0.9-1.el7 base 30 k
Installing for dependencies:
 libICE x86_64 1.0.9-2.el7 base 65 k
 libSM x86_64 1.2.2-2.el7 base 39 k
 libXmu x86_64 1.1.2-2.el7 base 71 k
 libXt x86_64 1.1.4-6.1.el7 base 173 k

> yum install xorg-x11-fonts-Type1
Installing:
 xorg-x11-fonts-Type1 noarch 7.5-9.el7 base 521 k
Installing for dependencies:
 libXfont x86_64 1.5.1-2.el7 base 150 k
 libfontenc x86_64 1.1.2-3.el7 base 30 k
 ttmkfdir x86_64 3.0.9-42.el7 base 48 k
 xorg-x11-font-utils x86_64 1:7.5-20.el7 base 87 k

If you don’t install the fonts, you may get your window, but with squares instead of letters. We’re done fixing the problem.

As usual, sorry if this is trivial for you…it is also trivial for me, but sometimes I forget what I did 😀

4 thoughts on “Gtk-WARNING ** cannot open display on CentOS 7 minimal server install

  1. Pingback: Install munin-node on CentOS 7 | Bits and Dragons

  2. Thank you! This helped with getting this error on mysql-workbench – I couldn’t find this answer anywhere else!

    I was using RHEL 8.2 and needed to install the packages:
    xorg-x11-xauth
    xorg-x11-fonts-Type1

    Then to get rid of the pesky:
    Gtk-Message: Failed to load module “pk-gtk-module”
    I installed: PackageKit-gtk3-module
    and for:
    Gtk-Message: Failed to load module “canberra-gtk-module”
    I installed: libcanberra-gtk3

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s