From 77cb232e8b03b3998b19ede1d3d20508fbd07925 Mon Sep 17 00:00:00 2001 From: David Krauser Date: Wed, 25 Mar 2020 18:24:27 -0400 Subject: [PATCH] Safely set /etc/resolv.conf to an empty file in buildd images In bionic buildd image chroot, /etc/resolv.conf is a symbolic link to a configuration file in the /run directory. A call to truncate will modify that file, which we should not do. Instead, we want to remove the symbolic link and replace it with an empty file. --- live-build/buildd/hooks/49-empty-resolv-conf.binary | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/live-build/buildd/hooks/49-empty-resolv-conf.binary b/live-build/buildd/hooks/49-empty-resolv-conf.binary index df4a9b9a..a6f97526 100755 --- a/live-build/buildd/hooks/49-empty-resolv-conf.binary +++ b/live-build/buildd/hooks/49-empty-resolv-conf.binary @@ -1,4 +1,3 @@ -#!/bin/sh -set -e - -chroot chroot truncate -s 0 /etc/resolv.conf +#!/bin/sh -e +chroot chroot rm /etc/resolv.conf +chroot chroot touch /etc/resolv.conf