From a81d2deb6106af0f466bd2891d036cc2d9c9e064 Mon Sep 17 00:00:00 2001 From: Justin Cormack Date: Tue, 25 Jul 2017 15:12:40 +0100 Subject: [PATCH] Do not try to change /etc/resolv.conf The filesystem is supposed to be immutable, so do not try to make a symlink; new versions of moby tool should add one anyway. But try to make the directory a symlink points to, assuming that it will be on a writeable filesystem. fix #1920 see also #2288 Signed-off-by: Justin Cormack --- pkg/init/bin/rc.init | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkg/init/bin/rc.init b/pkg/init/bin/rc.init index 7b5e65df8..883c655a0 100755 --- a/pkg/init/bin/rc.init +++ b/pkg/init/bin/rc.init @@ -98,10 +98,8 @@ ip addr add 127.0.0.1/8 dev lo brd + scope host ip route add 127.0.0.0/8 dev lo scope host ip link set lo up -# for containerising dhcpcd and other containers that need writable etc -mkdir /tmp/etc -mv /etc/resolv.conf /tmp/etc/resolv.conf -ln -snf /tmp/etc/resolv.conf /etc/resolv.conf +# for containerizing dhcpcd and other containers that need writable /etc/resolv.conf +[ -L /etc/resolv.conf ] && mkdir -p $(dirname $(readlink -n /etc/resolv.conf)) # remount rootfs as readonly mount -o remount,ro /