From 6c2b188ec910dcdd8a7cacc12104ef41a8717a14 Mon Sep 17 00:00:00 2001 From: Michael Chus Date: Sun, 3 May 2026 21:14:45 +0300 Subject: [PATCH] Add no-GUI boot mode and quieter boot diagnostics --- audit/internal/app/support_bundle.go | 125 ++++++++++++++++++ audit/internal/webui/server.go | 21 ++- audit/internal/webui/server_test.go | 19 +++ iso/builder/build.sh | 11 ++ .../config/bootloaders/grub-efi/grub.cfg | 5 + .../config/bootloaders/isolinux/live.cfg.in | 6 + .../hooks/normal/9000-bee-setup.hook.chroot | 1 + .../etc/systemd/system/bee-audit.service | 2 +- .../etc/systemd/system/bee-network.service | 3 +- .../etc/systemd/system/bee-preflight.service | 2 +- .../lightdm.service.d/bee-gui-gate.conf | 2 + iso/overlay/usr/local/bin/bee-gui-gate | 27 ++++ iso/overlay/usr/local/bin/bee-network.sh | 78 ++++++++--- 13 files changed, 278 insertions(+), 24 deletions(-) create mode 100644 iso/overlay/etc/systemd/system/lightdm.service.d/bee-gui-gate.conf create mode 100755 iso/overlay/usr/local/bin/bee-gui-gate diff --git a/audit/internal/app/support_bundle.go b/audit/internal/app/support_bundle.go index fc95334..96bfa3e 100644 --- a/audit/internal/app/support_bundle.go +++ b/audit/internal/app/support_bundle.go @@ -24,6 +24,8 @@ var supportBundleServices = []string{ "bee-selfheal.service", "bee-selfheal.timer", "bee-sshsetup.service", + "display-manager.service", + "lightdm.service", "nvidia-dcgm.service", "nvidia-fabricmanager.service", } @@ -44,12 +46,128 @@ var supportBundleCommands = []struct { {name: "system/mount.txt", cmd: []string{"mount"}}, {name: "system/df-h.txt", cmd: []string{"df", "-h"}}, {name: "system/dmesg.txt", cmd: []string{"dmesg"}}, + {name: "system/dmesg-gui-video-input.txt", cmd: []string{"sh", "-c", ` +if command -v dmesg >/dev/null 2>&1; then + dmesg | grep -iE 'nvidia|drm|fb|framebuffer|vesa|efi|lightdm|Xorg|input|hid|usb|keyboard|mouse|virtual keyboard|virtual mouse|ami|aspeed|ast' || echo "no GUI/video/input kernel messages found" +else + echo "dmesg not found" +fi +`}}, {name: "system/kernel-aer-nvidia.txt", cmd: []string{"sh", "-c", ` if command -v dmesg >/dev/null 2>&1; then dmesg | grep -iE 'AER|NVRM|Xid|pcieport|nvidia' || echo "no AER/NVRM/Xid kernel messages found" else echo "dmesg not found" fi +`}}, + {name: "system/loginctl-sessions.txt", cmd: []string{"sh", "-c", ` +if command -v loginctl >/dev/null 2>&1; then + loginctl list-sessions 2>&1 || true +else + echo "loginctl not found" +fi +`}}, + {name: "system/loginctl-seats.txt", cmd: []string{"sh", "-c", ` +if command -v loginctl >/dev/null 2>&1; then + loginctl list-seats 2>&1 || true + echo + for seat in $(loginctl list-seats --no-legend 2>/dev/null | awk '{print $1}'); do + echo "=== $seat ===" + loginctl seat-status "$seat" 2>&1 || true + echo + done +else + echo "loginctl not found" +fi +`}}, + {name: "system/ps-gui.txt", cmd: []string{"sh", "-c", ` +ps -ef | grep -iE 'lightdm|Xorg|X$|openbox|chromium|chrome|xinit|xsession' | grep -v grep || echo "no GUI processes found" +`}}, + {name: "system/lspci-video-vv.txt", cmd: []string{"sh", "-c", ` +if ! command -v lspci >/dev/null 2>&1; then + echo "lspci not found" + exit 0 +fi +found=0 +for dev in $(lspci -Dn | awk '$2 ~ /^03(00|02):$/ {print $1}'); do + found=1 + echo "=== $dev ===" + lspci -s "$dev" -vv 2>&1 || true + echo +done +if [ "$found" -eq 0 ]; then + echo "no display-class PCI devices found" +fi +`}}, + {name: "system/proc-fb.txt", cmd: []string{"cat", "/proc/fb"}}, + {name: "system/drm-cards.txt", cmd: []string{"sh", "-c", ` +if [ -d /sys/class/drm ]; then + for path in /sys/class/drm/card*; do + [ -e "$path" ] || continue + card=$(basename "$path") + echo "=== $card ===" + for f in status enabled dpms modes; do + [ -r "$path/$f" ] && printf " %-8s %s\n" "$f" "$(cat "$path/$f" 2>/dev/null)" + done + device=$(readlink -f "$path/device" 2>/dev/null || true) + [ -n "$device" ] && echo " device ${device##*/}" + echo + done +else + echo "/sys/class/drm not present" +fi +`}}, + {name: "system/input-devices.txt", cmd: []string{"sh", "-c", ` +if [ -r /proc/bus/input/devices ]; then + cat /proc/bus/input/devices +else + echo "/proc/bus/input/devices not readable" +fi +`}}, + {name: "system/udevadm-input.txt", cmd: []string{"sh", "-c", ` +if ! command -v udevadm >/dev/null 2>&1; then + echo "udevadm not found" + exit 0 +fi +found=0 +for dev in /dev/input/event*; do + [ -e "$dev" ] || continue + found=1 + echo "=== $dev ===" + udevadm info --query=all --name="$dev" 2>&1 || true + echo +done +if [ "$found" -eq 0 ]; then + echo "no /dev/input/event* devices found" +fi +`}}, + {name: "system/xinput-list.txt", cmd: []string{"sh", "-c", ` +if command -v xinput >/dev/null 2>&1; then + DISPLAY=:0 xinput --list 2>&1 || true +else + echo "xinput not found" +fi +`}}, + {name: "system/libinput-list-devices.txt", cmd: []string{"sh", "-c", ` +if command -v libinput >/dev/null 2>&1; then + libinput list-devices 2>&1 || true +else + echo "libinput not found" +fi +`}}, + {name: "system/systemctl-gui-units.txt", cmd: []string{"sh", "-c", ` +if ! command -v systemctl >/dev/null 2>&1; then + echo "systemctl not found" + exit 0 +fi +echo "=== unit files ===" +systemctl list-unit-files --no-pager --all 'lightdm*' 'display-manager*' 2>&1 || true +echo +echo "=== active units ===" +systemctl list-units --no-pager --all 'lightdm*' 'display-manager*' 2>&1 || true +echo +echo "=== failed units ===" +systemctl --failed --no-pager 2>&1 | grep -iE 'lightdm|display-manager|Xorg' || echo "no failed GUI units" `}}, {name: "system/nvidia-smi-q.txt", cmd: []string{"nvidia-smi", "-q"}}, {name: "system/nvidia-smi-topo.txt", cmd: []string{"sh", "-c", ` @@ -236,6 +354,13 @@ var supportBundleOptionalFiles = []struct { }{ {name: "system/kern.log", src: "/var/log/kern.log"}, {name: "system/syslog.txt", src: "/var/log/syslog"}, + {name: "system/Xorg.0.log", src: "/var/log/Xorg.0.log"}, + {name: "system/Xorg.0.log.old", src: "/var/log/Xorg.0.log.old"}, + {name: "system/lightdm/lightdm.log", src: "/var/log/lightdm/lightdm.log"}, + {name: "system/lightdm/x-0.log", src: "/var/log/lightdm/x-0.log"}, + {name: "system/lightdm/x-0-greeter.log", src: "/var/log/lightdm/x-0-greeter.log"}, + {name: "system/home-bee-xsession-errors.log", src: "/home/bee/.xsession-errors"}, + {name: "system/home-bee-chromium-debug.log", src: "/tmp/bee-chrome/chrome_debug.log"}, {name: "system/fabricmanager.log", src: "/var/log/fabricmanager.log"}, {name: "system/nvlsm.log", src: "/var/log/nvlsm.log"}, {name: "system/fabricmanager/fabricmanager.log", src: "/var/log/fabricmanager/fabricmanager.log"}, diff --git a/audit/internal/webui/server.go b/audit/internal/webui/server.go index b974b92..18853c0 100644 --- a/audit/internal/webui/server.go +++ b/audit/internal/webui/server.go @@ -1323,8 +1323,20 @@ td:first-child{color:#718096;width:55%}