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
19.95k stars 850 forks source link

running Hyprland as root with run0 #7788

Closed deviantsemicolon closed 2 weeks ago

deviantsemicolon commented 2 weeks ago

Already reported ? *

Regression?

No

System Info and Version

System/Version info ```sh Hyprland, built from branch at commit 118be4dea048df88fd21b84580fe62950c868c8f (). Date: 2024-09-12 Tag: , commits: 5215 flags: (if any) System Information: System name: Linux Node name: nsa-laptop Release: 6.10.9-cachyos Version: #1-NixOS SMP PREEMPT_DYNAMIC Sun Sep 8 05:56:41 UTC 2024 GPU information: 00:02.0 VGA compatible controller [0300]: Intel Corporation Raptor Lake-P [Iris Xe Graphics] [8086:a7a0] (rev 04) (prog-if 00 [VGA controller]) DeviceName: VGA compatible controller 01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA107M [GeForce RTX 3050 Mobile] [10de:25a2] (rev a1) (prog-if 00 [VGA controller]) NVRM version: NVIDIA UNIX x86_64 Kernel Module 560.35.03 Fri Aug 16 21:39:15 UTC 2024 os-release: ANSI_COLOR="1;34" BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues" BUILD_ID="24.11.20240910.1355a0c" DOCUMENTATION_URL="https://nixos.org/learn.html" HOME_URL="https://nixos.org/" ID=nixos IMAGE_ID="" IMAGE_VERSION="" LOGO="nix-snowflake" NAME=NixOS PRETTY_NAME="NixOS 24.11 (Vicuna)" SUPPORT_URL="https://nixos.org/community.html" VERSION="24.11 (Vicuna)" VERSION_CODENAME=vicuna VERSION_ID="24.11" plugins: ======Config-Start====== Config File: /home/dvnt/.config/hypr/hyprland.conf: Read Succeeded exec-once = /nix/store/4a86f7kq7757fjwf5zzwk0jxixn4330n-dbus-1.14.10/bin/dbus-update-activation-environment --systemd --all && systemctl --user stop hyprland-session.target && systemctl --user start hyprland-session.target $mainMod=SUPER animations { bezier=myBezier, 0.05, 0.9, 0.1, 1.05 animation=windows, 1, 7, myBezier animation=windowsOut, 1, 7, default, popin 80% animation=windowsOut, 1, 7, default, popin 80% animation=border, 1, 10, default animation=borderangle, 1, 8, default animation=fade, 1, 7, default animation=workspaces, 1, 6, default enabled=yes } decoration { col.shadow=rgba(1a1a1aee) drop_shadow=yes rounding=10 shadow_range=4 shadow_render_power=3 } dwindle { preserve_split=yes pseudotile=yes } general { border_size=2 col.active_border=rgba(f5c2e7ee) rgba(cba6f7ee) 45deg col.inactive_border=rgba(595959aa) gaps_in=5 gaps_out=20 layout=dwindle } gestures { workspace_swipe=off } input { touchpad { natural_scroll=no } follow_mouse=1 kb_layout=us kb_options=compose:ralt sensitivity=0 } bind=$mainMod, Q, exec, ghostty bind=$mainMod, E, exec, ghostty -e yazi bind=$mainMod, C, killactive bind=$mainMod, M, exit bind=$mainMod, V, togglefloating bind=$mainMod, R, exec, fuzzel bind=$mainMod, P, pseudo bind=$mainMod, J, togglesplit bind=$mainMod, F, exec, brave bind=$mainMod, S, exec, steam bind=$mainMod, left, movefocus, l bind=$mainMod, right, movefocus, r bind=$mainMod, up, movefocus, u bind=$mainMod, down, movefocus, d bind=$mainMod SHIFT, left, movewindow, l bind=$mainMod SHIFT, right, movewindow, r bind=$mainMod SHIFT, up, movewindow, u bind=$mainMod SHIFT, down, movewindow, d bind=$mainMod SHIFT, F, fullscreen bind=$mainMod, 1, workspace, 1 bind=$mainMod, 2, workspace, 2 bind=$mainMod, 3, workspace, 3 bind=$mainMod, 4, workspace, 4 bind=$mainMod, 5, workspace, 5 bind=$mainMod, 6, workspace, 6 bind=$mainMod, 7, workspace, 7 bind=$mainMod, 8, workspace, 8 bind=$mainMod, 9, workspace, 9 bind=$mainMod, 0, workspace, 10 bind=$mainMod SHIFT, 1, movetoworkspace, 1 bind=$mainMod SHIFT, 2, movetoworkspace, 2 bind=$mainMod SHIFT, 3, movetoworkspace, 3 bind=$mainMod SHIFT, 4, movetoworkspace, 4 bind=$mainMod SHIFT, 5, movetoworkspace, 5 bind=$mainMod SHIFT, 6, movetoworkspace, 6 bind=$mainMod SHIFT, 7, movetoworkspace, 7 bind=$mainMod SHIFT, 8, movetoworkspace, 8 bind=$mainMod SHIFT, 9, movetoworkspace, 9 bind=$mainMod SHIFT, 0, movetoworkspace, 10 bind=$mainMod, mouse_down, workspace, e+1 bind=$mainMod, mouse_up, workspace, e-1 bind=,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle bind=,PRINT, exec, hyprshot -m output bind=$mainMod, PRINT, exec, hyprshot -m window bind=$shiftMod, PRINT, exec, hyprshot -m region bind=$mainMod, L, exec, hyprlock binde=,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+ binde=,XF86MonBrightnessUp, exec, brightnessctl set +2% bindl=,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- bindl=,XF86MonBrightnessDown, exec, brightnessctl set 2%- bindm=$mainMod, mouse:272, movewindow bindm=$mainMod, mouse:273, resizewindow env=HYPRCURSOR_THEME,HyprCatppuccinMochaDark env=HYPRCURSOR_SIZE,24 env=XCURSOR_THEME,Catppuccin-Mocha-Dark-Cursors env=XCURSOR_SIZE,24 exec-once=hyprpaper exec-once=waybar exec-once=mako exec-once=lxqt-policy-agent exec-once=udiskie & monitor=eDP-1,1920x1080@144.00200,0x0,1 ======Config-End======== ```

