Merge ~vorlon/ubuntu/+source/resolvconf:ubuntu/devel into ubuntu/+source/resolvconf:ubuntu/devel

Proposed by Steve Langasek
Status: Needs review
Proposed branch: ~vorlon/ubuntu/+source/resolvconf:ubuntu/devel
Merge into: ubuntu/+source/resolvconf:ubuntu/devel
Diff against target: 343 lines (+52/-183)
6 files modified
debian/changelog (+18/-0)
debian/postinst (+22/-52)
debian/resolvconf.maintscript (+1/-0)
debian/rules (+0/-1)
dev/null (+0/-81)
etc/resolvconf/update.d/libc (+11/-49)
Reviewer Review Type Date Requested Status
Dimitri John Ledkov Pending
Review via email: mp+382826@code.launchpad.net
To post a comment you must log in.
1bfeda0... by Steve Langasek

Suppress warning message that /etc/resolv.conf is not a symlink to the resolvconf-managed file, since it now never will be.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

Code review good.

Proceeding to test build and interractively test.

Unmerged commits

1bfeda0... by Steve Langasek

Suppress warning message that /etc/resolv.conf is not a symlink to the resolvconf-managed file, since it now never will be.

318150c... by Steve Langasek

Restart systemd-resolved after writing the config file, as systemd-resolved does not appear to watch the config directories for updates as one would expect.

32457f0... by Steve Langasek

Drop the systemd units that only exist for pulling resolved state into resolvconf.

9dfc86c... by Steve Langasek

Make resolvconf feed changes into /run/systemd/resolved.conf.d instead of updating a resolv.conf file.

f79f3b2... by Steve Langasek

Fix wrong spelling of rm_conffile

08cc6d7... by Steve Langasek

add bug link

c84ad81... by Steve Langasek

Revert any symlinking of /etc/resolv.conf to resolvconf's file, pointing it instead to the resolved file.

133ae11... by Steve Langasek

Drop the dhclient hook: on Ubuntu, DNS configuration will instead be fed directly to resolved via a hook provided by ifupdown.

eabed2a... by Andrej Shadura

Import patches-unapplied version 1.82 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 3f2ee40ab584dcaa10b43622fe754a05981204a9

