Summary
/usr/libexec/secure-ai/detect-vm.sh writes a multi-line HYPERVISOR= value into /var/lib/secure-ai/vm.env on bare-metal hardware, and the consuming service then fails with none: command not found because the env file gets sourced by a shell.
Environment
- SecAI_OS v0.3.0
- Bare metal (no virtualization)
Reproduction
- Boot v0.3.0 ISO on a bare-metal machine.
- Watch first-boot wizard fail. Or, post-install:
sudo /usr/libexec/secure-ai/detect-vm.sh
cat /var/lib/secure-ai/vm.env
- Note
HYPERVISOR= is multi-line and contains the literal word none plus error fragments.
Root cause
systemd-detect-virt on bare metal prints none\n to stdout and exits with code 1. The script uses something like:
HYPERVISOR=$(systemd-detect-virt) || HYPERVISOR=none
Because systemd-detect-virt succeeded at producing output but exited non-zero, the || branch also runs, appending another none and any stderr fragments. The resulting HYPERVISOR value is multi-line, which then writes to vm.env as:
When sourced by a downstream shell (. /var/lib/secure-ai/vm.env), the second line becomes a command lookup → none: command not found.
Suggested fix
H=$(systemd-detect-virt 2>/dev/null)
HYPERVISOR="${H:-none}"
# explicitly tolerate the exit code:
true
Or simply:
HYPERVISOR=$(systemd-detect-virt 2>/dev/null || true)
HYPERVISOR="${HYPERVISOR:-none}"
And always quote the value when writing the env file:
printf 'HYPERVISOR=%s\n' "$HYPERVISOR" >> /var/lib/secure-ai/vm.env
My local workaround
Replaced the script with a stub writing a known-good vm.env:
IS_VM=false
HYPERVISOR=none
GPU_PASSTHROUGH=true
VM_WARNINGS=
VM_GPU_ENABLED=false
Same root cause hits detect-tee.sh (filed separately).
🤖 Generated with claude-flow
Summary
/usr/libexec/secure-ai/detect-vm.shwrites a multi-lineHYPERVISOR=value into/var/lib/secure-ai/vm.envon bare-metal hardware, and the consuming service then fails withnone: command not foundbecause the env file gets sourced by a shell.Environment
Reproduction
HYPERVISOR=is multi-line and contains the literal wordnoneplus error fragments.Root cause
systemd-detect-virton bare metal printsnone\nto stdout and exits with code 1. The script uses something like:Because
systemd-detect-virtsucceeded at producing output but exited non-zero, the||branch also runs, appending anothernoneand any stderr fragments. The resultingHYPERVISORvalue is multi-line, which then writes tovm.envas:When sourced by a downstream shell (
. /var/lib/secure-ai/vm.env), the second line becomes a command lookup →none: command not found.Suggested fix
Or simply:
And always quote the value when writing the env file:
My local workaround
Replaced the script with a stub writing a known-good
vm.env:Same root cause hits
detect-tee.sh(filed separately).🤖 Generated with claude-flow