You are not logged in.

#1 2015-12-27 03:32:32

kelvinh
Member
Registered: 2012-09-15
Posts: 13

[SOLVED] Invalid MIT-MAGIC-COOKIE-1 key

Hi all,

I followed this automatic login to virtual console tutorial and this autostart X at login tutorial to get my account logged in and start X automatically, everything works great, except that when I try to run a X related program in shell, I get errors, like:

$ xhost
Invalid MIT-MAGIC-COOKIE-1 key
xhost:  unable to open display ":0"
$ xrdb
Invalid MIT-MAGIC-COOKIE-1 key
xrdb: Resource temporarily unavailable
xrdb: Can't open display ':0'
$ cbatticon
Invalid MIT-MAGIC-COOKIE-1 key
Unable to init server: Could not connect: Connection refused
(cbatticon:1678): Gtk-WARNING **: cannot open display: :0

I googled a lot, and find this session, but he only has problem when starts programs as root, also, there are people say that the problem gone after they deleted the .Xauthority file, but that does not work for me...

This is my .zprofile:

# autostart X at login
# https://wiki.archlinux.org/index.php/Xinitrc
[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx

This is the config for auto login:

$ cat /etc/systemd/system/getty@tty1.service.d/override.conf
[Service]
Type=simple
ExecStart=
ExecStart=-/usr/bin/agetty --autologin kelvin --noclear %I 38400 linux

My .xinitrc is a little large but the related things are just the following:

setxkbmap -option terminate:ctrl_alt_bksp

resources=$HOME/.config/xorg/Xresources
modmap=$HOME/.config/xorg/Xmodmap
[[ -f $resources ]] && xrdb -merge $resources
[[ -f $modmap ]] && xmodmap $modmap

xcompmgr -C &
urxvtd -q -o -f &

exec i3

(NOTE: I also have no idea why xrdb in .xinitrc runs without error...)

And I didn't do any change to xorg related config files.

Anyone has a clue?

Thanks in advance.

Last edited by kelvinh (2016-02-28 04:46:04)

Offline

#2 2016-02-28 04:38:00

kelvinh
Member
Registered: 2012-09-15
Posts: 13

Re: [SOLVED] Invalid MIT-MAGIC-COOKIE-1 key

I finally find why, I customized the XAUTHORITY env variable in my shell conf:

# Xauthority
export XAUTHORITY="$XDG_CACHE_HOME/Xauthority"

if I remove it, everything works.
Also, this can cause X11 forwarding error.

Hope this can help those who have the same issue.

Offline

Board footer

Powered by FluxBB