hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
21.97k stars 912 forks source link

Hyprland crashes if XDG_RUNTIME_DIR is set to a directory created by a script #6765

Closed Nanderty closed 5 months ago

Nanderty commented 5 months ago

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit 918d8340afd652b011b937d29d5eea0be08467f5 (flake.lock: update). Date: Tue Jun 25 12:06:02 2024 Tag: v0.41.2, commits: 4886 flags: (if any) System Information: System name: Linux Node name: NANDERTY Release: 6.9.7-gentoo Version: #3 SMP PREEMPT_DYNAMIC Wed Jul 3 23:12:51 CEST 2024 GPU information: 03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 [Radeon RX 7900 XT/7900 XTX/7900M] [1002:744c] (rev c8) (prog-if 00 [VGA controller]) os-release: NAME=Gentoo ID=gentoo PRETTY_NAME="Gentoo Linux" ANSI_COLOR="1;32" HOME_URL="https://www.gentoo.org/" SUPPORT_URL="https://www.gentoo.org/support/" BUG_REPORT_URL="https://bugs.gentoo.org/" VERSION_ID="2.15" plugins: ======Config-Start====== Config File: /home/Nanderty/.config/hypr/hyprland.conf: Read Succeeded monitor = DP-1, preferred, 2560x0, 1, bitdepth, 10 monitor = DP-2, preferred, 0x0, 1 env = XDG_RUNTIME_DIR,/run/Nanderty/test env = XDG_CURRENT_DESKTOP,Hyprland env = XDG_SESSION_DESKTOP,Hyprland env = ELECTRON_OZONE_PLATFORM_HINT,wayland env = GTK_THEME, Adwaita-dark exec-once = /opt/wl-clip-persist/wl-clip-persist --clipboard regular --all-mime-type-regex '(?i)^(?!image/x-inkscape-svg).+' exec-once = foot --server exec-once = ags general { gaps_in = 22 gaps_out = 44 border_size = 0 layout = dwindle } input { kb_layout = de repeat_rate = 30 repeat_delay = 200 follow_mouse = 1 sensitivity = -0.5 accel_profile = flat } decoration { rounding = 0 drop_shadow = false inactive_opacity = 0.7 blur { enabled = yes size = 4 passes = 2 ignore_opacity = true } } misc { disable_hyprland_logo = true vrr = 0 } animations { enabled = yes bezier = linear, 0, 0, 0, 0 animation = windows, 1, 2, linear, slide animation = workspaces, 1, 3, linear, slidevert animation = layers, 0 } master { orientation = center } # Workspace-Rules workspace = 1, monitor:DP-1, default:true workspace = 2, monitor:DP-2, default:true workspace = 3, monitor:DP-2 workspace = 4, monitor:DP-2 workspace = 5, monitor:DP-1 workspace = 6, monitor:DP-1 workspace = 7, monitor:DP-2 workspace = 8, monitor:DP-2 workspace = 9, monitor:DP-1 # Layer-Rules layerrule = blur, LogoutMenu # Window-Rules windowrule=noblur, zathura windowrule=opacity 1 override 1 override, zathura windowrule=noblur, foot windowrule=workspace 9, prismlauncher # Game Client windowrulev2 = float, class:^(league\sof\slegends\.exe)$,title:^(League\sof\sLegends\s\(TM\)\sClient)$ windowrulev2 = nomaxsize, class:^(league\sof\slegends\.exe)$,title:^(League\sof\sLegends\s\(TM\)\sClient)$ windowrulev2 = fullscreen, class:^(league\sof\slegends\.exe)$,title:^(League\sof\sLegends\s\(TM\)\sClient)$ windowrulev2 = stayfocused, title:^()$,class:^(steam)$ windowrulev2 = minsize 1 1, title:^()$,class:^(steam)$ # Bindings $mainMod = SUPER # General Keys bind = $mainMod, Q, killactive, bind = $mainMod, Escape, exec, ags -t LogoutMenu bind = $mainMod, M, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle bind = $mainMod, F9, exec, dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify_player /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause bind = $mainMod, F10, exec, dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify_player /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous bind = $mainMod, F11, exec, dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify_player /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next bind = $mainMod, Space, exec, mpc --host=/media/Music/mpd/socket toggle bind = $mainMod, Backspace, exec, mpc --host=/media/Music/mpd/socket prev bind = $mainMod, Return, exec, mpc --host=/media/Music/mpd/socket next binde = $mainMod, Prior, exec, mpc --host=/media/Music/mpd/socket volume +5 binde = $mainMod, Next, exec, mpc --host=/media/Music/mpd/socket volume -5 bind = SUPER, W, exec, grim -g "$(slurp)" /tmp/qrcode && wl-copy $(zbarimg /tmp/qrcode -q --raw) -p && firefox $(wl-paste -p) bind = $mainMod, up, exec, grimblast --notify save active bind = $mainMod, down, exec, grimblast --notify save area bind = $mainMod, left, exec, grimblast --notify copy active bind = $mainMod, right, exec, grimblast --notify copy area # Software bind = $mainMod, T, exec, footclient bind = $mainMod, S, exec, footclient spotify_player bind = $mainMod, F, exec, firefox bind = $mainMod, Z, exec, filezilla bind = $mainMod, Y, exec, zathura bind = $mainMod, B, exec, thunderbird bind = $mainMod, D, exec, /opt/vesktop/vesktop #bind = $mainMod, D, exec, firefox --new-window https://discord.com/channels/@me bind = $mainMod, F1, exec, steam bind = $mainMod, F2, exec, prismlauncher bind = $mainMod, F3, exec, libreoffice bind = $mainMod, F4, exec, gnumeric bind = $mainMod, F5, exec, /opt/mnova/mnova bind = $mainMod, F6, exec, blender-3.6 bind = $mainMod, F7, exec, inkscape bind = $mainMod, F8, exec, gimp bind = $mainMod, F12, exec, foot --server # Move focus bind = $mainMod, K, movefocus, u bind = $mainMod, J, movefocus, d bind = $mainMod, H, movefocus, l bind = $mainMod, L, movefocus, r bind = $mainMod, mouse_down, movefocus, l bind = $mainMod, mouse_up, movefocus, r # Switch workspaces bind = $mainMod, 1, workspace, 1 bind = $mainMod SHIFT, 1, movetoworkspace, 1 bind = $mainMod, 2, workspace, 2 bind = $mainMod SHIFT, 2, movetoworkspace, 2 bind = $mainMod, 3, workspace, 3 bind = $mainMod SHIFT, 3, movetoworkspace, 3 bind = $mainMod, 4, workspace, 4 bind = $mainMod SHIFT, 4, movetoworkspace, 4 bind = $mainMod, S, workspace, 4 bind = $mainMod, D, workspace, 4 bind = $mainMod, 5, workspace, 5 bind = $mainMod SHIFT, 5, movetoworkspace, 5 bind = $mainMod, 6, workspace, 6 bind = $mainMod SHIFT, 6, movetoworkspace, 6 bind = $mainMod, 7, workspace, 7 bind = $mainMod SHIFT, 7, movetoworkspace, 7 bind = $mainMod, 8, workspace, 8 bind = $mainMod SHIFT, 8, movetoworkspace, 8 bind = $mainMod, 9, workspace, 9 bind = $mainMod SHIFT, 9, movetoworkspace, 9 # Drag resize bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow # Arrow-key resize bind = $mainMod SHIFT, right, resizeactive, 100 0 bind = $mainMod SHIFT, down, resizeactive, 0 100 bind = $mainMod SHIFT, left, resizeactive, -100 0 bind = $mainMod SHIFT, up, resizeactive, 0 -100 ======Config-End======== ```

