You are not logged in.

#1 2015-09-21 14:48:24

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Invalid MIT-MAGIC-COOKIE-1 after hostname change with DHCP

Hi there, I've run into this problem on two machines (desktop, notebook) in two different scenarios, and would like to ask if anybody knows how to fix it.


scenario #1: Desktop with ssd. "exec startx" at the end of .bashrc, "exec startxfce4" in .xinitrc. I'm able to start programs for about ~4 seconds after bootup, then, as soon as the hostname changes from "localhost.localdomain" to the real hostname, it becomes impossible. E.g. thunar says:

Invalid MIT-MAGIC-COOKIE-1 keyThunar: Cannot open display:

If I log out from XFCE and then log in again (this time with the correct hostname already known), all is working fine.

Seems to me, the problem is that X is started on "localhost.localdomain", and then refuses to run programs as the hostname changes (with the dhcp lease).


scenario #2: Notebook, booted up without network, XFCE. Working fine. As soon as I connect it to wifi (wpa_gui + dhcp), I'm unable to run X programs, for much the same reason as in case 1 (hostname change). Logout/login fixes it.

Using dhcpcd 6.9.3-1, xorg-xauth 1.0.9-1.


Can this be mended somehow? It is rather impractical to have to log out/log in.

Last edited by renergy (2015-09-21 14:51:01)

Offline

#2 2015-09-22 12:34:26

mrunion
Member
From: Jonesborough, TN
Registered: 2007-01-26
Posts: 1,938
Website

Re: Invalid MIT-MAGIC-COOKIE-1 after hostname change with DHCP

Can't you just set the correct host name in your /etc/hosts file, or does the host name change every time you get a new lease?


Matt

"It is very difficult to educate the educated."

Offline

#3 2015-09-22 13:10:26

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,420
Website

Re: Invalid MIT-MAGIC-COOKIE-1 after hostname change with DHCP

It can happen on new leases, see:

https://bbs.archlinux.org/viewtopic.php?id=202704

and in particular the documentation for hostnamed:

"The transient (dynamic) hostname directly maps to the kernel hostname. This hostname should be assumed to be highly dynamic, and hence should be watched directly, without involving ?PropertyChanged messages from hostnamed. For that, open /proc/sys/kernel/hostname and poll() for SIGHUP which is triggered by the kernel every time the hostname changes. Again: this is special for the transient (dynamic) hostname, and does not apply to the configured (fixed) hostname."

Workarounds: configure your dhcp client to not change the hostname, or use the username for X access (preferably, former).

Last edited by Alad (2015-09-22 13:15:05)


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#4 2015-09-23 21:44:00

renergy
Member
From: Europe/Prague
Registered: 2014-09-27
Posts: 16

Re: Invalid MIT-MAGIC-COOKIE-1 after hostname change with DHCP

Thank you both guys. I was hoping for a seamless solution, a simple config file change, that would allow automatic hostname change, but as far as I can see, there is no such solution atm.

[frankly, the easiest for me is to simply log off - log on, it's not a big hassle, but it's annoying and definitely an obstacle for someone, who doesn't know about it... it would be nice if this got fixed]

Thanks again.

Last edited by renergy (2015-09-23 21:47:48)

Offline

Board footer

Powered by FluxBB