[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#988496: live-boot: /etc/resolv.conf empty when using resolvconf



Package: live-boot
Version: 1:20210208
Severity: important
Tags: patch

Hi,

We are using live-boot together with resolvconf. Our
/etc/network/interfaces is generated on boot and uses a static config
without DHCP. So the DCHP client in the initrd will be the only DHCP
client.

Once the system is booted, /etc/resolv.conf stays empty.

When using resolvconf, writing the resolv.conf settings into
`/etc/resolvconf/resolv.conf.d/base` is not enough. `/etc/resolv.conf`
pointing to `/run/resolvconf/resolv.conf` will stay empty.

So in addition to copying resolv.conf into
`/etc/resolvconf/resolv.conf.d/base`, generate
`/run/resolvconf/resolv.conf` by adding the head and tail.

A tested patch is attached that generates /run/resolvconf/resolv.conf
when using resolvconf.

-- 
Benjamin Drung

Senior DevOps Engineer and Debian & Ubuntu Developer
Compute Platform Operations

1&1 IONOS SE | Greifswalder Str. 207 | 10405 Berlin | Deutschland
E-Mail: benjamin.drung@ionos.com | Web: www.ionos.de

Hauptsitz Montabaur, Amtsgericht Montabaur, HRB 24498

Vorstand: Hüseyin Dogan, Dr. Martin Endreß, Claudia Frese, Henning
Kettler, Arthur Mai, Matthias Steinberg, Achim Weiß
Aufsichtsratsvorsitzender: Markus Kadelke


Member of United Internet
>From 1e463cc32f4599617b52e4a872f0e26b46e47ab0 Mon Sep 17 00:00:00 2001
From: Benjamin Drung <benjamin.drung@ionos.com>
Date: Wed, 12 May 2021 13:19:26 +0200
Subject: [PATCH] Generate /run/resolvconf/resolv.conf when using resolvconf

When using resolvconf, writing the resolv.conf settings into
`/etc/resolvconf/resolv.conf.d/base` is not enough. `/etc/resolv.conf`
pointing to `/run/resolvconf/resolv.conf` will stay empty.

So in addition to copying resolv.conf into
`/etc/resolvconf/resolv.conf.d/base`, generate
`/run/resolvconf/resolv.conf` by adding the head and tail.

Signed-off-by: Benjamin Drung <benjamin.drung@ionos.com>
---
 components/9990-main.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/components/9990-main.sh b/components/9990-main.sh
index b50952f..3fcfc9f 100755
--- a/components/9990-main.sh
+++ b/components/9990-main.sh
@@ -189,6 +189,15 @@ Live ()
 	then
 		log_begin_msg "Copying /etc/resolv.conf to ${DNSFILE}"
 		cp -v /etc/resolv.conf "${DNSFILE}"
+		if test -e "${rootmnt}/etc/resolvconf/resolv.conf.d/head" && \
+				test -e "${rootmnt}/etc/resolvconf/resolv.conf.d/base" && \
+				test -e "${rootmnt}/etc/resolvconf/resolv.conf.d/tail"; then
+			mkdir -p /run/resolvconf
+			cat "${rootmnt}/etc/resolvconf/resolv.conf.d/head" \
+				"${rootmnt}/etc/resolvconf/resolv.conf.d/base" \
+				"${rootmnt}/etc/resolvconf/resolv.conf.d/tail" \
+				> /run/resolvconf/resolv.conf
+		fi
 		log_end_msg
 	fi
 
-- 
2.27.0


Reply to: