Compare commits

...

4 Commits

Author SHA1 Message Date
99af60bc16 fix(image): don't abort USB build on invalid nginx config (set -e trap)
Some checks are pending
License Headers / check (push) Waiting to run
The 'final nginx cleanup' branch runs precisely when nginx -t fails, but
nginx_error=$(nginx -t|head) and missing_file=$(...grep...) then trip
set -e/pipefail and abort the whole build right after the warn. Guard both
with || true. nginx config is regenerated at first boot by secubox-net-detect,
so a build-time-invalid config is non-fatal. This was the last blocker on the
amd64 USB (kiosk + everything else already pass).
2026-06-28 11:27:16 +02:00
854805fbbd fix(image): build-live-usb.sh accept --kiosk (was only --no-kiosk)
The workflow passes --kiosk (consistent with build-rpi-usb.sh); build-live-usb.sh
only had --no-kiosk and erred 'Unknown argument: --kiosk', failing the x64 USB
build. Add a --kiosk case (INCLUDE_KIOSK=1).
2026-06-28 11:14:19 +02:00
b945c831a0 fix(image): policy-rc.d so the kiosk (X11/chromium) installs in chroot
The live-usb kiosk stack (dbus, X11, chromium) aborted its postinst in the
init-less chroot ('Failed to connect to system message bus', invoke-rc.d
errors), failing the build. Add /usr/sbin/policy-rc.d (exit 101) before the
installs and remove it before squashfs, so packages don't try to start
services at build time but the booted system still does. Keep kiosk ON for
amd64 USB (extra_args=--kiosk). Do NOT disable kiosk.
2026-06-28 11:05:08 +02:00
2b52eaa330 fix(image): global dpkg force-confold in live-usb chroot (mesh.toml prompt)
The per-install flag didn't cover secubox-mesh's configure path; write
/etc/dpkg/dpkg.cfg.d/90-secubox-confold (force-confold/confdef) into the chroot
before any install so every dpkg op keeps conffiles and never prompts. Fixes
'end of file on stdin at conffile prompt' aborting the amd64 USB build.
2026-06-28 10:45:16 +02:00
2 changed files with 31 additions and 4 deletions

View File

@ -48,6 +48,7 @@ jobs:
output_pattern: "secubox-live-amd64-*.img*" output_pattern: "secubox-live-amd64-*.img*"
needs_qemu: false needs_qemu: false
embed_image: false embed_image: false
extra_args: "--kiosk"
# MOCHAbin (arm64) - U-Boot distroboot # MOCHAbin (arm64) - U-Boot distroboot
- platform: mochabin - platform: mochabin

View File

