base: Add script to show hardware information if IncusOS fails to start

Signed-off-by: Mathias Gibbens <mathias.gibbens@futurfusion.io>
This commit is contained in:
Mathias Gibbens
2025-11-21 13:29:57 -07:00
parent 51c6c0d444
commit 93bc371d1c
5 changed files with 53 additions and 1 deletions

View File

@@ -49,5 +49,7 @@ KernelModulesInitrdInclude=default
vmd
InitrdPackages=initrd-tmpfs-root
kpartx
pciutils
usbutils
RemoveFiles=/boot/*zabbly*
/boot/EFI/mkosi.der

View File

@@ -5,4 +5,6 @@ initrd-tmpfs-root.service usr/lib/systemd/system/
00-device-timeout.conf usr/lib/systemd/system.conf.d/
initrd-message.service usr/lib/systemd/system/
initrd-message.service usr/lib/systemd/system/
initrd-show-devices.service usr/lib/systemd/system/
initrd-show-devices.sh usr/bin/

View File

@@ -1 +1,2 @@
usr/lib/systemd/system/initrd-message.service usr/lib/systemd/system/veritysetup.target.wants/initrd-message.service
usr/lib/systemd/system/initrd-show-devices.service usr/lib/systemd/system/emergency.target.wants/initrd-show-devices.service

View File

@@ -0,0 +1,14 @@
[Unit]
Description=Show system devices
After=emergency.target
DefaultDependencies=no
[Service]
Type=oneshot
Environment=TTYS="/dev/tty1 /dev/ttyS0"
ExecStart=/usr/bin/initrd-show-devices.sh
[Install]
WantedBy=emergency.target

View File

@@ -0,0 +1,33 @@
#!/bin/sh
# shellcheck disable=SC3000-SC4000
while true; do
for TTY in $TTYS; do
echo -e "\033cIncusOS failed to start. Debug information follows." > "$TTY" || true
echo "$ lsblk" > "$TTY" || true
lsblk > "$TTY" || true
done
sleep 10
for TTY in $TTYS; do
echo -e "\033cIncusOS failed to start. Debug information follows." > "$TTY" || true
echo "$ lscpi" > "$TTY" || true
lspci > "$TTY" || true
done
sleep 10
for TTY in $TTYS; do
echo -e "\033cIncusOS failed to start. Debug information follows." > "$TTY" || true
echo "$ lsusb" > "$TTY" || true
lsusb > "$TTY" || true
done
sleep 10
for TTY in $TTYS; do
echo -e "\033cIncusOS failed to start. Debug information follows." > "$TTY" || true
echo "$ ls -lh /sys/class/block/*/device/driver" > "$TTY" || true
ls -lh /sys/class/block/*/device/driver > "$TTY" || true
done
sleep 10
done