Description

A script running as root creates a directory as follows:

install -d -o Nanderty -g Nanderty -m 700 /run/Nanderty/xdgruntimedir

If I launch Hyprland with:

XDG_RUNTIME_DIR=/run/Nanderty/xdgruntimedir/ Hyprland

it crashes during startup. NOTE: dbus-daemon-session, pipewire, pipewire-pulse, wireplumber and mpd are succesfully using:

XDG_RUNTIME_DIR=/run/Nanderty/xdgruntimedir/

The reason this directory is created that way is that I am using s6/s6-rc for user services.

If I now run in the same agetty Hyprland just crashed in:

XDG_RUNTIME_DIR="/run/Nanderty/test"
mkdir -p $XDG_RUNTIME_DIR
chmod 700 $XDG_RUNTIME_DIR
XDG_RUNTIME_DIR=/run/Nanderty/test Hyprland

Hyprland works as usual.

How to reproduce

Use s6/s6-rc (or any script with root privileges?) (replacing "Nanderty" with a valid user) to run:

install -d -o Nanderty -g Nanderty -m 700 /run/Nanderty/xdgruntimedir

or:

mkdir -p /run/Nanderty/xdgruntimedir
chown -R Nanderty:Nanderty  /run/Nanderty
chmod -R 700 /run/Nanderty/xdgruntimedir

Now try starting Hyprland:

XDG_RUNTIME_DIR=/run/Nanderty/xdgruntimedir/ Hyprland

Crash reports, logs, images, videos

This is what I see in terminal:

