Graphical session doesn't start first time, "Invalid MIT-MAGIC-COOKIE-1"

A slightly weird issue… To summarise:

  • My laptop boots and brings up LightDM. I try to log in and am returned immediately returned to LightDM.
  • After a failed login, Xorg.1.log shows X loading then quitting without errors - it just starts up, then quits
  • If I switch to a TTY and log in, that works fine. If I log out, then switch back to LightDM and log in, my X session starts correctly.

This happens with both 5.7.10 and 5.7.10-zen. I have no un-merged .pacnew.

It feels like a systemd user service hasn’t started yet, but surely any user service should start no matter how I log in?

Initially looked similar to

but that was an NVIDIA driver issue - I’m running with amdgpu.

Any ideas what to poke at next?

inxi -Fxxxz
System:    Kernel: 5.7.10-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 10.1.0 Desktop: MATE 1.24.0 info: mate-panel 
           wm: marco 1.24.0 dm: LightDM 1.30.0 Distro: Arch Linux 
Machine:   Type: Laptop System: ASUSTeK product: GL702ZC v: 1.0 serial: <filter> 
           Mobo: ASUSTeK model: GL702ZC v: 1.0 serial: <filter> UEFI: American Megatrends v: GL702ZC.306 date: 07/05/2019 
Battery:   ID-1: BAT0 charge: 9.1 Wh condition: 9.3/74.2 Wh (13%) volts: 15.4/15.4 model: ASUSTeK ASUS Battery type: Li-ion 
           serial: N/A status: Not charging cycles: 8 
CPU:       Topology: 8-Core model: AMD Ryzen 7 1700 bits: 64 type: MT MCP arch: Zen rev: 1 L2 cache: 4096 KiB 
           flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm bogomips: 95804 
           Speed: 3083 MHz min/max: 1550/3000 MHz boost: enabled Core speeds (MHz): 1: 2533 2: 2194 3: 1344 4: 1347 5: 1347 
           6: 1351 7: 2269 8: 1711 9: 1299 10: 1464 11: 1303 12: 1280 13: 1310 14: 1428 15: 1348 16: 1347 
Graphics:  Device-1: Advanced Micro Devices [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] vendor: ASUSTeK 
           driver: amdgpu v: kernel bus ID: 0c:00.0 chip ID: 1002:67df 
           Device-2: Realtek USB2.0 HD UVC WebCam type: USB driver: uvcvideo bus ID: 1-8:3 chip ID: 0bda:57fa serial: <filter> 
           Display: x11 server: 1.20.8 compositor: marco v: 1.24.0 driver: amdgpu resolution: <xdpyinfo missing> 
           Message: Unable to show advanced data. Required tool glxinfo missing. 
Audio:     Device-1: AMD Ellesmere HDMI Audio [Radeon RX 470/480 / 570/580/590] vendor: ASUSTeK driver: snd_hda_intel 
           v: kernel bus ID: 0c:00.1 chip ID: 1002:aaf0 
           Device-2: Advanced Micro Devices [AMD] Family 17h HD Audio vendor: ASUSTeK driver: snd_hda_intel v: kernel 
           bus ID: 12:00.3 chip ID: 1022:1457 
           Device-3: GYROCOM C&C type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 3-1.4:6 chip ID: 1852:7022 
           Sound Server: ALSA v: k5.7.10-zen1-1-zen 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: ASUSTeK driver: r8169 v: kernel port: e000 
           bus ID: 06:00.0 chip ID: 10ec:8168 
           IF: enp6s0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           Device-2: Realtek RTL8822BE 802.11a/b/g/n/ac WiFi adapter vendor: AzureWave driver: rtw_pci v: N/A port: d000 
           bus ID: 07:00.0 chip ID: 10ec:b822 
           IF: wlp7s0 state: down mac: <filter> 
           IF-ID-1: ztppizstn7 state: unknown speed: 10 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 1.14 TiB used: 455.29 GiB (38.9%) 
           ID-1: /dev/sda vendor: Seagate model: ST1000LM049-2GH172 size: 931.51 GiB speed: 6.0 Gb/s rotation: 7200 rpm 
           serial: <filter> rev: SDM1 scheme: GPT 
           ID-2: /dev/sdb vendor: SanDisk model: SD8SN8U256G1002 size: 238.47 GiB speed: 6.0 Gb/s serial: <filter> rev: 1002 
           scheme: GPT 
