diff --git a/lib/functions/rootfs/distro-agnostic.sh b/lib/functions/rootfs/distro-agnostic.sh index 7e261b6f5..73f78689b 100644 --- a/lib/functions/rootfs/distro-agnostic.sh +++ b/lib/functions/rootfs/distro-agnostic.sh @@ -584,7 +584,8 @@ function install_distribution_agnostic() { elif [ -d "${SDCARD}"/etc/systemd/network ]; then # enable services - chroot_sdcard systemctl enable systemd-networkd.service systemd-resolved.service + chroot_sdcard systemctl enable systemd-networkd.service + chroot_sdcard systemctl enable systemd-resolved.service || display_alert "Failed to enable systemd-resolved.service" "" "wrn" # Mask `NetworkManager.service` to avoid conflict chroot_sdcard systemctl mask NetworkManager.service diff --git a/lib/functions/rootfs/distro-specific.sh b/lib/functions/rootfs/distro-specific.sh index 6d6dfe5c0..5ed2a034b 100644 --- a/lib/functions/rootfs/distro-specific.sh +++ b/lib/functions/rootfs/distro-specific.sh @@ -26,8 +26,12 @@ install_distribution_specific() { fi # DNS fix - if [ -n "$NAMESERVER" ]; then - sed -i "s/#DNS=.*/DNS=$NAMESERVER/g" "${SDCARD}"/etc/systemd/resolved.conf + if [[ -n "$NAMESERVER" ]]; then + if [[ -f "${SDCARD}"/etc/systemd/resolved.conf ]]; then + sed -i "s/#DNS=.*/DNS=$NAMESERVER/g" "${SDCARD}"/etc/systemd/resolved.conf + else + display_alert "DNS fix" "/etc/systemd/resolved.conf not found: ${DISTRIBUTION} ${RELEASE}" "wrn" + fi fi # Journal service adjustements