Welcome to Hyprland!
[!!WARNING!!] XDG_RUNTIME_DIR looks non-standard. Proceeding anyways...
[LOG] Instance Signature: 918d8340afd652b011b937d29d5eea0be08467f5_1720080286_1057658749
[LOG] Runtime directory: /run/Nanderty/xdgruntimedir//hypr/918d8340afd652b011b937d29d5eea0be08467f5_1720080286_1057658749
[LOG] Hyprland PID: 8876
[LOG] ===== SYSTEM INFO: =====
[LOG] System name: Linux
[LOG] Node name: NANDERTY
[LOG] Release: 6.9.7-gentoo
[LOG] Version: #3 SMP PREEMPT_DYNAMIC Wed Jul  3 23:12:51 CEST 2024

[LOG] GPU information:
03:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Navi 31 [Radeon RX 7900 XT/7900 XTX/7900M] [1002:744c] (rev c8) (prog-if 00 [VGA controller])

[LOG] os-release:
NAME=Gentoo
ID=gentoo
PRETTY_NAME="Gentoo Linux"
ANSI_COLOR="1;32"
HOME_URL="https://www.gentoo.org/"
SUPPORT_URL="https://www.gentoo.org/support/"
BUG_REPORT_URL="https://bugs.gentoo.org/"
VERSION_ID="2.15"

[LOG] ========================

[INFO] If you are crashing, or encounter any bugs, please consult https://wiki.hyprland.org/Crashes-and-Bugs/

[LOG] 
Current splash: "Hyper".replace("e", "")

[LOG] Old rlimit: soft -> 1024, hard -> 4096
[LOG] New rlimit: soft -> 4096, hard -> 4096
[LOG] Creating the EventLoopManager!
[LOG] Creating the HookSystem!
[LOG] Creating the KeybindManager!
[LOG] Creating the AnimationManager!
[LOG] Created a bezier curve, baked 255 points, mem usage: 4.08kB, time to bake: 20.80µs. Estimated average calc time: 0.04µs.
[LOG] Creating the ConfigManager!
[LOG] Created a bezier curve, baked 255 points, mem usage: 4.08kB, time to bake: 10.99µs. Estimated average calc time: 0.02µs.
[LOG] Using config: /home/Nanderty/.config/hypr/hyprland.conf
[INFO] !!!!HEY YOU, YES YOU!!!!: further logs to stdout / logfile are disabled by default. BEFORE SENDING THIS LOG, ENABLE THEM. Use debug:disable_logs = false to do so: https://wiki.hyprland.org/Configuring/Variables/#debug
[LOG] Creating the CHyprError!
[LOG] Creating the LayoutManager!
[LOG] Creating the TokenManager!
[LOG] [hookSystem] New hook event registered: preConfigReload
[LOG] Created a bezier curve, baked 255 points, mem usage: 4.08kB, time to bake: 10.95µs. Estimated average calc time: 0.02µs.
[LOG] Using config: /home/Nanderty/.config/hypr/hyprland.conf
[LOG] Created a bezier curve, baked 255 points, mem usage: 4.08kB, time to bake: 11.01µs. Estimated average calc time: 0.03µs.
amdgpu: amdgpu_cs_ctx_create2 failed. (-13)
*** buffer overflow detected ***: terminated
Hyprland has crashed :( Consult the crash report at /home/Nanderty/.cache/hyprland/hyprlandCrashReport8876.txt for more information.
Aborted

hyprlandCrashReport8876.txt hyprland.log

Nanderty commented 5 months ago

I have now managed to get Hyprland at least started, using the following script in .bash_login:

export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/Nanderty/xdgruntimedir/session-bus"
export XDG_RUNTIME_DIR="/run/Nanderty/xdgruntimedir"
dbus-run-session Hyprland

But now it does not start socket 2:

ls -la /run/Nanderty/xdgruntimedir/hypr/918d8340afd652b011b937d29d5eea0be08467f5_1720095322_276098989/

srwxr-xr-x    - Nanderty Nanderty  4 Jul 14:15  .socket.sock
.rw-r--r--   16 Nanderty Nanderty  4 Jul 14:15  hyprland.lock
.rw-r--r-- 204k Nanderty Nanderty  4 Jul 14:18  hyprland.log

Edit: It doesn't work without "dbus-run-session", even though a session bus is correctly up and running and its address is properly exported.

Nanderty commented 5 months ago

After switching to:

XDG_RUNTIME_DIR="/run/Nanderty"

running:

export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/Nanderty/session-bus"
export XDG_RUNTIME_DIR="/run/Nanderty"
Hyprland

now works as it should. Thus, I am closing this for now. Anyway, I would be interested to know about the constrains of XDG_RUNTIME_DIR concerning Hyprland. Does it's parent dir have to have any special set of permissions? Is there anything else about it that has to be special, apart from its permissions?