Merge ~enr0n/ubuntu/+source/systemd:ubuntu-jammy-sru into ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-jammy

Proposed by Nick Rosbrook
Status: Merged
Merged at revision: 0b9eadf05ee6db0e009dacbc71521480095880b3
Proposed branch: ~enr0n/ubuntu/+source/systemd:ubuntu-jammy-sru
Merge into: ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-jammy
Diff against target: 796 lines (+623/-45)
16 files modified
debian/patches/lp1977630-fix_machinectl_pull_tar.patch (+81/-0)
debian/patches/lp1978079-efi-pstore-not-cleared-on-boot.patch (+5/-4)
debian/patches/lp1991829-add-CAP_LINUX_IMMUTABLE-to-systemd-machined-so-it-ca.patch (+29/-0)
debian/patches/lp1999275/binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch (+80/-0)
debian/patches/lp1999275/binfmt-util-also-check-if-binfmt-is-mounted-in-read-write.patch (+41/-0)
debian/patches/lp1999275/binfmt-util-split-out-binfmt_mounted.patch (+69/-0)
debian/patches/lp1999275/unit-check-more-specific-path-to-be-written-by-systemd-bi.patch (+26/-0)
debian/patches/lp2009743/network-dhcp4-do-not-ignore-the-gateway-even-if-the-desti.patch (+59/-0)
debian/patches/lp2009743/test-network-add-one-more-testcase-for-DHCPv4-classless-r.patch (+33/-0)
debian/patches/lp2013543-core-reorder-systemd-arguments-on-reexec.patch (+58/-0)
debian/patches/lp2025563-shutdown-get-only-active-md-arrays.patch (+67/-0)
debian/patches/lp2028180-udev-rules-fix-nvme-symlink-creation-on-namespace-changes.patch (+47/-0)
debian/patches/series (+11/-1)
debian/systemd.postinst (+16/-1)
debian/tests/tests-in-lxd (+1/-1)
dev/null (+0/-38)
Reviewer Review Type Date Requested Status
Lukas Märdian Approve
Review via email: mp+449220@code.launchpad.net

Description of the change

SRU several bug fixes to Jammy.

To post a comment you must log in.
Revision history for this message
Lukas Märdian (slyon) wrote :

Thanks, lgtm!

I've added two inline comments about the "systemd-networkd-wait-online --any" behavior on GKE cloud images (see my forwarded email) and a potential systemd.postinst interference with debhelper for extra considerations.

review: Approve
Revision history for this message
Nick Rosbrook (enr0n) wrote :

