#!/bin/sh # Dump everything worth knowing when `vm-hyprland` fails. # # The compositor's own log is the thing you actually want and the thing that is # hardest to find: Hyprland writes it under # $XDG_RUNTIME_DIR/hypr//hyprland.log, and the service runs # on a private XDG_RUNTIME_DIR. So rather than guess the path, look for it. # # Never fails: a diagnostics dump that exits non-zero hides the real error. PATH="@diagPath@:$PATH" export PATH if [ "$1" = "--self-test" ]; then echo "hhs-hyprland-diagnostics: ok" exit 0 fi SERVICE_UNIT=hyprland-headless-stream.service COMPOSITOR_UNIT=hyprland-headless.service say() { printf '\n----- %s -----\n' "$*"; } run() { say "$*"; "$@" 2>&1 || echo "[exit $?]"; } say "units" systemctl --no-pager --plain list-units --all 'hyprland*' 2>&1 || true for unit in "$COMPOSITOR_UNIT" "$SERVICE_UNIT"; do run systemctl --no-pager --full status "$unit" run journalctl --no-pager --boot --lines=200 --unit "$unit" done run systemctl --no-pager --full list-dependencies "$SERVICE_UNIT" say "socket and runtime directories" ls -la /run/hyprland-headless-stream 2>&1 || echo "[no /run/hyprland-headless-stream]" ls -la /run/user 2>&1 || echo "[no /run/user]" for d in /run/user/*; do [ -d "$d" ] && ls -la "$d" 2>&1 done say "hyprland logs" # hyprland.log lives beside the compositor's IPC sockets; -xdev keeps this out # of /nix/store and /proc. found=0 for root in /run /var/log /tmp /home; do [ -d "$root" ] || continue for log in $(find "$root" -xdev -maxdepth 6 -name 'hyprland*.log' 2>/dev/null); do found=1 say "tail -n 200 $log" tail -n 200 "$log" 2>&1 done done [ "$found" = 1 ] || echo "[no hyprland*.log anywhere under /run /var/log /tmp /home]" say "hyprctl monitors" # Needs both XDG_RUNTIME_DIR and the instance signature, which is the directory # name under /hypr. Try every instance we can find. tried=0 for hyprdir in /run/user/*/hypr/* /run/*/hypr/*; do [ -d "$hyprdir" ] || continue sig=$(basename "$hyprdir") runtime=$(dirname "$(dirname "$hyprdir")") owner=$(stat -c %U "$hyprdir" 2>/dev/null || echo root) tried=1 say "hyprctl monitors (instance $sig, XDG_RUNTIME_DIR=$runtime, as $owner)" if command -v hyprctl > /dev/null 2>&1; then XDG_RUNTIME_DIR="$runtime" HYPRLAND_INSTANCE_SIGNATURE="$sig" \ hyprctl monitors 2>&1 || echo "[exit $?]" XDG_RUNTIME_DIR="$runtime" HYPRLAND_INSTANCE_SIGNATURE="$sig" \ hyprctl version 2>&1 || echo "[exit $?]" else echo "[hyprctl not on PATH; add the hyprlandPackage to environment.systemPackages]" fi done [ "$tried" = 1 ] || echo "[no hypr instance directory found: the compositor never came up]" say "processes" ps aux 2>&1 | grep -E 'hypr|hhstream|grim' | grep -v grep || echo "[no hyprland/hhstream/grim process]" say "end of diagnostics" exit 0