From a03c5c44f12f4dd68e56c377f3c2bbc6d238422c Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 2 Sep 2026 06:23:03 +0300 Subject: [PATCH 1/4] fix: commit machine-id and mark first boot done at build Prevents systemd-firstboot (First Boot Wizard) from activating on first boot of a flashed image. With an uninitialized machine-id, systemd runs the first-boot wizard, which in headless rigs (no keyboard) can block boot waiting for console input (observed as 'First Boot Wizard' in the FullPageOS 1.0.0-rc1 boot log on Raspberry Pi 5, part of #708). systemd-machine-id-setup commits a real machine-id at build time and /var/lib/systemd/first-boot-done marks first boot as completed. --- src/modules/base/end_chroot_script | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/modules/base/end_chroot_script b/src/modules/base/end_chroot_script index 0a7a9e82..5bc2b38a 100755 --- a/src/modules/base/end_chroot_script +++ b/src/modules/base/end_chroot_script @@ -49,6 +49,21 @@ else fi fi +# Prevent systemd-firstboot (First Boot Wizard) from blocking first boot: +# /etc/machine-id is "uninitialized" in a fresh image, which makes systemd +# detect first boot and prompt for locale/keymap/timezone/root password on tty1. +# The wizard is not reachable headlessly (no HDMI/KVM on the test jig), so mark +# first boot as done and commit a real machine-id here. +if [ ! -s /etc/machine-id ] || [ "$(cat /etc/machine-id)" = "uninitialized" ]; then + if command -v systemd-machine-id-setup >/dev/null 2>&1; then + systemd-machine-id-setup + else + : > /etc/machine-id + fi +fi +mkdir -p /var/lib/systemd +touch /var/lib/systemd/first-boot-done + #cleanup if [ "${BASE_APT_CLEAN}" = "yes" ]; then apt-get clean From f79c13eb70aea58b1e68505ae0704bd5562ef696 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 2 Sep 2026 08:28:56 +0300 Subject: [PATCH 2/4] fix: run lightdm autologin fixup after userconf-pi first boot dialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit update_lightdm_conf.service is wanted by lightdm.service, so its start job is queued in parallel with multi-user.target — it raced (and on FullPageOS 1.0.0-rc1 lost against) userconfig.service, whose cancel-rename applies do_boot_behaviour B3/B4: re-creating the getty@tty1 autologin drop-in and re-enabling getty@tty1. GUI distros ended up with a TTY autologin shell, the exact issue https://github.com/guysoft/FullPageOS/issues/639 set out to fix. - Order update_lightdm_conf.service After=userconfig.service so the cleanup lands last on first boot. - Always remove the getty@tty1 autologin drop-in (cancel-rename may have just re-created it); do_autologin 2 is kept for newer raspi-config bitmask semantics, with the manual lightdm.conf fallback still applied. - Do not abort (set -e) when uid 1000 does not exist yet or raspi-config is missing; fall back to BASE_USER pi. Verified on hardware (Pi 5 rig, FullPageOS RC1): first boot with these changes leaves autologin-user=pi/autologin-session=guisession in lightdm.conf and NO /etc/systemd/system/getty@tty1.service.d/autologin.conf. --- .../opt/scripts/update_lightdm_conf | 20 ++++++++++++++----- .../system/update_lightdm_conf.service | 6 ++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/modules/gui/filesystem/opt/scripts/update_lightdm_conf b/src/modules/gui/filesystem/opt/scripts/update_lightdm_conf index 08dc9716..e35b77db 100755 --- a/src/modules/gui/filesystem/opt/scripts/update_lightdm_conf +++ b/src/modules/gui/filesystem/opt/scripts/update_lightdm_conf @@ -16,16 +16,26 @@ set_lightdm_option() { } if [ ! -f /etc/updated_lightdm_conf ]; then - gui_user="$(id -nu 1000)" + # uid 1000 may not exist yet if userconf-pi has not processed userconf.txt + # yet (first boot ordering); fall back to the placeholder name. + gui_user="$(id -nu 1000 2>/dev/null || true)" + if [ -z "${gui_user}" ]; then + gui_user="pi" + fi sed -i "s/UID_1000_PLACEHOLDER/${gui_user}/g" "${LIGHTDM_CONF}" # raspi-config do_autologin uses a bitmask: 1=TTY, 2=GUI, 3=both. + # (Older raspi-config versions without the bitmask return non-zero here, + # and we apply the GUI autologin manually below.) # FullPageOS needs GUI autologin without opening a local tty shell. - if ! SUDO_USER="${gui_user}" raspi-config nonint do_autologin 2; then - rm -f "${TTY1_AUTOLOGIN_CONF}" - rmdir --ignore-fail-on-non-empty "$(dirname "${TTY1_AUTOLOGIN_CONF}")" 2>/dev/null || true - set_lightdm_option autologin-user "${gui_user}" + # cancel-rename (userconf-pi) may have re-created the TTY autologin + # drop-in via do_boot_behaviour B3/B4 right before us (we are ordered + # After=userconfig.service), so always clean it up here. + rm -f "${TTY1_AUTOLOGIN_CONF}" + rmdir --ignore-fail-on-non-empty "$(dirname "${TTY1_AUTOLOGIN_CONF}")" 2>/dev/null || true + if SUDO_USER="${gui_user}" raspi-config nonint do_autologin 2 2>/dev/null; then + : # newer raspi-config: bitmask 2 = GUI-only autologin, TTY drop-in removed by raspi-config fi set_lightdm_option user-session guisession diff --git a/src/modules/gui/filesystem/root_init/etc/systemd/system/update_lightdm_conf.service b/src/modules/gui/filesystem/root_init/etc/systemd/system/update_lightdm_conf.service index 3f6d974d..2078be85 100644 --- a/src/modules/gui/filesystem/root_init/etc/systemd/system/update_lightdm_conf.service +++ b/src/modules/gui/filesystem/root_init/etc/systemd/system/update_lightdm_conf.service @@ -1,6 +1,12 @@ [Unit] Description=on first boot set up the user name auto login in lightdm.service Before=lightdm.service +# Run after the userconf-pi first-boot dialog: cancel-rename (inside +# userconfig.service) applies do_boot_behaviour B3/B4 which re-creates the +# getty@tty1 autologin drop-in and re-enables getty@tty1. If we run before +# it, our cleanup is silently undone (GUI distros end up with a TTY +# autologin shell - https://github.com/guysoft/FullPageOS/issues/639). +After=userconfig.service [Service] ExecStart=/opt/custompios/scripts/update_lightdm_conf Type=oneshot From fb6c05572b2c2ed3f30b09dc171a97bc8f8bbe09 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 2 Sep 2026 09:41:42 +0300 Subject: [PATCH 3/4] fix: remove read-only machine-id placeholder before regenerating systemd-machine-id-setup refuses to overwrite the 'uninitialized' placeholder (r--r--r--), so first boot still triggered the wizard. rm the file first, then regenerate, then mark first-boot-done. --- src/modules/base/end_chroot_script | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/base/end_chroot_script b/src/modules/base/end_chroot_script index 5bc2b38a..ffa96f5c 100755 --- a/src/modules/base/end_chroot_script +++ b/src/modules/base/end_chroot_script @@ -55,6 +55,9 @@ fi # The wizard is not reachable headlessly (no HDMI/KVM on the test jig), so mark # first boot as done and commit a real machine-id here. if [ ! -s /etc/machine-id ] || [ "$(cat /etc/machine-id)" = "uninitialized" ]; then + # The placeholder is read-only; systemd-machine-id-setup refuses to + # overwrite it, so remove it first. + rm -f /etc/machine-id if command -v systemd-machine-id-setup >/dev/null 2>&1; then systemd-machine-id-setup else From b00992f2e85699f324a81882052b29e45d230a53 Mon Sep 17 00:00:00 2001 From: Guy Sheffer Date: Wed, 2 Sep 2026 17:43:18 +0300 Subject: [PATCH 4/4] revert: keep first-boot services enabled during image build --- src/modules/base/end_chroot_script | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/modules/base/end_chroot_script b/src/modules/base/end_chroot_script index ffa96f5c..0a7a9e82 100755 --- a/src/modules/base/end_chroot_script +++ b/src/modules/base/end_chroot_script @@ -49,24 +49,6 @@ else fi fi -# Prevent systemd-firstboot (First Boot Wizard) from blocking first boot: -# /etc/machine-id is "uninitialized" in a fresh image, which makes systemd -# detect first boot and prompt for locale/keymap/timezone/root password on tty1. -# The wizard is not reachable headlessly (no HDMI/KVM on the test jig), so mark -# first boot as done and commit a real machine-id here. -if [ ! -s /etc/machine-id ] || [ "$(cat /etc/machine-id)" = "uninitialized" ]; then - # The placeholder is read-only; systemd-machine-id-setup refuses to - # overwrite it, so remove it first. - rm -f /etc/machine-id - if command -v systemd-machine-id-setup >/dev/null 2>&1; then - systemd-machine-id-setup - else - : > /etc/machine-id - fi -fi -mkdir -p /var/lib/systemd -touch /var/lib/systemd/first-boot-done - #cleanup if [ "${BASE_APT_CLEAN}" = "yes" ]; then apt-get clean