From 6c23b97f4a2226e24976e7943d7be4f3a326ea98 Mon Sep 17 00:00:00 2001 From: Dirk Mueller <dirk@dmllr.de> Date: Wed, 21 Aug 2019 19:56:13 +0200 Subject: [PATCH] zypper-minimal: Don't get confused by etc/resolv.conf symlink Newer openSUSE distributions install an absolute link to /run/netconfig as /etc/resolv.conf in $TARGET_ROOT. as that points outside TARGET_ROOT, we unintentionally wipe the system resolv.conf here and break our ability to finish building the image. Change-Id: I9d5aaa9fad2f81dcabfe19e2f1e6b6e50af597d7 --- .../elements/zypper-minimal/root.d/08-zypper-chroot | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot index 02c29f21a..b77802ad6 100755 --- a/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot +++ b/diskimage_builder/elements/zypper-minimal/root.d/08-zypper-chroot @@ -101,6 +101,11 @@ sudo zypper ${ZYPPER_TARGET_OPTS} install \ ${DIB_OPENSUSE_PATTERNS} ${ZYPPER_INSTALL_SYSTEM_PYTHON} \ zypper sudo ca-certificates-mozilla +# Remove the installed symlink, otherwise we wipe the resolv.conf +# outside the target_root (as the link is not relative) +# outside target_root +test -L $TARGET_ROOT/etc/resolv.conf && sudo rm -f $TARGET_ROOT/etc/resolv.conf + # Put in a dummy /etc/resolv.conf over the temporary one we used # to bootstrap. systemd has a bug/feature [1] that it will assume # you want systemd-networkd as the network manager and create a