New changelog entries:
  [ Andrej Shadura ]
  * Update the debconf translation templates (Closes: #947164).
  * Update translations.
  [ Helge Kreutzmann ]
  * Update German debconf translation (Closes: #947171).
  [ Frans Spiesschaert ]
  * Update Dutch debconf translation (Closes: #948037).

3f2ee40... by Andrej Shadura

Import patches-unapplied version 1.81 to debian/sid

Imported using git-ubuntu import.

Changelog parent: 3dbe8b345728756b17c277563c09420cb51732d2

New changelog entries:
  [ Russell Coker ]
  * Set correct SE Linux context on created directories and files
    (Closes: #850783).
  [ Jakub Wilk ]
  * Drop symlink resolving logic from the init script (Closes: #946609).

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 9048ad8..d56c5ad 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,21 @@
6+resolvconf (1.82ubuntu1) UNRELEASED; urgency=medium
7+
8+ * Drop the dhclient hook: on Ubuntu, DNS configuration will instead be
9+ fed directly to resolved via a hook provided by ifupdown. LP: #1874337.
10+ * Revert any symlinking of /etc/resolv.conf to resolvconf's file, pointing
11+ it instead to the resolved file.
12+ * Make resolvconf feed changes into /run/systemd/resolved.conf.d
13+ instead of updating a resolv.conf file.
14+ * Drop the systemd units that only exist for pulling resolved state into
15+ resolvconf.
16+ * Restart systemd-resolved after writing the config file, as
17+ systemd-resolved does not appear to watch the config directories for
18+ updates as one would expect.
19+ * Suppress warning message that /etc/resolv.conf is not a symlink to the
20+ resolvconf-managed file, since it now never will be.
21+
22+ -- Steve Langasek <steve.langasek@ubuntu.com> Tue, 21 Apr 2020 23:51:11 -0700
23+
24 resolvconf (1.82) unstable; urgency=medium
25
26 [ Andrej Shadura ]
27diff --git a/debian/postinst b/debian/postinst
28index 40cd101..22b64c0 100755
29--- a/debian/postinst
30+++ b/debian/postinst
31@@ -52,9 +52,28 @@ esac
32 #
33 case "$1" in
34 configure)
35- # Do linkify once again on dpkg-reconfigure
36- if [ "$DEBCONF_RECONFIGURE" = 1 ] || [ "$1" = reconfigure ] ; then
37- rm -f /var/lib/resolvconf/linkified
38+ # Unconditionally re-link this to resolved on upgrade. resolvconf
39+ # management of /etc/resolv.conf is unsupported on Ubuntu.
40+ if dpkg --compare-versions "$2" lt-nl 1.82ubuntu1~ \
41+ && [ "$(readlink -m /etc/resolv.conf)" = "/run/resolvconf/resolv.conf" ]
42+ then
43+ if is_immutable_file /etc/resolv.conf ; then
44+ if dnssec_trigger_is_installed ; then
45+ # dnssec-trigger sets the immutability attribute. Override it.
46+ # See #776778 for background.
47+ chattr -i /etc/resolv.conf
48+ else
49+ # Respect the admin
50+ report_err "Cannot replace the current /etc/resolv.conf with a symbolic link because it is immutable; to correct this problem, gain root privileges in a terminal and run 'chattr -i /etc/resolv.conf' and then 'dpkg --configure resolvconf'; aborting"
51+ exit 1
52+ fi
53+ fi
54+ rm -f /etc/resolv.conf
55+ ln -s ../run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
56+
57+ # we are "done" and nothing that looks at this file should ever
58+ # think otherwise
59+ :> /var/lib/resolvconf/linkified
60 fi
61
62 # Link tail to original if appropriate
63@@ -67,55 +86,6 @@ case "$1" in
64 fi
65 fi
66
67- # Linkify /etc/resolv.conf if appropriate
68- if [ ! -e /var/lib/resolvconf/linkified ] ; then
69- db_get resolvconf/linkify-resolvconf
70- if [ "$RET" = "true" ] ; then
71- if is_immutable_file /etc/resolv.conf ; then
72- if dnssec_trigger_is_installed ; then
73- # dnssec-trigger sets the immutability attribute. Override it.
74- # See #776778 for background.
75- chattr -i /etc/resolv.conf
76- else
77- # Respect the admin
78- report_err "Cannot replace the current /etc/resolv.conf with a symbolic link because it is immutable; to correct this problem, gain root privileges in a terminal and run 'chattr -i /etc/resolv.conf' and then 'dpkg --configure resolvconf'; aborting"
79- exit 1
80- fi
81- else
82- if
83- [ -f /etc/resolv.conf ] \
84- && {
85- [ ! -L /etc/resolv.conf ] \
86- || [ ! "$(readlink -m /etc/resolv.conf)" = "/run/resolvconf/resolv.conf" ]
87- }
88- then
89- # Back up original file
90- if [ ! -e /etc/resolvconf/resolv.conf.d/original ] ; then
91- cp -a /etc/resolv.conf /etc/resolvconf/resolv.conf.d/original
92- else
93- cp -a /etc/resolv.conf /etc/resolv.conf.dpkg-old
94- fi
95- # Before creating the link, make sure that the original file is
96- # at the target of the link. /sbin/resolvconf will overwrite
97- # this when it does an update, of course.
98- if [ ! -e /run/resolvconf/resolv.conf ] ; then
99- cp -aH /etc/resolv.conf /run/resolvconf/resolv.conf
100- fi
101- # Add the original file to the database so that its contents
102- # are included when resolvconf updates.
103- # Yes, this is an ugly workaround for the problem that some
104- # interface configurers haven't added a dpkg-event.d script.
105- cp -aH /etc/resolv.conf /run/resolvconf/interface/original.resolvconf
106- fi
107- # Create the link
108- # The link is relative to allow for cp from outside a chroot into a chroot
109- # to work without overwriting the file outside the chroot (or failing)
110- ln -nsf ../run/resolvconf/resolv.conf /etc/resolv.conf
111- # Make a record that we have created it
112- :> /var/lib/resolvconf/linkified
113- fi
114- fi
115- fi
116 ;;
117 # triggered)
118 # Don't do anything here
119diff --git a/debian/resolvconf.maintscript b/debian/resolvconf.maintscript
120index 2e88567..e27c872 100644
121--- a/debian/resolvconf.maintscript
122+++ b/debian/resolvconf.maintscript
123@@ -1 +1,2 @@
124 rm_conffile /etc/init/resolvconf.conf 1.80~~
125+rm_conffile /etc/dhcp/dhclient-enter-hooks.d/resolvconf 1.82ubuntu1~
126diff --git a/debian/resolvconf.resolvconf-pull-resolved.path b/debian/resolvconf.resolvconf-pull-resolved.path
127deleted file mode 100644
128index 9ccd05e..0000000
129--- a/debian/resolvconf.resolvconf-pull-resolved.path
130+++ /dev/null
131@@ -1,7 +0,0 @@
132-[Path]
133-PathChanged=/run/systemd/resolve/stub-resolv.conf
134-PathExists=/run/systemd/resolve/stub-resolv.conf
135-
136-[Install]
137-WantedBy=systemd-resolved.service
138-
139diff --git a/debian/resolvconf.resolvconf-pull-resolved.service b/debian/resolvconf.resolvconf-pull-resolved.service
140deleted file mode 100644
141index 109c462..0000000
142--- a/debian/resolvconf.resolvconf-pull-resolved.service
143+++ /dev/null
144@@ -1,7 +0,0 @@
145-[Unit]
146-ConditionPathExists=/run/resolvconf/enable-updates
147-ConditionFileIsExecutable=/sbin/resolvconf
148-
149-[Service]
150-Type=oneshot
151-ExecStart=+-/bin/sh -c 'cat /run/systemd/resolve/stub-resolv.conf | grep -v edns0 | /sbin/resolvconf -a systemd-resolved'
152diff --git a/debian/rules b/debian/rules
153index dbfd316..888537b 100755
154--- a/debian/rules
155+++ b/debian/rules
156@@ -19,6 +19,5 @@ override_dh_install:
157
158 override_dh_installsystemd:
159 dh_installsystemd
160- dh_installsystemd --name=resolvconf-pull-resolved
161
162 .PHONY: override_dh_auto_test override_dh_installinit override_dh_install override_dh_installsystemd
163diff --git a/etc/dhcp/dhclient-enter-hooks.d/resolvconf b/etc/dhcp/dhclient-enter-hooks.d/resolvconf
164deleted file mode 100644
165index 72b2be7..0000000
166--- a/etc/dhcp/dhclient-enter-hooks.d/resolvconf
167+++ /dev/null
168@@ -1,81 +0,0 @@
169-#
170-# Script fragment to make dhclient supply nameserver information to resolvconf
171-#
172-
173-# Tips:
174-# * Be careful about changing the environment since this is sourced
175-# * This script fragment uses bash features
176-# * As of isc-dhcp-client 4.2 the "reason" (for running the script) can be one of the following.
177-# (Listed on man page:) MEDIUM(0) PREINIT(0) BOUND(M) RENEW(M) REBIND(M) REBOOT(M) EXPIRE(D) FAIL(D) RELEASE(D) STOP(D) NBI(-) TIMEOUT(M)
178-# (Also used in master script:) ARPCHECK(0), ARPSEND(0)
179-# (Also used in master script:) PREINIT6(0) BOUND6(M) RENEW6(M) REBIND6(M) DEPREF6(0) EXPIRE6(D) RELEASE6(D) STOP6(D)
180-# (0) = master script does not run make_resolv_conf
181-# (M) = master script runs make_resolv_conf
182-# (D) = master script downs interface
183-# (-) = master script does nothing with this
184-
185-if [ -x /sbin/resolvconf ] ; then
186- # For safety, first undefine the nasty default make_resolv_conf()
187- make_resolv_conf() { : ; }
188- case "$reason" in
189- BOUND|RENEW|REBIND|REBOOT|TIMEOUT)
190- # Define a resolvconf-compatible m_r_c() function
191- # It gets run later (or, in the TIMEOUT case, MAY get run later)
192- make_resolv_conf() {
193- local R
194- local N
195- R=""
196- if [ "$new_domain_name_servers" ] && [ "$new_domain_name" ] ; then
197- R="${R}domain $new_domain_name
198-"
199- fi
200- if [ "$new_domain_name_servers" ] && [ "$new_domain_search" ] ; then
201- R="${R}search $new_domain_search
202-"
203- fi
204- for N in $new_domain_name_servers ; do
205- R="${R}nameserver $N
206-"
207- done
208- [ ! "$interface" ] || echo -n "$R" | /sbin/resolvconf -a "${interface}.dhclient"
209- }
210- ;;
211- BOUND6|RENEW6|REBIND6)
212- # Define a resolvconf-compatible m_r_c() function
213- # It gets run later (or, in the TIMEOUT case, MAY get run later)
214- make_resolv_conf() {
215- local R
216- local N
217- local N_LOW
218- local ZONE_ID
219- R=""
220- if [ "$new_dhcp6_name_servers" ] && [ "$new_dhcp6_domain_search" ] ; then
221- R="${R}search $new_dhcp6_domain_search
222-"
223- fi
224- for N in $new_dhcp6_name_servers ; do
225-
226- # If the nameserver has a link-local address
227- # then add a zone ID (interface name) to it.
228- N_LOW="$(echo "$N" | tr '[:upper:]' '[:lower:]')"
229- if expr "$N_LOW" : ^fe80:: >/dev/null ; then
230- ZONE_ID="%$interface"
231- else
232- ZONE_ID=""
233- fi
234- R="${R}nameserver $N$ZONE_ID
235-"
236- done
237- [ ! "$interface" ] || echo -n "$R" | /sbin/resolvconf -a "${interface}.ip6.dhclient"
238- }
239- ;;
240- EXPIRE|FAIL|RELEASE|STOP)
241- # Delete resolv.conf info
242- [ ! "$interface" ] || /sbin/resolvconf -d "${interface}.dhclient"
243- ;;
244- EXPIRE6|RELEASE6|STOP6)
245- # Delete resolv.conf info
246- [ ! "$interface" ] || /sbin/resolvconf -d "${interface}.ip6.dhclient"
247- ;;
248- esac
249-fi
250diff --git a/etc/resolvconf/update.d/libc b/etc/resolvconf/update.d/libc
251index 12298c7..c848adc 100755
252--- a/etc/resolvconf/update.d/libc
253+++ b/etc/resolvconf/update.d/libc
254@@ -7,9 +7,6 @@
255 #
256 # This script is part of the resolvconf package.
257 #
258-# Set REPORT_ABSENT_SYMLINK=no to inhibit warning message that
259-# /etc/resolv.conf is not a symbolic link
260-#
261 # Set TRUNCATE_NAMESERVER_LIST_AFTER_LOOPBACK_ADDRESS=no
262 # to allow additional nameserver addresses to be listed in
263 # resolv.conf after an initial loopback address 127.* or ::1.
264@@ -32,17 +29,6 @@ TAILFILE="${RESOLVCONFDIR}/tail"
265 DYNAMICRSLVCNFFILE="/run/resolvconf/resolv.conf"
266 TMPFILE="${DYNAMICRSLVCNFFILE}_new.$$"
267
268-# Set unset variables to their defaults
269-if [ -z "$REPORT_ABSENT_SYMLINK" ] ; then
270- # '..._ALTERED_...' is the old deprecated name for this variable
271- if [ "$REPORT_ALTERED_SYMLINK" ] ; then
272- REPORT_ABSENT_SYMLINK="$REPORT_ALTERED_SYMLINK"
273- else
274- # Set to default value
275- REPORT_ABSENT_SYMLINK=y
276- fi
277-fi
278-
279 if [ -z "$TRUNCATE_NAMESERVER_LIST_AFTER_LOOPBACK_ADDRESS" ] ; then
280 # '..._127' is the old deprecated name for this variable
281 if [ "$TRUNCATE_NAMESERVER_LIST_AFTER_127" ] ; then
282@@ -56,18 +42,6 @@ fi
283
284 report_warning() { echo "$0: Warning: $*" >&2 ; }
285
286-resolv_conf_is_symlinked_to_dynamic_file() {
287- [ -L ${ETC}/resolv.conf ] && [ "$(readlink -m ${ETC}/resolv.conf)" = "$DYNAMICRSLVCNFFILE" ]
288-}
289-
290-if ! resolv_conf_is_symlinked_to_dynamic_file ; then
291- case "$REPORT_ABSENT_SYMLINK" in
292- y|Y|yes|YES|Yes)
293- report_warning "${ETC}/resolv.conf is not a symbolic link to $DYNAMICRSLVCNFFILE"
294- ;;
295- esac
296-fi
297-
298 # Args are candidate items not containing spaces
299 # Returns RSLT -- space-separated list of items without duplicates
300 #
301@@ -131,31 +105,19 @@ clean_up
302
303 ### Make the file ###
304 : > "$TMPFILE"
305-[ -f "$HEADFILE" ] && cat "$HEADFILE" >> "$TMPFILE"
306-for N in $NMSRVRS ; do echo "nameserver $N" >> "$TMPFILE" ; done
307-[ "$SRCHS" ] && echo "search $SRCHS" >> "$TMPFILE"
308-[ "$RSLVCNFFILES" ] && sed -e '/^[[:space:]]*$/d' -e '/^[[:space:]]*#/d' -e '/^[[:space:]]*\(\(nameserver\)\|\(search\)\|\(domain\)\)[[:space:]]/d' $RSLVCNFFILES >> "$TMPFILE" 2>/dev/null
309-[ -f "$TAILFILE" ] && cat "$TAILFILE" >> "$TMPFILE"
310-
311-### Put the file in place ###
312-
313-if [ -f "$DYNAMICRSLVCNFFILE" ] && [ "$(cat $TMPFILE)" = "$(cat $DYNAMICRSLVCNFFILE)" ] ; then
314- # The file has not changed
315- rm -f "$TMPFILE"
316- exit 0
317-fi
318-
319-# The file has changed
320-mv -f "$TMPFILE" "$DYNAMICRSLVCNFFILE"
321+cat <<EOF >"$TMPFILE"
322+[Resolve]
323+DNS=$NMSRVRS
324+EOF
325
326-# Only notify users of /etc/resolv.conf if /etc/resolv.conf is actually
327-# symlinked to the file we have just updated.
328-resolv_conf_is_symlinked_to_dynamic_file || exit 0
329+[ "$SRCHS" ] && echo "DNS=$SRCHS" >> "$TMPFILE"
330
331-# Notify users of the resolver
332-if [ -d "${ETCRESOLVCONF}/update-libc.d" ] ; then
333- exec run-parts "${ETCRESOLVCONF}/update-libc.d"
334+### Put the file in place ###
335+statedir=/run/systemd/resolved.conf.d
336+mkdir -p "$statedir"
337+mv -f "$TMPFILE" "$statedir/resolvconf.conf"
338+if systemctl --quiet is-active systemd-resolved; then
339+ systemctl restart systemd-resolved
340 fi
341
342 exit 0
343-

Subscribers

People subscribed via source and target branches