Thanks for your review! I will review the email before proceeding.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/patches/debian/UBUNTU-wait-online-exit-if-no-links-are-managed.patch b/debian/patches/debian/UBUNTU-wait-online-exit-if-no-links-are-managed.patch
2deleted file mode 100644
3index 56295f5..0000000
4--- a/debian/patches/debian/UBUNTU-wait-online-exit-if-no-links-are-managed.patch
5+++ /dev/null
6@@ -1,38 +0,0 @@
7-From: Dimitri John Ledkov <xnox@ubuntu.com>
8-Date: Mon, 26 Mar 2018 13:17:01 +0100
9-Subject: wait-online: exit, if no links are managed.
10-
11-(cherry picked from commit 19d11f607ac0f8b1e31f72a8e9d3d44371b9dadb)
12----
13- src/network/wait-online/manager.c | 7 ++++++-
14- 1 file changed, 6 insertions(+), 1 deletion(-)
15-
16---- a/src/network/wait-online/manager.c
17-+++ b/src/network/wait-online/manager.c
18-@@ -118,6 +118,7 @@ static int manager_link_is_online(Manage
19-
20- bool manager_configured(Manager *m) {
21- bool one_ready = false;
22-+ bool none_managed = true;
23- const char *ifname;
24- Link *l;
25- int r;
26-@@ -168,13 +169,17 @@ bool manager_configured(Manager *m) {
27- _LINK_OPERSTATE_INVALID });
28- if (r < 0 && !m->any)
29- return false;
30-+ if (l->state && STR_IN_SET(l->state, "configured", "failed")) {
31-+ log_info("managing: %s", l->ifname);
32-+ none_managed = false;
33-+ }
34- if (r > 0)
35- /* we wait for at least one link to be ready,
36- * regardless of who manages it */
37- one_ready = true;
38- }
39-
40-- return one_ready;
41-+ return one_ready || none_managed;
42- }
43-
44- static int manager_process_link(sd_netlink *rtnl, sd_netlink_message *mm, void *userdata) {
45diff --git a/debian/patches/lp1977630-fix_machinectl_pull_tar.patch b/debian/patches/lp1977630-fix_machinectl_pull_tar.patch
46new file mode 100644
47index 0000000..675cd43
48--- /dev/null
49+++ b/debian/patches/lp1977630-fix_machinectl_pull_tar.patch
50@@ -0,0 +1,81 @@
51+From: Dan Streetman <ddstreet@ieee.org>
52+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1977630
53+Forwarded: not-needed
54+
55+Since import_make_read_only handles a dir by chattr +i, that has to happen
56+after renaming, since an immutable dir can't be renamed.
57+
58+--- a/src/import/pull-tar.c
59++++ b/src/import/pull-tar.c
60+@@ -353,10 +353,6 @@ static void tar_pull_job_on_finished(Pul
61+ if (r < 0)
62+ goto finish;
63+
64+- r = import_make_read_only(i->temp_path);
65+- if (r < 0)
66+- goto finish;
67+-
68+ r = rename_noreplace(AT_FDCWD, i->temp_path, AT_FDCWD, i->final_path);
69+ if (r < 0) {
70+ log_error_errno(r, "Failed to rename to final image name to %s: %m", i->final_path);
71+@@ -365,6 +361,10 @@ static void tar_pull_job_on_finished(Pul
72+
73+ i->temp_path = mfree(i->temp_path);
74+
75++ r = import_make_read_only(i->final_path);
76++ if (r < 0)
77++ goto finish;
78++
79+ if (i->settings_job &&
80+ i->settings_job->error == 0) {
81+
82+@@ -380,10 +380,6 @@ static void tar_pull_job_on_finished(Pul
83+ if (r < 0)
84+ goto finish;
85+
86+- r = import_make_read_only(i->settings_temp_path);
87+- if (r < 0)
88+- goto finish;
89+-
90+ r = rename_noreplace(AT_FDCWD, i->settings_temp_path, AT_FDCWD, i->settings_path);
91+ if (r < 0) {
92+ log_error_errno(r, "Failed to rename settings file to %s: %m", i->settings_path);
93+@@ -391,6 +387,10 @@ static void tar_pull_job_on_finished(Pul
94+ }
95+
96+ i->settings_temp_path = mfree(i->settings_temp_path);
97++
98++ r = import_make_read_only(i->settings_path);
99++ if (r < 0)
100++ goto finish;
101+ }
102+ }
103+
104+--- a/src/import/import-tar.c
105++++ b/src/import/import-tar.c
106+@@ -179,12 +179,6 @@ static int tar_import_finish(TarImport *
107+ if (r < 0)
108+ return r;
109+
110+- if (i->flags & IMPORT_READ_ONLY) {
111+- r = import_make_read_only(i->temp_path);
112+- if (r < 0)
113+- return r;
114+- }
115+-
116+ if (i->flags & IMPORT_FORCE)
117+ (void) rm_rf(i->final_path, REMOVE_ROOT|REMOVE_PHYSICAL|REMOVE_SUBVOLUME);
118+
119+@@ -194,6 +188,12 @@ static int tar_import_finish(TarImport *
120+
121+ i->temp_path = mfree(i->temp_path);
122+
123++ if (i->flags & IMPORT_READ_ONLY) {
124++ r = import_make_read_only(i->final_path);
125++ if (r < 0)
126++ return r;
127++ }
128++
129+ return 0;
130+ }
131+
132diff --git a/debian/patches/lp1978079-efi-pstore-not-cleared-on-boot.patch b/debian/patches/lp1978079-efi-pstore-not-cleared-on-boot.patch
133index 9331b73..49584bd 100644
134--- a/debian/patches/lp1978079-efi-pstore-not-cleared-on-boot.patch
135+++ b/debian/patches/lp1978079-efi-pstore-not-cleared-on-boot.patch
136@@ -6,9 +6,10 @@ Subject: [PATCH] pstore: Run after modules are loaded
137 Origin: upstream, https://github.com/systemd/systemd/commit/70e74a5997ae2ce7ba72a74ac949c3b2dad1a1d6
138 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1978079
139 Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1981622
140-Last-Updated: 2022-07-22
141+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2023462
142+Last-Updated: 2023-08-02
143
144-The original commit has been modified to not load mtdpstore.
145+The original commit has been modified to only load efi_pstore, as that is all that was really needed.
146
147 ---
148 The systemd-pstore service takes pstore files on boot and transfers them
149@@ -42,8 +43,8 @@ index 848e311e9642..86de30ad4a72 100644
150 DefaultDependencies=no
151 Conflicts=shutdown.target
152 Before=sysinit.target shutdown.target
153-+After=modprobe@efi_pstore.service modprobe@chromeos_pstore.service modprobe@ramoops.service modprobe@pstore_zone.service modprobe@pstore_blk.service
154-+Wants=modprobe@efi_pstore.service modprobe@chromeos_pstore.service modprobe@ramoops.service modprobe@pstore_zone.service modprobe@pstore_blk.service
155++After=modprobe@efi_pstore.service
156++Wants=modprobe@efi_pstore.service
157
158 [Service]
159 Type=oneshot
160diff --git a/debian/patches/lp1991829-add-CAP_LINUX_IMMUTABLE-to-systemd-machined-so-it-ca.patch b/debian/patches/lp1991829-add-CAP_LINUX_IMMUTABLE-to-systemd-machined-so-it-ca.patch
161new file mode 100644
162index 0000000..d35aa0f
163--- /dev/null
164+++ b/debian/patches/lp1991829-add-CAP_LINUX_IMMUTABLE-to-systemd-machined-so-it-ca.patch
165@@ -0,0 +1,29 @@
166+From 137d162c42ed858613afc3d7493d08d4ae6d5c1b Mon Sep 17 00:00:00 2001
167+From: Dan Streetman <ddstreet@ieee.org>
168+Date: Fri, 16 Sep 2022 10:50:59 -0400
169+Subject: [PATCH] add CAP_LINUX_IMMUTABLE to systemd-machined, so it can handle
170+ machinectl read-only requests
171+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1991829
172+Origin: upstream, https://github.com/systemd/systemd/pull/24697
173+
174+Without this, the 'machinectl read-only ...' command always fails.
175+---
176+ units/systemd-machined.service.in | 2 +-
177+ 1 file changed, 1 insertion(+), 1 deletion(-)
178+
179+diff --git a/units/systemd-machined.service.in b/units/systemd-machined.service.in
180+index e92f436dfd..d3f8abd9e4 100644
181+--- a/units/systemd-machined.service.in
182++++ b/units/systemd-machined.service.in
183+@@ -18,7 +18,7 @@ RequiresMountsFor=/var/lib/machines
184+
185+ [Service]
186+ BusName=org.freedesktop.machine1
187+-CapabilityBoundingSet=CAP_KILL CAP_SYS_PTRACE CAP_SYS_ADMIN CAP_SETGID CAP_SYS_CHROOT CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE CAP_CHOWN CAP_FOWNER CAP_FSETID CAP_MKNOD
188++CapabilityBoundingSet=CAP_KILL CAP_SYS_PTRACE CAP_SYS_ADMIN CAP_SETGID CAP_SYS_CHROOT CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE CAP_CHOWN CAP_FOWNER CAP_FSETID CAP_MKNOD CAP_LINUX_IMMUTABLE
189+ ExecStart={{ROOTLIBEXECDIR}}/systemd-machined
190+ IPAddressDeny=any
191+ LockPersonality=yes
192+--
193+2.34.1
194+
195diff --git a/debian/patches/lp1999275/binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch b/debian/patches/lp1999275/binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch
196new file mode 100644
197index 0000000..792097d
198--- /dev/null
199+++ b/debian/patches/lp1999275/binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch
200@@ -0,0 +1,80 @@
201+From: Yu Watanabe <watanabe.yu+github@gmail.com>
202+Date: Sat, 10 Dec 2022 11:42:50 +0900
203+Subject: binfmt: check if binfmt is mounted before applying rules
204+
205+Origin: upstream, https://github.com/systemd/systemd/commit/94ba5b15329d9d19277ca418bfd0266da98f7b2a
206+Bug-Ubuntu: https://launchpad.net/bugs/1999275
207+
208+---
209+ src/binfmt/binfmt.c | 19 +++++++++++++++++++
210+ src/shared/binfmt-util.c | 2 +-
211+ src/shared/binfmt-util.h | 1 +
212+ 3 files changed, 21 insertions(+), 1 deletion(-)
213+
214+diff --git a/src/binfmt/binfmt.c b/src/binfmt/binfmt.c
215+index 981218f..999ccd0 100644
216+--- a/src/binfmt/binfmt.c
217++++ b/src/binfmt/binfmt.c
218+@@ -184,6 +184,18 @@ static int parse_argv(int argc, char *argv[]) {
219+ return 1;
220+ }
221+
222++static int binfmt_mounted_warn(void) {
223++ int r;
224++
225++ r = binfmt_mounted();
226++ if (r < 0)
227++ return log_error_errno(r, "Failed to check if /proc/sys/fs/binfmt_misc is mounted: %m");
228++ if (r == 0)
229++ log_debug("/proc/sys/fs/binfmt_misc is not mounted in read-write mode, skipping.");
230++
231++ return r;
232++}
233++
234+ static int run(int argc, char *argv[]) {
235+ int r, k;
236+
237+@@ -201,6 +213,9 @@ static int run(int argc, char *argv[]) {
238+ return disable_binfmt();
239+
240+ if (argc > optind) {
241++ r = binfmt_mounted_warn();
242++ if (r <= 0)
243++ return r;
244+ int i;
245+
246+ for (i = optind; i < argc; i++) {
247+@@ -222,6 +237,10 @@ static int run(int argc, char *argv[]) {
248+ return cat_files(NULL, files, 0);
249+ }
250+
251++ r = binfmt_mounted_warn();
252++ if (r <= 0)
253++ return r;
254++
255+ /* Flush out all rules */
256+ (void) write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
257+
258+diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
259+index 51fc245..a261754 100644
260+--- a/src/shared/binfmt-util.c
261++++ b/src/shared/binfmt-util.c
262+@@ -12,7 +12,7 @@
263+ #include "missing_magic.h"
264+ #include "stat-util.h"
265+
266+-static int binfmt_mounted(void) {
267++int binfmt_mounted(void) {
268+ _cleanup_close_ int fd = -EBADF;
269+ int r;
270+
271+diff --git a/src/shared/binfmt-util.h b/src/shared/binfmt-util.h
272+index 2f008d1..13f4548 100644
273+--- a/src/shared/binfmt-util.h
274++++ b/src/shared/binfmt-util.h
275+@@ -1,4 +1,5 @@
276+ /* SPDX-License-Identifier: LGPL-2.1-or-later */
277+ #pragma once
278+
279++int binfmt_mounted(void);
280+ int disable_binfmt(void);
281diff --git a/debian/patches/lp1999275/binfmt-util-also-check-if-binfmt-is-mounted-in-read-write.patch b/debian/patches/lp1999275/binfmt-util-also-check-if-binfmt-is-mounted-in-read-write.patch
282new file mode 100644
283index 0000000..9541dbd
284--- /dev/null
285+++ b/debian/patches/lp1999275/binfmt-util-also-check-if-binfmt-is-mounted-in-read-write.patch
286@@ -0,0 +1,41 @@
287+From: Yu Watanabe <watanabe.yu+github@gmail.com>
288+Date: Sat, 10 Dec 2022 11:32:24 +0900
289+Subject: binfmt-util: also check if binfmt is mounted in read-write
290+
291+Origin: upstream, https://github.com/systemd/systemd/commit/5aaa79ce96997825b4dcdcf5be10d8f955fb3339
292+Bug-Ubuntu: https://launchpad.net/bugs/1999275
293+
294+---
295+ src/shared/binfmt-util.c | 5 +++--
296+ 1 file changed, 3 insertions(+), 2 deletions(-)
297+
298+diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
299+index e813c3e..51fc245 100644
300+--- a/src/shared/binfmt-util.c
301++++ b/src/shared/binfmt-util.c
302+@@ -8,6 +8,7 @@
303+ #include "errno-util.h"
304+ #include "fd-util.h"
305+ #include "fileio.h"
306++#include "fs-util.h"
307+ #include "missing_magic.h"
308+ #include "stat-util.h"
309+
310+@@ -25,7 +26,7 @@ static int binfmt_mounted(void) {
311+ if (r <= 0)
312+ return r;
313+
314+- return true;
315++ return access_fd(fd, W_OK) >= 0;
316+ }
317+
318+ int disable_binfmt(void) {
319+@@ -41,7 +42,7 @@ int disable_binfmt(void) {
320+ if (r < 0)
321+ return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
322+ if (r == 0) {
323+- log_debug("binfmt_misc is not mounted, not detaching entries.");
324++ log_debug("binfmt_misc is not mounted in read-write mode, not detaching entries.");
325+ return 0;
326+ }
327+
328diff --git a/debian/patches/lp1999275/binfmt-util-split-out-binfmt_mounted.patch b/debian/patches/lp1999275/binfmt-util-split-out-binfmt_mounted.patch
329new file mode 100644
330index 0000000..74f1d4c
331--- /dev/null
332+++ b/debian/patches/lp1999275/binfmt-util-split-out-binfmt_mounted.patch
333@@ -0,0 +1,69 @@
334+From: Yu Watanabe <watanabe.yu+github@gmail.com>
335+Date: Sat, 10 Dec 2022 11:25:28 +0900
336+Subject: binfmt-util: split out binfmt_mounted()
337+
338+Origin: upstream, https://github.com/systemd/systemd/commit/a51a9684c926af917ad1b8e2f34538aee3c7ce2d
339+Bug-Ubuntu: https://launchpad.net/bugs/1999275
340+
341+No functional changes, just refactoring and preparation for later
342+commits.
343+
344+(modified to apply to v249.11)
345+---
346+ src/shared/binfmt-util.c | 29 +++++++++++++++++++++++++----
347+ 1 file changed, 25 insertions(+), 4 deletions(-)
348+
349+diff --git a/src/shared/binfmt-util.c b/src/shared/binfmt-util.c
350+index 724d7f2..d149382 100644
351+--- a/src/shared/binfmt-util.c
352++++ b/src/shared/binfmt-util.c
353+@@ -5,10 +5,31 @@
354+ #include <sys/vfs.h>
355+
356+ #include "binfmt-util.h"
357++#include "errno-util.h"
358++#include "fd-util.h"
359+ #include "fileio.h"
360+ #include "missing_magic.h"
361+ #include "stat-util.h"
362+
363++static int binfmt_mounted(void) {
364++ _cleanup_close_ int fd = -EBADF;
365++ int r;
366++
367++ fd = open("/proc/sys/fs/binfmt_misc", O_CLOEXEC | O_DIRECTORY | O_PATH);
368++ if (fd < 0)
369++ fd = -errno;
370++ if (fd == -ENOENT)
371++ return false;
372++ if (fd < 0)
373++ return fd;
374++
375++ r = fd_is_fs_type(fd, BINFMTFS_MAGIC);
376++ if (r <= 0)
377++ return r;
378++
379++ return true;
380++}
381++
382+ int disable_binfmt(void) {
383+ int r;
384+
385+@@ -18,13 +39,13 @@ int disable_binfmt(void) {
386+ * We are a bit careful here, since binfmt_misc might still be an autofs which we don't want to
387+ * trigger. */
388+
389+- r = path_is_fs_type("/proc/sys/fs/binfmt_misc", BINFMTFS_MAGIC);
390+- if (r == 0 || r == -ENOENT) {
391++ r = binfmt_mounted();
392++ if (r < 0)
393++ return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
394++ if (r == 0) {
395+ log_debug("binfmt_misc is not mounted, not detaching entries.");
396+ return 0;
397+ }
398+- if (r < 0)
399+- return log_warning_errno(r, "Failed to determine whether binfmt_misc is mounted: %m");
400+
401+ r = write_string_file("/proc/sys/fs/binfmt_misc/status", "-1", WRITE_STRING_FILE_DISABLE_BUFFER);
402+ if (r < 0)
403diff --git a/debian/patches/lp1999275/unit-check-more-specific-path-to-be-written-by-systemd-bi.patch b/debian/patches/lp1999275/unit-check-more-specific-path-to-be-written-by-systemd-bi.patch
404new file mode 100644
405index 0000000..5f0cfe2
406--- /dev/null
407+++ b/debian/patches/lp1999275/unit-check-more-specific-path-to-be-written-by-systemd-bi.patch
408@@ -0,0 +1,26 @@
409+From: Yu Watanabe <watanabe.yu+github@gmail.com>
410+Date: Sat, 10 Dec 2022 11:46:45 +0900
411+Subject: unit: check more specific path to be written by systemd-binfmt
412+
413+Origin: upstream, https://github.com/systemd/systemd/commit/f74a7cb45c2458f90de6d37c70fa3afc1a3be279
414+Bug-Ubuntu: https://launchpad.net/bugs/1999275
415+
416+Follow-up for 41807efb1594ae8e71e0255e154ea7d17be2251a.
417+Replaces #25690.
418+---
419+ units/systemd-binfmt.service.in | 2 +-
420+ 1 file changed, 1 insertion(+), 1 deletion(-)
421+
422+diff --git a/units/systemd-binfmt.service.in b/units/systemd-binfmt.service.in
423+index 96f595a..5bf3e99 100644
424+--- a/units/systemd-binfmt.service.in
425++++ b/units/systemd-binfmt.service.in
426+@@ -18,7 +18,7 @@ After=proc-sys-fs-binfmt_misc.automount
427+ After=proc-sys-fs-binfmt_misc.mount
428+ After=local-fs.target
429+ Before=sysinit.target shutdown.target
430+-ConditionPathIsReadWrite=/proc/sys/
431++ConditionPathIsMountPoint=/proc/sys/fs/binfmt_misc
432+ ConditionDirectoryNotEmpty=|/lib/binfmt.d
433+ ConditionDirectoryNotEmpty=|/usr/lib/binfmt.d
434+ ConditionDirectoryNotEmpty=|/usr/local/lib/binfmt.d
435diff --git a/debian/patches/lp2009743/network-dhcp4-do-not-ignore-the-gateway-even-if-the-desti.patch b/debian/patches/lp2009743/network-dhcp4-do-not-ignore-the-gateway-even-if-the-desti.patch
436new file mode 100644
437index 0000000..b83201f
438--- /dev/null
439+++ b/debian/patches/lp2009743/network-dhcp4-do-not-ignore-the-gateway-even-if-the-desti.patch
440@@ -0,0 +1,59 @@
441+From: Yu Watanabe <watanabe.yu+github@gmail.com>
442+Date: Fri, 7 Jul 2023 06:31:04 +0900
443+Subject: network/dhcp4: do not ignore the gateway even if the destination is
444+ in the same network
445+
446+Origin: upstream, https://github.com/systemd/systemd/commit/77451f654a89d822cd288883edfac315949d1cb6
447+Bug-Ubuntu: https://launchpad.net/bugs/2009743
448+
449+Fixes #28280.
450+
451+(modified to apply to v249.11)
452+---
453+ src/network/networkd-dhcp4.c | 12 ++++++++----
454+ 1 file changed, 8 insertions(+), 4 deletions(-)
455+
456+diff --git a/src/network/networkd-dhcp4.c b/src/network/networkd-dhcp4.c
457+index 9b06edc..8dc85a4 100644
458+--- a/src/network/networkd-dhcp4.c
459++++ b/src/network/networkd-dhcp4.c
460+@@ -290,7 +290,8 @@ static int dhcp4_request_route_to_gateway(Link *link, const struct in_addr *gw)
461+ static int dhcp4_request_route_auto(
462+ Route *in,
463+ Link *link,
464+- const struct in_addr *gw) {
465++ const struct in_addr *gw,
466++ bool force_use_gw) {
467+
468+ _cleanup_(route_freep) Route *route = in;
469+ struct in_addr address, netmask, prefix;
470+@@ -335,7 +336,8 @@ static int dhcp4_request_route_auto(
471+ route->gw = IN_ADDR_NULL;
472+ route->prefsrc.in = address;
473+
474+- } else if (route->dst_prefixlen >= prefixlen &&
475++ } else if (!force_use_gw &&
476++ route->dst_prefixlen >= prefixlen &&
477+ (route->dst.in.s_addr & netmask.s_addr) == prefix.s_addr) {
478+ if (in4_addr_is_set(gw))
479+ log_link_debug(link, "DHCP: requested route destination "IPV4_ADDRESS_FMT_STR"/%u is in the assigned network "
480+@@ -450,7 +452,9 @@ static int dhcp4_request_static_routes(Link *link, struct in_addr *ret_default_g
481+ in4_addr_is_null(&default_gw))
482+ default_gw = gw;
483+
484+- r = dhcp4_request_route_auto(TAKE_PTR(route), link, &gw);
485++ /* Do not ignore the gateway given by the classless route option even if the destination is
486++ * in the same network. See issue #28280. */
487++ r = dhcp4_request_route_auto(TAKE_PTR(route), link, &gw, /* force_use_gw = */ classless_route);
488+ if (r < 0)
489+ return r;
490+ }
491+@@ -575,7 +579,7 @@ static int dhcp4_request_routes_to_servers(
492+ route->table = link_get_dhcp_route_table(link);
493+ route->mtu = link->network->dhcp_route_mtu;
494+
495+- r = dhcp4_request_route_auto(TAKE_PTR(route), link, gw);
496++ r = dhcp4_request_route_auto(TAKE_PTR(route), link, gw, /* force_use_gw = */ false);
497+ if (r < 0)
498+ return r;
499+ }
500diff --git a/debian/patches/lp2009743/test-network-add-one-more-testcase-for-DHCPv4-classless-r.patch b/debian/patches/lp2009743/test-network-add-one-more-testcase-for-DHCPv4-classless-r.patch
501new file mode 100644
502index 0000000..c19e9f7
503--- /dev/null
504+++ b/debian/patches/lp2009743/test-network-add-one-more-testcase-for-DHCPv4-classless-r.patch
505@@ -0,0 +1,33 @@
506+From: Yu Watanabe <watanabe.yu+github@gmail.com>
507+Date: Fri, 7 Jul 2023 06:57:04 +0900
508+Subject: test-network: add one more testcase for DHCPv4 classless route
509+
510+Origin: upstream, https://github.com/systemd/systemd/commit/86f6760038477e9e27ccea580f1b3b27328a98a7
511+Bug-Ubuntu: https://launchpad.net/bugs/2009743
512+
513+For issue #28280.
514+---
515+ test/test-network/systemd-networkd-tests.py | 3 ++-
516+ 1 file changed, 2 insertions(+), 1 deletion(-)
517+
518+diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
519+index aab7b57..5143381 100755
520+--- a/test/test-network/systemd-networkd-tests.py
521++++ b/test/test-network/systemd-networkd-tests.py
522+@@ -3999,7 +3999,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
523+ self.wait_online(['veth-peer:carrier'])
524+ additional_options = '--dhcp-option=option:dns-server,192.168.5.10,8.8.8.8 --dhcp-option=option:ntp-server,192.168.5.11,9.9.9.9 --dhcp-option=option:static-route,192.168.5.100,192.168.5.2,8.8.8.8,192.168.5.3'
525+ if classless:
526+- additional_options += ' --dhcp-option=option:classless-static-route,0.0.0.0/0,192.168.5.4,8.0.0.0/8,192.168.5.5'
527++ additional_options += ' --dhcp-option=option:classless-static-route,0.0.0.0/0,192.168.5.4,8.0.0.0/8,192.168.5.5,192.168.5.64/26,192.168.5.5'
528+ start_dnsmasq(additional_options=additional_options, lease_time='2m')
529+ self.wait_online(['veth99:routable', 'veth-peer:routable'])
530+
531+@@ -4011,6 +4011,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
532+ if classless:
533+ self.assertRegex(output, r'default via 192.168.5.4 proto dhcp src 192.168.5.[0-9]* metric 1024')
534+ self.assertRegex(output, r'8.0.0.0/8 via 192.168.5.5 proto dhcp src 192.168.5.[0-9]* metric 1024')
535++ self.assertRegex(output, r'192.168.5.64/26 via 192.168.5.5 proto dhcp src 192.168.5.[0-9]* metric 1024')
536+ self.assertRegex(output, r'192.168.5.4 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
537+ self.assertRegex(output, r'192.168.5.5 proto dhcp scope link src 192.168.5.[0-9]* metric 1024')
538+ else:
539diff --git a/debian/patches/lp2013543-core-reorder-systemd-arguments-on-reexec.patch b/debian/patches/lp2013543-core-reorder-systemd-arguments-on-reexec.patch
540new file mode 100644
541index 0000000..b4bb1ff
542--- /dev/null
543+++ b/debian/patches/lp2013543-core-reorder-systemd-arguments-on-reexec.patch
544@@ -0,0 +1,58 @@
545+From: Frantisek Sumsal <frantisek@sumsal.cz>
546+Date: Thu, 29 Jun 2023 13:31:19 +0200
547+Subject: core: reorder systemd arguments on reexec
548+
549+Origin: upstream, https://github.com/systemd/systemd/commit/163be31d380fbdcb56ec06c09e81774840df90dc
550+Bug-Ubuntu: https://launchpad.net/bugs/2013543
551+
552+When reexecuting system let's put our arguments carrying deserialization
553+info first followed by any existing arguments to make sure they get
554+parsed in case we get weird stuff from the kernel cmdline (like --).
555+
556+See: https://github.com/systemd/systemd/issues/28184
557+(cherry picked from commit 06afda6b38d5d730fca3c65449096425933272bc)
558+(cherry picked from commit 884ab38057dca70b8779c85884f4646057e80921)
559+---
560+ src/core/main.c | 6 +++++-
561+ test/TEST-01-BASIC/test.sh | 5 +++++
562+ 2 files changed, 10 insertions(+), 1 deletion(-)
563+
564+diff --git a/src/core/main.c b/src/core/main.c
565+index 66897c2..1bb3b6b 100644
566+--- a/src/core/main.c
567++++ b/src/core/main.c
568+@@ -1797,13 +1797,17 @@ static void do_reexecute(
569+ xsprintf(sfd, "%i", fileno(arg_serialization));
570+
571+ i = 1; /* Leave args[0] empty for now. */
572+- filter_args(args, &i, argv, argc);
573+
574++ /* Put our stuff first to make sure it always gets parsed in case
575++ * we get weird stuff from the kernel cmdline (like --) */
576+ if (switch_root_dir)
577+ args[i++] = "--switched-root";
578+ args[i++] = arg_system ? "--system" : "--user";
579+ args[i++] = "--deserialize";
580+ args[i++] = sfd;
581++
582++ filter_args(args, &i, argv, argc);
583++
584+ args[i++] = NULL;
585+
586+ assert(i <= args_size);
587+diff --git a/test/TEST-01-BASIC/test.sh b/test/TEST-01-BASIC/test.sh
588+index d42c0df..dbca6ac 100755
589+--- a/test/TEST-01-BASIC/test.sh
590++++ b/test/TEST-01-BASIC/test.sh
591+@@ -6,6 +6,11 @@ IMAGE_NAME="basic"
592+ RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
593+ TEST_REQUIRE_INSTALL_TESTS=0
594+
595++# Check if we can correctly deserialize if the kernel cmdline contains "weird" stuff
596++# like an invalid argument, "end of arguments" separator, or a sysvinit argument (-z)
597++# See: https://github.com/systemd/systemd/issues/28184
598++KERNEL_APPEND="foo -- -z bar --- baz $KERNEL_APPEND"
599++
600+ # shellcheck source=test/test-functions
601+ . "${TEST_BASE_DIR:?}/test-functions"
602+
603diff --git a/debian/patches/lp2025563-shutdown-get-only-active-md-arrays.patch b/debian/patches/lp2025563-shutdown-get-only-active-md-arrays.patch
604new file mode 100644
605index 0000000..d2cc39f
606--- /dev/null
607+++ b/debian/patches/lp2025563-shutdown-get-only-active-md-arrays.patch
608@@ -0,0 +1,67 @@
609+From: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
610+Date: Tue, 29 Mar 2022 12:49:54 +0200
611+Subject: shutdown: get only active md arrays.
612+
613+Origin: upstream, https://github.com/systemd/systemd/commit/3a3b022d2cc112803ea7b9beea98bbcad110368a
614+Bug-Ubuntu: https://launchpad.net/bugs/2025563
615+
616+Current md_list_get() implementation filters all block devices, started from
617+"md*". This is ambiguous because list could contain:
618+- partitions created upon md device (mdXpY)
619+- external metadata container- specific type of md array.
620+
621+For partitions there is no issue, because they aren't handle STOP_ARRAY
622+ioctl sent later. It generates misleading errors only.
623+
624+Second case is more problematic because containers are not locked in kernel.
625+They are stopped even if container member array is active. For that reason
626+reboot or shutdown flow could be blocked because metadata manager cannot be
627+restarted after switch root on shutdown.
628+
629+Add filters to remove partitions and containers from md_list. Partitions
630+can be excluded by DEVTYPE. Containers are determined by MD_LEVEL
631+property, we are excluding all with "container" value.
632+
633+Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
634+---
635+ src/shutdown/umount.c | 18 +++++++++++++++++-
636+ 1 file changed, 17 insertions(+), 1 deletion(-)
637+
638+diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c
639+index 1f945b7..9325870 100644
640+--- a/src/shutdown/umount.c
641++++ b/src/shutdown/umount.c
642+@@ -352,9 +352,14 @@ static int md_list_get(MountPoint **head) {
643+ if (r < 0)
644+ return r;
645+
646++ /* Filter out partitions. */
647++ r = sd_device_enumerator_add_match_property(e, "DEVTYPE", "disk");
648++ if (r < 0)
649++ return r;
650++
651+ FOREACH_DEVICE(e, d) {
652+ _cleanup_free_ char *p = NULL;
653+- const char *dn;
654++ const char *dn, *md_level;
655+ MountPoint *m;
656+ dev_t devnum;
657+
658+@@ -362,6 +367,17 @@ static int md_list_get(MountPoint **head) {
659+ sd_device_get_devname(d, &dn) < 0)
660+ continue;
661+
662++ r = sd_device_get_property_value(d, "MD_LEVEL", &md_level);
663++ if (r < 0) {
664++ log_warning_errno(r, "Failed to get MD_LEVEL property for %s, ignoring: %m", dn);
665++ continue;
666++ }
667++
668++ /* MD "containers" are a special type of MD devices, used for external metadata.
669++ * Since it doesn't provide RAID functionality in itself we don't need to stop it. */
670++ if (streq(md_level, "container"))
671++ continue;
672++
673+ p = strdup(dn);
674+ if (!p)
675+ return -ENOMEM;
676diff --git a/debian/patches/lp2028180-udev-rules-fix-nvme-symlink-creation-on-namespace-changes.patch b/debian/patches/lp2028180-udev-rules-fix-nvme-symlink-creation-on-namespace-changes.patch
677new file mode 100644
678index 0000000..6f1adfe
679--- /dev/null
680+++ b/debian/patches/lp2028180-udev-rules-fix-nvme-symlink-creation-on-namespace-changes.patch
681@@ -0,0 +1,47 @@
682+From: Thomas Blume <Thomas.Blume@suse.com>
683+Date: Thu, 2 Mar 2023 12:06:13 +0100
684+Subject: udev-rules: fix nvme symlink creation on namespace changes
685+
686+Origin: upstream, https://github.com/systemd/systemd/commit/c5ba7a2a4dd19a2d31b8a9d52d3c4bdde78387f0
687+Bug-Ubuntu: https://launchpad.net/bugs/2028180
688+
689+The nvme by-id symlink changes to the latest namespace when a new namespace gets
690+added, for example by connecting multiple NVMe/TCP host controllers via nvme
691+connect-all.
692+That is incorrect for persistent device links.
693+The persistent symbolic device link should continue to point to the same NVMe
694+namespace throughout the lifetime of the current boot.
695+Therefore the namespace id needs to be added to the link name.
696+
697+(modified to apply to v249.11)
698+---
699+ rules.d/60-persistent-storage.rules | 8 ++++++++
700+ 1 file changed, 8 insertions(+)
701+
702+diff --git a/rules.d/60-persistent-storage.rules b/rules.d/60-persistent-storage.rules
703+index a2417cd..1e78f04 100644
704+--- a/rules.d/60-persistent-storage.rules
705++++ b/rules.d/60-persistent-storage.rules
706+@@ -37,14 +37,22 @@ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{serial}=="?*", ENV{ID_S
707+ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{wwid}=="?*", ENV{ID_WWN}="$attr{wwid}"
708+ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
709+ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{firmware_rev}=="?*", ENV{ID_REVISION}="$attr{firmware_rev}"
710++KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ATTRS{nsid}=="?*", ENV{ID_NSID}="$attr{nsid}"
711++# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
712+ KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
713+ OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
714++KERNEL=="nvme*[0-9]n*[0-9]", ENV{DEVTYPE}=="disk", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*",\
715++ OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}_$env{ID_NSID}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}"
716+
717+ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{serial}=="?*", ENV{ID_SERIAL_SHORT}="$attr{serial}"
718+ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{model}=="?*", ENV{ID_MODEL}="$attr{model}"
719+ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{firmware_rev}=="?*", ENV{ID_REVISION}="$attr{firmware_rev}"
720++KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ATTRS{nsid}=="?*", ENV{ID_NSID}="$attr{nsid}"
721++# obsolete symlink that might get overridden on adding a new nvme controller, kept for backward compatibility
722+ KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", \
723+ OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
724++KERNEL=="nvme*[0-9]n*[0-9]p*[0-9]", ENV{DEVTYPE}=="partition", ENV{ID_MODEL}=="?*", ENV{ID_SERIAL_SHORT}=="?*", ENV{ID_NSID}=="?*",\
725++ OPTIONS="string_escape=replace", ENV{ID_SERIAL}="$env{ID_MODEL}_$env{ID_SERIAL_SHORT}_$env{ID_NSID}", SYMLINK+="disk/by-id/nvme-$env{ID_SERIAL}-part%n"
726+
727+ # virtio-blk
728+ KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*", ENV{ID_SERIAL}="$attr{serial}", SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
729diff --git a/debian/patches/series b/debian/patches/series
730index c98336a..7730bb0 100644
731--- a/debian/patches/series
732+++ b/debian/patches/series
733@@ -46,7 +46,6 @@ debian/Ubuntu-core-in-execute-soft-fail-setting-Nice-priority-when.patch
734 debian/Ubuntu-units-set-ConditionVirtualization-private-users-on-j.patch
735 debian/UBUNTU-Add-AssumedApparmorLabel-unconfined-to-timedate1-dbus.patch
736 debian/UBUNTU-test-test-functions-launch-qemu-with-vga-none.patch
737-debian/UBUNTU-wait-online-exit-if-no-links-are-managed.patch
738 debian/UBUNTU-journald.service-set-Nice-1-to-dodge-watchdog-on-soft-loc.patch
739 debian/UBUNTU-units-block-CAP_SYS_MODULE-units-in-containers-too.patch
740 debian/UBUNTU-test-sleep-skip-test_fiemap-upon-inapproriate-ioctl-.patch
741@@ -113,3 +112,14 @@ lp2002445/sd-device-make-device_set_syspath-clear-sysname-and-sysnu.patch
742 lp2002445/udev-restore-syspath-and-properties-on-failure.patch
743 lp2002445/sd-device-introduce-device_get_property_int.patch
744 lp2002445/core-device-ignore-failed-uevents.patch
745+lp2025563-shutdown-get-only-active-md-arrays.patch
746+lp2028180-udev-rules-fix-nvme-symlink-creation-on-namespace-changes.patch
747+lp2013543-core-reorder-systemd-arguments-on-reexec.patch
748+lp2009743/network-dhcp4-do-not-ignore-the-gateway-even-if-the-desti.patch
749+lp2009743/test-network-add-one-more-testcase-for-DHCPv4-classless-r.patch
750+lp1977630-fix_machinectl_pull_tar.patch
751+lp1991829-add-CAP_LINUX_IMMUTABLE-to-systemd-machined-so-it-ca.patch
752+lp1999275/binfmt-util-split-out-binfmt_mounted.patch
753+lp1999275/binfmt-util-also-check-if-binfmt-is-mounted-in-read-write.patch
754+lp1999275/binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch
755+lp1999275/unit-check-more-specific-path-to-be-written-by-systemd-bi.patch
756diff --git a/debian/systemd.postinst b/debian/systemd.postinst
757index d6799d0..73c529c 100644
758--- a/debian/systemd.postinst
759+++ b/debian/systemd.postinst
760@@ -87,7 +87,22 @@ fi
761
762 # skip daemon-reexec and try-restarts during shutdown to avoid hitting LP: #1803391
763 if [ -n "$2" ] && [ "$(systemctl is-system-running)" != "stopping" ]; then
764- _systemctl daemon-reexec || true
765+ # LP: #2013543 - the systemd cmdline can get mangled depending on the
766+ # contents of /proc/cmdline, which causes systemd to fail to deserialize
767+ # it's previous state on daemon-reexec. This means that for upgrades from
768+ # affected versions, we need a reboot and cannot re-exec here, else the
769+ # bug could be triggered.
770+ if dpkg --compare-versions "$2" lt "249.11-0ubuntu3.10~"; then
771+ if ! grep -Fqsx systemd /run/reboot-required.pkgs; then
772+ echo systemd >> /run/reboot-required.pkgs || true
773+ fi
774+
775+ # Reload to avoid warnings when restarting services below
776+ _systemctl daemon-reload || true
777+ else
778+ _systemctl daemon-reexec || true
779+ fi
780+
781 # don't restart logind; this can be done again once this gets implemented:
782 # https://github.com/systemd/systemd/issues/1163
783 if dpkg --compare-versions "$2" lt-nl "246.2-2~"; then
784diff --git a/debian/tests/tests-in-lxd b/debian/tests/tests-in-lxd
785index b442ed1..6d5921b 100644
786--- a/debian/tests/tests-in-lxd
787+++ b/debian/tests/tests-in-lxd
788@@ -52,7 +52,7 @@ lxc exec systemd-lxc -- sh -c "echo [Service] > /etc/systemd/system/systemd-sysu
789 lxc exec systemd-lxc -- sh -c "echo LoadCredential= >> /etc/systemd/system/systemd-sysusers.service.d/override.conf"
790
791 lxc stop systemd-lxc
792-lxc publish systemd-lxc --alias $IMAGE
793+lxc publish systemd-lxc --reuse --alias $IMAGE
794
795 for t in unit-tests boot-and-services; do
796 autopkgtest -U -B . --test-name=$t -- lxd $IMAGE || [ $? = 2 ] # see Debian's #960267

Subscribers

People subscribed via source and target branches