Ask Your Question

Xsession is running on tty2

asked 2018-09-09 07:38:54 -0500

updated 2018-09-09 15:15:28 -0500

ps aux | grep -v awk | awk '/Xorg/ , gsub(".*Xorg", "") {print $1}' vt1 vt2

The problem is that DISPLAY variable by default is set to :1

 echo $DISPLAY 

setting it to :0 cause the issue:

xset q
Invalid MIT-MAGIC-COOKIE-1 keyxset:  unable to open display ":0"

Honestly, the main problem is powertop, that doesn't want to work with DISPLAY=:1, since:

sudo powertop -c
Invalid MIT-MAGIC-COOKIE-1 key/usr/bin/xset:  unable to open display ":0"

It doesn't matter what display variable value is, the error is the same


It seems that it is a bug of gdm, in case when gnome is running on x11 rather than Wayland. It runs two separated xsessions. But, for example Ubuntu somehow solved this issue, 18.04 has only single session using GNome + x11.

So, are there any workaround to set display number to zero for second real session , such that xset q will accept it ?

edit retag flag offensive close merge delete


What is wrong with having the display variable being set to :1? This is a direct result of the fact that gdm is running on tty1 and a GNOME session is running on tty2. This is the default since a few Fedora releases and works the same no matter whether you are using the X11 or Wayland versions of gdm or the GNOME session.

genodeftest gravatar imagegenodeftest ( 2018-09-10 07:05:22 -0500 )edit

The display :0 is probably owned by gdm and since the magic cookie is not readable by your user, you cannot connect there. This is not a bug, this is an important security feature.

genodeftest gravatar imagegenodeftest ( 2018-09-10 07:06:48 -0500 )edit

I do not see any reason why powertop might want to access the X server. This looks spooky.

genodeftest gravatar imagegenodeftest ( 2018-09-10 07:08:35 -0500 )edit

Workaround: Can you switch to a tty, log in as root and run powertop -c there?

genodeftest gravatar imagegenodeftest ( 2018-09-10 07:09:08 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2018-09-09 15:21:06 -0500

abadrinath gravatar image

I'm not completely familiar with this error myself, but people have said this removing XAUTHORITY from their shell configuration file fixes it, specifically this part:

# Xauthority
export XAUTHORITY="$XDG_CACHE_HOME/Xauthority"

Let me know how it goes.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2018-09-09 07:38:54 -0500

Seen: 136 times

Last updated: Sep 09 '18