X and systemd, emacsserver issue

Hello Garuda users.

I was using a systemd service to enable emacs server at login.

[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
Type=notify
ExecStart=/usr/bin/emacs --fg-daemon

# Emacs will exit with status 15 after having received SIGTERM, which
# is the default "KillSignal" value systemd uses to stop services.
SuccessExitStatus=15

# The location of the SSH auth socket varies by distribution, and some
# set it from PAM, so don't override by default.
# Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure

[Install]
WantedBy=default.target

But recently, I noticed that I couldn't start the emacsclient graphically. I could see that
emacsserver is still running and I can still use it in the tui mode.

● emacs.service - Emacs text editor
     Loaded: loaded (/home/tusharhero/.config/systemd/user/emacs.service; enabled; preset: enabled)
     Active: active (running) since Mon 2023-07-10 10:01:04 IST; 13min ago
       Docs: info:emacs
             man:emacs(1)
             https://gnu.org/software/emacs/
   Main PID: 11569 (emacs)
      Tasks: 2 (limit: 6951)
     Memory: 175.5M
        CPU: 10.855s
     CGroup: /user.slice/user-1000.slice/[email protected]/app.slice/emacs.service
             ├─11569 /usr/bin/emacs --fg-daemon
             └─11655 /usr/bin/aspell -a -m -B --encoding=utf-8

Jul 10 10:01:07 garuda emacs[11569]: Loading /home/tusharhero/.emacs.d/.cache/recentf...done
Jul 10 10:01:38 garuda emacs[11569]: [304B blob data]
Jul 10 10:01:39 garuda emacs[11569]: Invalid MIT-MAGIC-COOKIE-1 key
Jul 10 10:01:40 garuda emacs[11569]: Invalid MIT-MAGIC-COOKIE-1 key
Jul 10 10:01:41 garuda emacs[11569]: Invalid MIT-MAGIC-COOKIE-1 key
Jul 10 10:03:32 garuda emacs[11569]: Invalid MIT-MAGIC-COOKIE-1 key
Jul 10 10:03:38 garuda emacs[11569]: Invalid MIT-MAGIC-COOKIE-1 key
Jul 10 10:04:13 garuda emacs[11569]: [persp-mode] Error: Can not deactivate frame -- (wrong-type-argument frame-live-p #<dead frame F3 0x559dade46e78>)
Jul 10 10:04:30 garuda emacs[11569]: [persp-mode] Error: Can not deactivate frame -- (wrong-type-argument frame-live-p #<dead frame F4 0x559db5ca7150>)
Jul 10 10:06:25 garuda emacs[11569]: [persp-mode] Error: Can not deactivate frame -- (wrong-type-argument frame-live-p #<dead frame F5 0x559db4991400>)

If I try to run it from the terminal I get the following error.

~ 
λ emacsclient -nc
*ERROR*: Display :0 can’t be opened

From a searx search it seems like it has something to do with Xauthority.

System:
  Kernel: 6.4.1-zen2-1-zen arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
    parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen
    root=UUID=e01c77a9-8744-4c85-afee-cef1f429bd62 rw rootflags=subvol=@
    quiet quiet rd.udev.log_priority=3 vt.global_cursor_default=0
    resume=UUID=f9b0b8af-d574-4661-a0d5-4e2a9f483bd3 loglevel=3 ibt=off
  Desktop: KDE Plasma v: 5.27.6 tk: Qt v: 5.15.10 wm: kwin_x11 vt: 2
    dm: SDDM Distro: Garuda Linux base: Arch Linux
Machine:
  Type: Desktop Mobo: ASUSTeK model: PRIME A320M-K v: Rev X.0x
    serial: <superuser required> UEFI: American Megatrends v: 5220
    date: 09/12/2019
CPU:
  Info: model: AMD Ryzen 3 3200G with Radeon Vega Graphics bits: 64 type: MCP
    arch: Zen/Zen+ note: check gen: 1 level: v3 note: check built: 2019
    process: GF 12nm family: 0x17 (23) model-id: 0x18 (24) stepping: 1
    microcode: 0x8108109
  Topology: cpus: 1x cores: 4 smt: <unsupported> cache: L1: 384 KiB
    desc: d-4x32 KiB; i-4x64 KiB L2: 2 MiB desc: 4x512 KiB L3: 4 MiB
    desc: 1x4 MiB
  Speed (MHz): avg: 1293 high: 1400 min/max: 1400/3600 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 1400 2: 1258
    3: 1258 4: 1257 bogomips: 28746
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities: <filter>
Graphics:
  Device-1: AMD Picasso/Raven 2 [Radeon Vega Series / Radeon Mobile Series]
    vendor: ASUSTeK driver: amdgpu v: kernel arch: GCN-5 code: Vega
    process: GF 14nm built: 2017-20 pcie: gen: 3 speed: 8 GT/s lanes: 16
    ports: active: HDMI-A-1 empty: DP-1 bus-ID: 07:00.0 chip-ID: 1002:15d8
    class-ID: 0300 temp: 45.0 C
  Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.2
    compositor: kwin_x11 driver: X: loaded: amdgpu unloaded: modesetting
    alternate: fbdev,vesa dri: radeonsi gpu: amdgpu display-ID: :0 screens: 1
  Screen-1: 0 s-res: 1920x1080 s-dpi: 96 s-size: 508x285mm (20.00x11.22")
    s-diag: 582mm (22.93")
  Monitor-1: HDMI-A-1 mapped: HDMI-A-0 model: LG (GoldStar) FULL HD
    serial: <filter> built: 2016 res: 1920x1080 hz: 75 dpi: 102 gamma: 1.2
    size: 480x270mm (18.9x10.63") diag: 551mm (21.7") ratio: 16:9 modes:
    max: 1920x1080 min: 720x400
  API: OpenGL v: 4.6 Mesa 23.1.3 renderer: AMD Radeon Vega 8 Graphics
    (raven LLVM 15.0.7 DRM 3.52 6.4.1-zen2-1-zen) direct-render: Yes
Audio:
  Device-1: AMD Raven/Raven2/Fenghuang HDMI/DP Audio
    vendor: ASUSTeK PRIME B450M-A driver: snd_hda_intel v: kernel pcie: gen: 3
    speed: 8 GT/s lanes: 16 bus-ID: 07:00.1 chip-ID: 1002:15de class-ID: 0403
  Device-2: AMD Family 17h/19h HD Audio vendor: ASUSTeK PRIME B450M-A
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 07:00.6 chip-ID: 1022:15e3 class-ID: 0403
  API: ALSA v: k6.4.1-zen2-1-zen status: kernel-api tools: N/A
  Server-1: PipeWire v: 0.3.72 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: ASUSTeK PRIME B450M-A driver: r8169 v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: f000 bus-ID: 05:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: enp5s0 state: down mac: <filter>
  Device-2: Realtek RTL8188EUS 802.11n Wireless Network Adapter
    driver: rtl8xxxu type: USB rev: 2.0 speed: 480 Mb/s lanes: 1 mode: 2.0
    bus-ID: 1-3:2 chip-ID: 0bda:8179 class-ID: 0000 serial: <filter>
  IF: wlp1s0f0u3 state: up mac: <filter>
Bluetooth:
  Device-1: Cambridge Silicon Radio Bluetooth Dongle (HCI mode) driver: btusb
    v: 0.8 type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-8:4
    chip-ID: 0a12:0001 class-ID: e001
  Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter>
Drives:
  Local Storage: total: 1.93 TiB used: 1.36 TiB (70.6%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/sda maj-min: 8:0 vendor: Western Digital
    model: WD20EZAZ-00GGJB0 size: 1.82 TiB block-size: physical: 4096 B
    logical: 512 B speed: 6.0 Gb/s tech: HDD rpm: 5400 serial: <filter>
    fw-rev: 0A80 scheme: GPT
  ID-2: /dev/sdb maj-min: 8:16 vendor: A-Data model: SU650 size: 111.79 GiB
    block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s tech: SSD
    serial: <filter> fw-rev: 831a scheme: GPT
Partition:
  ID-1: / raw-size: 102.69 GiB size: 102.69 GiB (100.00%)
    used: 78.72 GiB (76.7%) fs: btrfs dev: /dev/sdb2 maj-min: 8:18
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%)
    used: 576 KiB (0.2%) fs: vfat dev: /dev/sdb1 maj-min: 8:17
  ID-3: /home raw-size: 102.69 GiB size: 102.69 GiB (100.00%)
    used: 78.72 GiB (76.7%) fs: btrfs dev: /dev/sdb2 maj-min: 8:18
  ID-4: /var/log raw-size: 102.69 GiB size: 102.69 GiB (100.00%)
    used: 78.72 GiB (76.7%) fs: btrfs dev: /dev/sdb2 maj-min: 8:18
  ID-5: /var/tmp raw-size: 102.69 GiB size: 102.69 GiB (100.00%)
    used: 78.72 GiB (76.7%) fs: btrfs dev: /dev/sdb2 maj-min: 8:18
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default)
  ID-1: swap-1 type: zram size: 5.71 GiB used: 1.5 MiB (0.0%) priority: 100
    dev: /dev/zram0
  ID-2: swap-2 type: partition size: 8.8 GiB used: 0 KiB (0.0%) priority: -2
    dev: /dev/sdb3 maj-min: 8:19
Sensors:
  System Temperatures: cpu: 44.2 C mobo: N/A gpu: amdgpu temp: 44.0 C
  Fan Speeds (RPM): N/A
Info:
  Processes: 263 Uptime: 32m wakeups: 0 Memory: available: 5.71 GiB
  used: 2.58 GiB (45.1%) Init: systemd v: 253 default: graphical
  tool: systemctl Compilers: gcc: 13.1.1 clang: 15.0.7 Packages: pm: pacman
  pkgs: 1920 libs: 411 tools: paru Shell: fish v: 3.6.1 running-in: konsole
  inxi: 3.3.27
Garuda (2.6.16-1):
  System install date:     2023-01-09
  Last full system update: 2023-07-10 ↻
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager mkinitcpio
  Windows dual boot:       No/Undetected
  Failed units:            

I understand this is an unsupported software issue. But I thought the issue is with systemd.

Don’t get us/me wrong, please.
Garuda Linux produces various desktop interfaces that consist of various software components that Garuda Linux does not maintain or program. Even if there is some help here, this does not mean that the forum is responsible for all software. Therefore, unsupported software :slight_smile:

Did you search on github/gitlab?

By any chance, are you logging in with a Wayland session?

I tried to do that as well, in hopes that it would fix it. But didn't help at all.

None of them seem relevant. (And yeah I understand why its unsupported, you can't guarantee support like you would for Garuda specific stuff)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.