From c7ce62154b934320881dbcee01b821979755dc97 Mon Sep 17 00:00:00 2001 From: Devesh Pathak <54966909+devpatha@users.noreply.github.com> Date: Wed, 9 Nov 2022 16:54:56 -0800 Subject: [PATCH] Clear /etc/resolv.conf before building image (#12592) Why I did it nameserver and domain entries from build system fsroot gets into sonic image. How I did it Clear /etc/resolv.conf before building image How to verify it Built image with it and verified with install that /etc/resolv.conf is empty --- build_debian.sh | 1 + files/image_config/resolv-config/resolv.conf | 0 2 files changed, 1 insertion(+) create mode 100644 files/image_config/resolv-config/resolv.conf diff --git a/build_debian.sh b/build_debian.sh index 3f39ec17e4..f137feb6a7 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -628,6 +628,7 @@ sudo rm -f $ONIE_INSTALLER_PAYLOAD $FILESYSTEM_SQUASHFS ## Note: -x to skip directories on different file systems, such as /proc sudo du -hsx $FILESYSTEM_ROOT sudo mkdir -p $FILESYSTEM_ROOT/var/lib/docker +sudo cp files/image_config/resolv-config/resolv.conf $FILESYSTEM_ROOT/etc/resolv.conf sudo mksquashfs $FILESYSTEM_ROOT $FILESYSTEM_SQUASHFS -e boot -e var/lib/docker -e $PLATFORM_DIR # Ensure admin gid is 1000 diff --git a/files/image_config/resolv-config/resolv.conf b/files/image_config/resolv-config/resolv.conf new file mode 100644 index 0000000000..e69de29bb2