v0.5.6: anaconda --cmdline + XDG_RUNTIME_DIR for unattended install

v0.5.5 fixed AnacondaError: 'LANG'. Auto-install harness then
hit next crash:

  TypeError: expected str, bytes or os.PathLike object, not NoneType
  File "/usr/lib64/python3.14/site-packages/pyanaconda/display.py", line 223
    wl_socket_path = os.path.join(os.getenv("XDG_RUNTIME_DIR"), ...)

anaconda's display.setup_display() unconditionally tries to set up
Wayland socket path. tty1 has no XDG_RUNTIME_DIR set. None gets passed
to os.path.join → TypeError.

Two-part fix:
1. export XDG_RUNTIME_DIR=/run/user/0 + mkdir, so even if anaconda
   probes it, the env var has a valid string value.
2. Pass --cmdline to anaconda. Fully unattended text-only mode, no
   Wayland/X/TUI. Right fit for our gum-driven kickstart flow where
   ks is self-contained (disk, pw, locale all pre-answered).

Combined effect: anaconda goes straight from CLI parse → kickstart
execute → reboot. No display subsystem at all.

Surfaced by test/auto-install.sh round 2.
This commit is contained in:
veilor-org 2026-05-03 01:35:52 +01:00
parent 5e38412944
commit ac371bdc36

View file

@ -529,7 +529,17 @@ Logs: /var/log/veilor-installer.log + /tmp/anaconda.log"
# default. Use the locale the user picked (or fall back to en_GB). # default. Use the locale the user picked (or fall back to en_GB).
export LANG="${SEL_LOCALE:-en_GB.UTF-8}" export LANG="${SEL_LOCALE:-en_GB.UTF-8}"
export LC_ALL="$LANG" export LC_ALL="$LANG"
if anaconda --kickstart=/run/install/veilor-generated.ks; then # XDG_RUNTIME_DIR must exist — anaconda's display.setup_display()
# tries os.getenv("XDG_RUNTIME_DIR") + constants.WAYLAND_SOCKET_NAME
# and crashes with TypeError on None. We're running unattended so
# no graphical display is needed, but the env var still has to exist.
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
mkdir -p "$XDG_RUNTIME_DIR"
chmod 0700 "$XDG_RUNTIME_DIR"
# --cmdline: fully unattended text-only mode. No Wayland setup, no
# graphical/text TUI. Reads kickstart, executes, reboots. Right mode
# for our gum-driven flow where ks is fully self-contained.
if anaconda --cmdline --kickstart=/run/install/veilor-generated.ks; then
prompt_message "Install complete. System will reboot. prompt_message "Install complete. System will reboot.
Remove the install media after shutdown." Remove the install media after shutdown."
sleep 3 sleep 3