@ -104,6 +104,7 @@ while [[ $# -gt 0 ]]; do
--out) OUT_DIR="$2"; shift 2 ;; --out) OUT_DIR="$2"; shift 2 ;;
--size) IMG_SIZE="$2"; shift 2 ;; --size) IMG_SIZE="$2"; shift 2 ;;
--local-cache) USE_LOCAL_CACHE=1; shift ;; --local-cache) USE_LOCAL_CACHE=1; shift ;;
--kiosk) INCLUDE_KIOSK=1; shift ;;
--no-kiosk) INCLUDE_KIOSK=0; shift ;; --no-kiosk) INCLUDE_KIOSK=0; shift ;;
--no-persistence) INCLUDE_PERSISTENCE=0; shift ;; --no-persistence) INCLUDE_PERSISTENCE=0; shift ;;
--no-compress) NO_COMPRESS=1; shift ;; --no-compress) NO_COMPRESS=1; shift ;;
@ -1137,6 +1138,24 @@ mount_chroot_fs() {
mount_chroot_fs mount_chroot_fs
# Make EVERY dpkg op in the chroot keep existing conffiles and never prompt.
# secubox-mesh's mesh.toml is an auto-detected conffile; in the headless chroot
# its prompt aborts with "end of file on stdin at conffile prompt", failing the
# whole build. dpkg.cfg.d covers apt installs AND bare `dpkg --configure -a`.
install -d "${ROOTFS}/etc/dpkg/dpkg.cfg.d"
printf 'force-confold\nforce-confdef\n' > "${ROOTFS}/etc/dpkg/dpkg.cfg.d/90-secubox-confold"
# Deny service start/stop/reload during install — the chroot has no running
# init/dbus, so packages like dbus / the kiosk X11+chromium stack abort their
# postinst ("Failed to connect to system message bus", invoke-rc.d errors),
# which fails the whole build. Removed before squashfs so the real system
# boots services normally (systemd starts enabled units regardless).
cat > "${ROOTFS}/usr/sbin/policy-rc.d" <<'POLICY'
#!/bin/sh
exit 101
POLICY
chmod +x "${ROOTFS}/usr/sbin/policy-rc.d"
cat > "${ROOTFS}/etc/apt/sources.list" <<EOF cat > "${ROOTFS}/etc/apt/sources.list" <<EOF
deb ${APT_MIRROR} ${SUITE} main contrib non-free non-free-firmware deb ${APT_MIRROR} ${SUITE} main contrib non-free non-free-firmware
deb ${APT_MIRROR} ${SUITE}-updates main contrib non-free non-free-firmware deb ${APT_MIRROR} ${SUITE}-updates main contrib non-free non-free-firmware
@ -3197,12 +3216,16 @@ fi
# Verify nginx config is valid # Verify nginx config is valid
if [[ -x "${ROOTFS}/usr/sbin/nginx" ]]; then if [[ -x "${ROOTFS}/usr/sbin/nginx" ]]; then
if ! chroot "${ROOTFS}" nginx -t 2>&1 | grep -q "syntax is ok"; then if ! chroot "${ROOTFS}" nginx -t 2>&1 | grep -q "syntax is ok"; then
warn "nginx config still invalid after final cleanup" warn "nginx config still invalid after final cleanup (regenerated at first boot)"
# Show the error and try to fix # Show the error and try to fix. `|| true`: nginx -t returns non-zero here
nginx_error=$(chroot "${ROOTFS}" nginx -t 2>&1 | head -5) # (config IS invalid — that's why we're in this branch), so without it the
# command substitution trips set -e/pipefail and aborts the whole build
# right after this warn. The image's nginx config is rebuilt at first boot
# by secubox-net-detect, so a build-time-invalid config is non-fatal.
nginx_error=$(chroot "${ROOTFS}" nginx -t 2>&1 | head -5 || true)
echo "$nginx_error" echo "$nginx_error"
# Extract missing file from error message and create empty config # Extract missing file from error message and create empty config
missing_file=$(echo "$nginx_error" | grep -oP '"/etc/nginx/secubox\.d/\K[^"]+') missing_file=$(echo "$nginx_error" | grep -oP '"/etc/nginx/secubox\.d/\K[^"]+' || true)
if [[ -n "$missing_file" ]]; then if [[ -n "$missing_file" ]]; then
log "Creating missing config: $missing_file" log "Creating missing config: $missing_file"
touch "${ROOTFS}/etc/nginx/secubox.d/${missing_file}" touch "${ROOTFS}/etc/nginx/secubox.d/${missing_file}"
@ -3341,6 +3364,9 @@ umount -lf "${ROOTFS}/sys" 2>/dev/null || true
log "7/8 Creating SquashFS filesystem..." log "7/8 Creating SquashFS filesystem..."
mkdir -p "${LIVE_DIR}/live" mkdir -p "${LIVE_DIR}/live"
# Remove the build-time service-deny shim so the booted system starts services.
rm -f "${ROOTFS}/usr/sbin/policy-rc.d"
mksquashfs "${ROOTFS}" "${LIVE_DIR}/live/filesystem.squashfs" \ mksquashfs "${ROOTFS}" "${LIVE_DIR}/live/filesystem.squashfs" \
-comp xz -b 1M -Xdict-size 100% -e boot/grub -e boot/efi -comp xz -b 1M -Xdict-size 100% -e boot/grub -e boot/efi