diff --git a/lib/functions/rootfs/create-cache.sh b/lib/functions/rootfs/create-cache.sh index 351cfc2a14..6157ff6f67 100644 --- a/lib/functions/rootfs/create-cache.sh +++ b/lib/functions/rootfs/create-cache.sh @@ -274,6 +274,15 @@ create_rootfs_cache() { rm $SDCARD/etc/resolv.conf echo "nameserver $NAMESERVER" >> $SDCARD/etc/resolv.conf + # Remove `machine-id` (https://www.freedesktop.org/software/systemd/man/machine-id.html) + # Note: This will mark machine `firstboot` + echo "uninitialized" > "${SDCARD}/etc/machine-id" + rm "${SDCARD}/var/lib/dbus/machine-id" + + # Mask `systemd-firstboot.service` which will prompt locale, timezone and root-password too early. + # `armbian-first-run` will do the same thing later + chroot $SDCARD /bin/bash -c "systemctl mask systemd-firstboot.service >/dev/null 2>&1" + # stage: make rootfs cache archive display_alert "Ending debootstrap process and preparing cache" "$RELEASE" "info" sync diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh index 543a6bd292..76cb7f6460 100644 --- a/lib/functions/rootfs/distro-agnostic.sh +++ b/lib/functions/rootfs/distro-agnostic.sh @@ -526,6 +526,10 @@ FAMILY_TWEAKS # remove network manager defaults to handle eth by default rm -f "${SDCARD}"/usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf + # `systemd-networkd.service` will be enabled by `/lib/systemd/system-preset/90-systemd.preset` during first-run. + # Mask it to avoid conflict + chroot "${SDCARD}" /bin/bash -c "systemctl mask systemd-networkd.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 + # most likely we don't need to wait for nm to get online chroot "${SDCARD}" /bin/bash -c "systemctl disable NetworkManager-wait-online.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 @@ -548,6 +552,9 @@ FAMILY_TWEAKS # enable services chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-networkd.service systemd-resolved.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 + # Mask `NetworkManager.service` to avoid conflict + chroot "${SDCARD}" /bin/bash -c "systemctl mask NetworkManager.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 + if [ -e /etc/systemd/timesyncd.conf ]; then chroot "${SDCARD}" /bin/bash -c "systemctl enable systemd-timesyncd.service" >> "${DEST}"/${LOG_SUBPATH}/install.log 2>&1 fi