RAID:      Device-1: tank type: zfs status: ONLINE raid: no-raid size: 888.00 GiB free: 428.00 GiB allocated: 460.00 GiB 
           Components: online: N/A 
Partition: ID-1: / size: 40.00 GiB used: 28.17 GiB (70.4%) fs: btrfs dev: /dev/sdb4 
           ID-2: /boot size: 975.9 MiB used: 193.5 MiB (19.8%) fs: ext4 dev: /dev/sdb2 
           ID-3: /home size: 401.74 GiB used: 1.04 GiB (0.3%) fs: zfs raid: tank/home 
Swap:      ID-1: swap-1 type: partition size: 40.00 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/sda1 
Sensors:   System Temperatures: cpu: 65.6 C mobo: N/A gpu: amdgpu temp: 65 C 
           Fan Speeds (RPM): N/A 
Info:      Processes: 507 Uptime: 34m Memory: 31.36 GiB used: 7.08 GiB (22.6%) Init: systemd v: 245 Compilers: gcc: 10.1.0 
           clang: 10.0.1 Packages: pacman: 1840 Shell: Zsh v: 5.8 running in: terminator inxi: 3.1.04

Actually, it looks like I wasn’t waiting long enough… after waiting ~10 seconds between LightDM showing up and trying to log in, I could log in.

How can I be reaching too quickly? Is EOS just that much faster to boot? :confused:

Or, is the service ordering incorrect and maybe user@.service is starting too late, or maybe home.mount hasn’t started, which is why X fails to load…

The second one sounds more like it - it’s the same sort of symptom as if permissions were incorrect on $HOME.


Actually, the first log in doesn’t work. Trying again immediately works.

This is pointing back to a user service.

1 Like

As EndeavourOS is 99% Arch, you can find an answer here:

1 Like

Close (and I tested to verify). However, LightDM is loading fine, it’s the first login which is kicked back to the DM login screen.

I think this isnt only related to lightdm
Some days prior i got this error with sddm

I needed to login two times
At first login i was immegeately logged out
But on second login it got to desktop.

Also it was my manjaro converted to garuda(arch)

So i just did an reinstallation with garuda.
Now i dont experience it.

1 Like

It looks to be down to an “Invalid MIT-MAGIC-COOKIE-1” which normally means a “broken” .Xauthority file. It still works fine second time around, though, which means the Xauthority should be fine. :confused:

** Message: 14:40:34.160: Starting lightdm-gtk-greeter 2.0.8 (Jul  4 2020, 16:10:34)
** Message: 14:40:34.162: [Configuration] Reading file: /etc/lightdm/lightdm-gtk-greeter.conf

** (lightdm-gtk-greeter:1909): WARNING **: 14:40:34.399: [PIDs] Failed to execute command: /usr/libexec/at-spi-bus-launcher

** (lightdm-gtk-greeter:1909): WARNING **: 14:40:34.403: [PIDs] Failed to execute command: systemd

(lightdm-gtk-greeter:1909): Gtk-WARNING **: 14:40:34.679: Drawing a gadget with negative dimensions. Did you forget to allocate a size? (node menubar owner GreeterMenuBar)

(lightdm-gtk-greeter:1909): Gtk-WARNING **: 14:40:38.854: Drawing a gadget with negative dimensions. Did you forget to allocate a size? (node menubar owner GreeterMenuBar)
Invalid MIT-MAGIC-COOKIE-1 key
** (lightdm-gtk-greeter:1909): WARNING **: 14:40:38.879: [Background] Failed to create root pixmap

It is most likely theme related.

1 Like

Getting closer. I switched the theme to Adwaita, same thing. However, restarting lightdm from a TTY before logging in let the “first” login succeed, so I’m back to thinking this is due to a “missing” $HOME when the service first starts (my $HOME is on a ZFS volume). This might be something to do with using DKMS for the ZFS kernel module.

Let’s try adding zfs to the initramfs modules…

Edit: nope, same thing. Let me try overriding lightdm.service's After.

It turned out to be that there wasn’t a hostname in /etc/hostname .

Set one, reboot, all’s good.

That was quite a dive. :grin:


I had a problem with Light display manager, apparently the graphics driver would taker longer to load than lightdm expected. What I did:
I edited "/etc/systemd/system/display-manager.service " and added RestartSec=0.5 StartLimitInterval=0

Upon reboot the graphical login appeared as it should.

hm we set already an option in lightdm.conf to let lightdm wait for graphics fully initialized:

check if you have this setting:

sudo cat /etc/lightdm/lightdm.conf | grep logind