Description

Using run0, rather than getting the root check that tells me to use the "--i-am-very-stupid" flag, I get the following:

[CRITICAL] Critical error thrown: XDG_RUNTIME_DIR is not set!
terminate called after throwing an instance of 'std::runtime_error'
  what():  XDG_RUNTIME_DIR is not set!

I'm not quite sure what to make of this, but I don't think the possibility of using hyprland through privilege escalation programs that are baked into systemd, like run0, should be overlooked.

I checked to see if this was an issue with me using fish, but it does not appear to be. Same thing happens on bash.

How to reproduce

  1. open terminal
  2. run run0 Hyprland
  3. Profit

Crash reports, logs, images, videos

2024-09-14-001509_hyprshot

Honkazel commented 2 weeks ago

1) Just don't, pls. 2) Idiot way: preserve user environment(why?). Read manuals. 3) More idiotic way: somehow set your env for your prvlg esc program(sudo/doas/run0) or do it from root login(WHYYYYYYYY?). Also read manuals.

Pls, close your issue ASAP, even if it doesn't work(or Vaxry will do this for you anyway). Running Hyprland from root is just stupid

fufexan commented 2 weeks ago

@Honkazel this is a valid issue. Hyprland should have a more robust root check.

Honkazel commented 2 weeks ago

@Honkazel this is a valid issue. Hyprland should have a more robust root check.

Ah, okay

deviantsemicolon commented 2 weeks ago
  1. Just don't, pls.
  2. Idiot way: preserve user environment(why?). Read manuals.
  3. More idiotic way: somehow set your env for your prvlg esc program(sudo/doas/run0) or do it from root login(WHYYYYYYYY?). Also read manuals.

Pls, close your issue ASAP, even if it doesn't work(or Vaxry will do this for you anyway). Running Hyprland from root is just stupid

I'm aware it is stupid. I wanted to see if it was possible

vaxerski commented 2 weeks ago

No, this is not a valid issue, the error tells you all that you need to know. XDG_RUNTIME_DIR is not set, which means hyprland cannot run.