Merge ~enr0n/ubuntu/+source/systemd:ubuntu-jammy into ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-jammy
- Git
- lp:~enr0n/ubuntu/+source/systemd
- ubuntu-jammy
- Merge into ubuntu-jammy
Status: | Merged |
---|---|
Merged at revision: | 5241fe7a5434f88d94bdc4dd638b4a14413ad80c |
Proposed branch: | ~enr0n/ubuntu/+source/systemd:ubuntu-jammy |
Merge into: | ~ubuntu-core-dev/ubuntu/+source/systemd:ubuntu-jammy |
Diff against target: |
472 lines (+303/-25) 5 files modified
debian/changelog (+16/-0) debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch (+164/-25) debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch (+116/-0) debian/patches/series (+1/-0) debian/tests/upstream (+6/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Lukas Märdian | Approve | ||
Review via email: mp+455718@code.launchpad.net |
Commit message
Description of the change
SRU for a couple of fixes needed in core.
systemd 249.11-
systemd 249.11-
systemd 249.11-
systemd 249.11-
s390x would not trigger.
Nick Rosbrook (enr0n) wrote : | # |
> Thanks for executing autopkgtests and test builds in a PPA!
>
> I verified that the patch cherry-picked from upstream matches upstream's logic
> (lp2037281-
> so that should be fine.
>
> Also the logic in the Ubuntu Core read-only-etc hacks patch is looking good to
> me. It's sad that we cannot find a better way around this, other than patching
> systemd. But from reading the bug report comments that seems to be hard. I
> have one remark about this specific patch:
We do have an open PR upstream that's some hope of landing soon enough that I can easily backport it to noble (https:/
> - bug #2035122 needs to be integrated in Noble's UBUNTU-
> hacks.patch.
> => Will this happen with the next systemd merge? Please state your plans in
> the bug report, so it's clear to the SRU team, also target it to the other
> missing series (Lunar, Mantic), marking it WONTFIX, as this only applies to
> Ubuntu Core.
Thanks for the reminder about the bug statuses! And yes, I plan to do this on merge if the above PR is not accepted by then.
> Otherwise, those changes seem to be fine!
Thanks for reviewing!
Preview Diff
1 | diff --git a/debian/changelog b/debian/changelog |
2 | index 0708492..54968bb 100644 |
3 | --- a/debian/changelog |
4 | +++ b/debian/changelog |
5 | @@ -1,3 +1,19 @@ |
6 | +systemd (249.11-0ubuntu3.12) UNRELEASED; urgency=medium |
7 | + |
8 | + * core/device: ignore DEVICE_FOUND_UDEV bit on switching root (LP: #2037281) |
9 | + File: debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch |
10 | + https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=00f86f0b20f794f30aabe7181912d2ec2207e292 |
11 | + * use read-only /etc hack in more places (LP: #2035122) |
12 | + File: debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch |
13 | + https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=c57406e850396a5d446aefe5e70a3aeaad080d72 |
14 | + * autopkgtest: do not allow qemu to be used on ppc64el. |
15 | + Almost every run on ppc64el takes 12 to 24 hours, so do this as a last |
16 | + resort to relieve pressure on autopkgtest infrastructure. |
17 | + File: debian/tests/upstream |
18 | + https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/systemd/commit/?id=d125a1ed3f01e59dba2f370c13801bfb76c16f5d |
19 | + |
20 | + -- Nick Rosbrook <enr0n@ubuntu.com> Thu, 02 Nov 2023 09:52:13 -0400 |
21 | + |
22 | systemd (249.11-0ubuntu3.11) jammy; urgency=medium |
23 | |
24 | * wait-online: exit early if all links are ignored (LP: #2036358) |
25 | diff --git a/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch b/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch |
26 | index 994bd34..b3096ec 100644 |
27 | --- a/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch |
28 | +++ b/debian/patches/debian/UBUNTU-Support-system-image-read-only-etc.patch |
29 | @@ -9,11 +9,54 @@ we need to update those files instead if the original files are symlinks into |
30 | |
31 | Forwarded: OMGno, this is a rather nasty hack until we fix system-image to get a writable /etc |
32 | Bug-Ubuntu: https://launchpad.net/bugs/1227520 |
33 | +Bug-Ubuntu: https://launchpad.net/bugs/2035122 |
34 | --- |
35 | + src/core/locale-setup.c | 22 +++++++++++++++++++++- |
36 | src/hostname/hostnamed.c | 34 +++++++++++++++++++++++++++------- |
37 | + src/locale/keymap-util.c | 35 +++++++++++++++++++++++++++-------- |
38 | src/timedate/timedated.c | 31 +++++++++++++++++++++++++------ |
39 | - 2 files changed, 52 insertions(+), 13 deletions(-) |
40 | + 4 files changed, 100 insertions(+), 22 deletions(-) |
41 | |
42 | +diff --git a/src/core/locale-setup.c b/src/core/locale-setup.c |
43 | +index b4ea9e2..5b4de24 100644 |
44 | +--- a/src/core/locale-setup.c |
45 | ++++ b/src/core/locale-setup.c |
46 | +@@ -12,6 +12,26 @@ |
47 | + #include "strv.h" |
48 | + #include "util.h" |
49 | + #include "virt.h" |
50 | ++#include "fs-util.h" |
51 | ++ |
52 | ++/* Hack for Ubuntu Phone/Core: check if path is an existing symlink to |
53 | ++ * /etc/writable; if it is, update that instead */ |
54 | ++static const char* writable_filename(const char *path) { |
55 | ++ ssize_t r; |
56 | ++ static char realfile_buf[PATH_MAX]; |
57 | ++ _cleanup_free_ char *realfile = NULL; |
58 | ++ const char *result = path; |
59 | ++ int orig_errno = errno; |
60 | ++ |
61 | ++ r = readlink_and_make_absolute(path, &realfile); |
62 | ++ if (r >= 0 && startswith(realfile, "/etc/writable")) { |
63 | ++ snprintf(realfile_buf, sizeof(realfile_buf), "%s", realfile); |
64 | ++ result = realfile_buf; |
65 | ++ } |
66 | ++ |
67 | ++ errno = orig_errno; |
68 | ++ return result; |
69 | ++} |
70 | + |
71 | + int locale_setup(char ***environment) { |
72 | + _cleanup_(locale_variables_freep) char *variables[_VARIABLE_LC_MAX] = {}; |
73 | +@@ -59,7 +79,7 @@ int locale_setup(char ***environment) { |
74 | + } |
75 | + |
76 | + if (r <= 0) { |
77 | +- r = parse_env_file(NULL, "/etc/default/locale", |
78 | ++ r = parse_env_file(NULL, writable_filename("/etc/default/locale"), |
79 | + "LANG", &variables[VARIABLE_LANG], |
80 | + "LANGUAGE", &variables[VARIABLE_LANGUAGE], |
81 | + "LC_CTYPE", &variables[VARIABLE_LC_CTYPE], |
82 | diff --git a/src/hostname/hostnamed.c b/src/hostname/hostnamed.c |
83 | index 36702f2..a49baec 100644 |
84 | --- a/src/hostname/hostnamed.c |
85 | @@ -29,7 +72,7 @@ index 36702f2..a49baec 100644 |
86 | @@ -92,6 +93,25 @@ static void context_destroy(Context *c) { |
87 | bus_verify_polkit_async_registry_free(c->polkit_registry); |
88 | } |
89 | - |
90 | + |
91 | +/* Hack for Ubuntu phone: check if path is an existing symlink to |
92 | + * /etc/writable; if it is, update that instead */ |
93 | +static const char* writable_filename(const char *path) { |
94 | @@ -53,18 +96,18 @@ index 36702f2..a49baec 100644 |
95 | struct stat current_stat = {}; |
96 | int r; |
97 | @@ -117,7 +137,7 @@ static void context_read_machine_info(Context *c) { |
98 | - |
99 | + |
100 | assert(c); |
101 | - |
102 | + |
103 | - if (stat("/etc/machine-info", ¤t_stat) >= 0 && |
104 | + if (stat(writable_filename("/etc/machine-info"), ¤t_stat) >= 0 && |
105 | stat_inode_unmodified(&c->etc_machine_info_stat, ¤t_stat)) |
106 | return; |
107 | - |
108 | + |
109 | @@ -128,7 +148,7 @@ static void context_read_machine_info(Context *c) { |
110 | (UINT64_C(1) << PROP_DEPLOYMENT) | |
111 | (UINT64_C(1) << PROP_LOCATION)); |
112 | - |
113 | + |
114 | - r = parse_env_file(NULL, "/etc/machine-info", |
115 | + r = parse_env_file(NULL, writable_filename("/etc/machine-info"), |
116 | "PRETTY_HOSTNAME", &c->data[PROP_PRETTY_HOSTNAME], |
117 | @@ -72,47 +115,143 @@ index 36702f2..a49baec 100644 |
118 | "CHASSIS", &c->data[PROP_CHASSIS], |
119 | @@ -388,14 +408,14 @@ static int context_write_data_static_hostname(Context *c) { |
120 | s = &c->etc_hostname_stat; |
121 | - |
122 | + |
123 | if (isempty(c->data[PROP_STATIC_HOSTNAME])) { |
124 | - if (unlink("/etc/hostname") < 0 && errno != ENOENT) |
125 | + if (unlink(writable_filename("/etc/hostname")) < 0 && errno != ENOENT) |
126 | return -errno; |
127 | - |
128 | + |
129 | TAKE_PTR(s); |
130 | return 0; |
131 | } |
132 | - |
133 | + |
134 | - r = write_string_file_atomic_label("/etc/hostname", c->data[PROP_STATIC_HOSTNAME]); |
135 | + r = write_string_file_atomic_label(writable_filename("/etc/hostname"), c->data[PROP_STATIC_HOSTNAME]); |
136 | if (r < 0) |
137 | return r; |
138 | - |
139 | + |
140 | @@ -421,7 +441,7 @@ static int context_write_data_machine_info(Context *c) { |
141 | * already, even if we can't make it hit the disk. */ |
142 | s = &c->etc_machine_info_stat; |
143 | - |
144 | + |
145 | - r = load_env_file(NULL, "/etc/machine-info", &l); |
146 | + r = load_env_file(NULL, writable_filename("/etc/machine-info"), &l); |
147 | if (r < 0 && r != -ENOENT) |
148 | return r; |
149 | - |
150 | + |
151 | @@ -434,14 +454,14 @@ static int context_write_data_machine_info(Context *c) { |
152 | } |
153 | - |
154 | + |
155 | if (strv_isempty(l)) { |
156 | - if (unlink("/etc/machine-info") < 0 && errno != ENOENT) |
157 | + if (unlink(writable_filename("/etc/machine-info")) < 0 && errno != ENOENT) |
158 | return -errno; |
159 | - |
160 | + |
161 | TAKE_PTR(s); |
162 | return 0; |
163 | } |
164 | - |
165 | + |
166 | - r = write_env_file_label("/etc/machine-info", l); |
167 | + r = write_env_file_label(writable_filename("/etc/machine-info"), l); |
168 | if (r < 0) |
169 | return r; |
170 | - |
171 | + |
172 | +diff --git a/src/locale/keymap-util.c b/src/locale/keymap-util.c |
173 | +index 6d064e2..dad8a27 100644 |
174 | +--- a/src/locale/keymap-util.c |
175 | ++++ b/src/locale/keymap-util.c |
176 | +@@ -25,6 +25,25 @@ |
177 | + #include "strv.h" |
178 | + #include "tmpfile-util.h" |
179 | + |
180 | ++/* Hack for Ubuntu Phone/Core: check if path is an existing symlink to |
181 | ++ * /etc/writable; if it is, update that instead */ |
182 | ++static const char* writable_filename(const char *path) { |
183 | ++ ssize_t r; |
184 | ++ static char realfile_buf[PATH_MAX]; |
185 | ++ _cleanup_free_ char *realfile = NULL; |
186 | ++ const char *result = path; |
187 | ++ int orig_errno = errno; |
188 | ++ |
189 | ++ r = readlink_and_make_absolute(path, &realfile); |
190 | ++ if (r >= 0 && startswith(realfile, "/etc/writable")) { |
191 | ++ snprintf(realfile_buf, sizeof(realfile_buf), "%s", realfile); |
192 | ++ result = realfile_buf; |
193 | ++ } |
194 | ++ |
195 | ++ errno = orig_errno; |
196 | ++ return result; |
197 | ++} |
198 | ++ |
199 | + static bool startswith_comma(const char *s, const char *prefix) { |
200 | + s = startswith(s, prefix); |
201 | + if (!s) |
202 | +@@ -104,7 +123,7 @@ int locale_read_data(Context *c, sd_bus_message *m) { |
203 | + |
204 | + r = stat(path, &st); |
205 | + if (r < 0 && errno == ENOENT) { |
206 | +- path = "/etc/default/locale"; |
207 | ++ path = writable_filename("/etc/default/locale"); |
208 | + r = stat(path, &st); |
209 | + } |
210 | + if (r < 0 && errno != ENOENT) |
211 | +@@ -213,7 +232,7 @@ int x11_read_data(Context *c, sd_bus_message *m) { |
212 | + c->x11_cache = sd_bus_message_ref(m); |
213 | + } |
214 | + |
215 | +- if (stat("/etc/default/keyboard", &st) < 0) { |
216 | ++ if (stat(writable_filename("/etc/default/keyboard"), &st) < 0) { |
217 | + if (errno != ENOENT) |
218 | + return -errno; |
219 | + |
220 | +@@ -230,7 +249,7 @@ int x11_read_data(Context *c, sd_bus_message *m) { |
221 | + c->x11_mtime = t; |
222 | + context_free_x11(c); |
223 | + |
224 | +- r = parse_env_file(NULL, "/etc/default/keyboard", |
225 | ++ r = parse_env_file(NULL, writable_filename("/etc/default/keyboard"), |
226 | + "XKBMODEL", &c->x11_model, |
227 | + "XKBLAYOUT", &c->x11_layout, |
228 | + "XKBVARIANT", &c->x11_variant, |
229 | +@@ -253,7 +272,7 @@ int locale_write_data(Context *c, char ***settings) { |
230 | + |
231 | + r = load_env_file(NULL, path, &l); |
232 | + if (r < 0 && r == -ENOENT) { |
233 | +- path = "/etc/default/locale"; |
234 | ++ path = writable_filename("/etc/default/locale"); |
235 | + r = load_env_file(NULL, path, &l); |
236 | + } |
237 | + if (r < 0 && r != -ENOENT) |
238 | +@@ -326,7 +345,7 @@ int x11_write_data(Context *c) { |
239 | + int r; |
240 | + char *t, **l = NULL; |
241 | + |
242 | +- r = load_env_file(NULL, "/etc/default/keyboard", &l); |
243 | ++ r = load_env_file(NULL, writable_filename("/etc/default/keyboard"), &l); |
244 | + if (r < 0 && r != -ENOENT) |
245 | + return r; |
246 | + |
247 | +@@ -396,17 +415,17 @@ int x11_write_data(Context *c) { |
248 | + if (strv_isempty(l)) { |
249 | + strv_free(l); |
250 | + |
251 | +- if (unlink("/etc/default/keyboard") < 0) |
252 | ++ if (unlink(writable_filename("/etc/default/keyboard")) < 0) |
253 | + return errno == ENOENT ? 0 : -errno; |
254 | + |
255 | + c->vc_mtime = USEC_INFINITY; |
256 | + return 0; |
257 | + } |
258 | + |
259 | +- r = write_env_file("/etc/default/keyboard", l); |
260 | ++ r = write_env_file(writable_filename("/etc/default/keyboard"), l); |
261 | + strv_free(l); |
262 | + |
263 | +- if (r >= 0 && stat("/etc/default/keyboard", &st) >= 0) |
264 | ++ if (r >= 0 && stat(writable_filename("/etc/default/keyboard"), &st) >= 0) |
265 | + c->x11_mtime = timespec_load(&st.st_mtim); |
266 | + |
267 | + return r; |
268 | diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c |
269 | index 2083c9d..00fb521 100644 |
270 | --- a/src/timedate/timedated.c |
271 | @@ -120,7 +259,7 @@ index 2083c9d..00fb521 100644 |
272 | @@ -290,6 +290,25 @@ static int context_read_data(Context *c) { |
273 | return 0; |
274 | } |
275 | - |
276 | + |
277 | +/* Hack for Ubuntu phone: check if path is an existing symlink to |
278 | + * /etc/writable; if it is, update that instead */ |
279 | +static const char* writable_filename(const char *path) { |
280 | @@ -144,27 +283,27 @@ index 2083c9d..00fb521 100644 |
281 | _cleanup_free_ char *p = NULL; |
282 | const char *source; |
283 | @@ -307,10 +326,10 @@ static int context_write_data_timezone(Context *c) { |
284 | - |
285 | + |
286 | if (access("/usr/share/zoneinfo/UTC", F_OK) < 0) { |
287 | - |
288 | + |
289 | - if (unlink("/etc/localtime") < 0 && errno != ENOENT) |
290 | + if (unlink(writable_filename("/etc/localtime")) < 0 && errno != ENOENT) |
291 | r = -errno; |
292 | - |
293 | + |
294 | - if (unlink("/etc/timezone") < 0 && errno != ENOENT) |
295 | + if (unlink(writable_filename("/etc/timezone")) < 0 && errno != ENOENT) |
296 | r = -errno; |
297 | - |
298 | + |
299 | return r; |
300 | @@ -325,12 +344,12 @@ static int context_write_data_timezone(Context *c) { |
301 | source = p; |
302 | } |
303 | - |
304 | + |
305 | - r = symlink_atomic(source, "/etc/localtime"); |
306 | + r = symlink_atomic(source, writable_filename("/etc/localtime")); |
307 | if (r < 0) |
308 | return r; |
309 | - |
310 | + |
311 | - if (stat("/etc/timezone", &st) == 0 && S_ISREG(st.st_mode)) { |
312 | - r = write_string_file("/etc/timezone", c->zone, WRITE_STRING_FILE_CREATE|WRITE_STRING_FILE_ATOMIC); |
313 | + if (stat(writable_filename("/etc/timezone"), &st) == 0 && S_ISREG(st.st_mode)) { |
314 | @@ -174,10 +313,10 @@ index 2083c9d..00fb521 100644 |
315 | } |
316 | @@ -396,7 +415,7 @@ static int context_write_data_local_rtc(Context *c) { |
317 | *(char*) mempcpy(stpcpy(stpcpy(mempcpy(w, s, a), prepend), c->local_rtc ? "LOCAL" : "UTC"), e, b) = 0; |
318 | - |
319 | + |
320 | if (streq(w, NULL_ADJTIME_UTC)) { |
321 | - if (unlink("/etc/adjtime") < 0) |
322 | + if (unlink(writable_filename("/etc/adjtime")) < 0) |
323 | if (errno != ENOENT) |
324 | return -errno; |
325 | - |
326 | + |
327 | diff --git a/debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch b/debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch |
328 | new file mode 100644 |
329 | index 0000000..1951277 |
330 | --- /dev/null |
331 | +++ b/debian/patches/lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch |
332 | @@ -0,0 +1,116 @@ |
333 | +From: Yu Watanabe <watanabe.yu+github@gmail.com> |
334 | +Date: Fri, 29 Apr 2022 20:29:11 +0900 |
335 | +Subject: core/device: ignore DEVICE_FOUND_UDEV bit on switching root |
336 | + |
337 | +Origin: upstream, https://github.com/systemd/systemd/commit/75d7b5989f99125e52d5c0e5656fa1cd0fae2405 |
338 | +Bug-Ubuntu: https://launchpad.net/bugs/2037281 |
339 | + |
340 | +The issue #12953 is caused by the following: |
341 | +On switching root, |
342 | +- deserialized_found == DEVICE_FOUND_UDEV | DEVICE_FOUND_MOUNT, |
343 | +- deserialized_state == DEVICE_PLUGGED, |
344 | +- enumerated_found == DEVICE_FOUND_MOUNT, |
345 | +On switching root, most devices are not found by the enumeration process. |
346 | +Hence, the device state is set to plugged by device_coldplug(), and then |
347 | +changed to the dead state in device_catchup(). So the corresponding |
348 | +mount point is unmounted. Later when the device is processed by udevd, it |
349 | +will be changed to plugged state again. |
350 | + |
351 | +The issue #23208 is caused by the fact that generated udev database in |
352 | +initramfs and the main system are often different. |
353 | + |
354 | +So, the two issues have the same root; we should not honor |
355 | +DEVICE_FOUND_UDEV bit in the deserialized_found on switching root. |
356 | + |
357 | +This partially reverts c6e892bc0eebe1d42c282bd2d8bae149fbeba85f. |
358 | + |
359 | +Fixes #12953 and #23208. |
360 | +Replaces #23215. |
361 | + |
362 | +Co-authored-by: Martin Wilck <mwilck@suse.com> |
363 | +--- |
364 | + src/core/device.c | 59 +++++++++++++++++++++++++++++++++++++++++++++---------- |
365 | + 1 file changed, 49 insertions(+), 10 deletions(-) |
366 | + |
367 | +diff --git a/src/core/device.c b/src/core/device.c |
368 | +index e138754..31c503e 100644 |
369 | +--- a/src/core/device.c |
370 | ++++ b/src/core/device.c |
371 | +@@ -162,14 +162,57 @@ static int device_coldplug(Unit *u) { |
372 | + assert(d->state == DEVICE_DEAD); |
373 | + |
374 | + /* First, let's put the deserialized state and found mask into effect, if we have it. */ |
375 | ++ if (d->deserialized_state < 0) |
376 | ++ return 0; |
377 | ++ |
378 | ++ Manager *m = u->manager; |
379 | ++ DeviceFound found = d->deserialized_found; |
380 | ++ DeviceState state = d->deserialized_state; |
381 | ++ |
382 | ++ /* On initial boot, switch-root, reload, reexecute, the following happen: |
383 | ++ * 1. MANAGER_IS_RUNNING() == false |
384 | ++ * 2. enumerate devices: manager_enumerate() -> device_enumerate() |
385 | ++ * Device.enumerated_found is set. |
386 | ++ * 3. deserialize devices: manager_deserialize() -> device_deserialize() |
387 | ++ * Device.deserialize_state and Device.deserialized_found are set. |
388 | ++ * 4. coldplug devices: manager_coldplug() -> device_coldplug() |
389 | ++ * deserialized properties are copied to the main properties. |
390 | ++ * 5. MANAGER_IS_RUNNING() == true: manager_ready() |
391 | ++ * 6. catchup devices: manager_catchup() -> device_catchup() |
392 | ++ * Device.enumerated_found is applied to Device.found, and state is updated based on that. |
393 | ++ * |
394 | ++ * Notes: |
395 | ++ * - On initial boot, no udev database exists. Hence, no devices are enumerated in the step 2. |
396 | ++ * Also, there is no deserialized device. Device units are (a) generated based on dependencies of |
397 | ++ * other units, or (b) generated when uevents are received. |
398 | ++ * |
399 | ++ * - On switch-root, the udev databse may be cleared, except for devices with sticky bit, i.e. |
400 | ++ * OPTIONS="db_persist". Hence, almost no devices are enumerated in the step 2. However, in general, |
401 | ++ * we have several serialized devices. So, DEVICE_FOUND_UDEV bit in the deserialized_found must be |
402 | ++ * ignored, as udev rules in initramfs and the main system are often different. If the deserialized |
403 | ++ * state is DEVICE_PLUGGED, we need to downgrade it to DEVICE_TENTATIVE (or DEVICE_DEAD if nobody |
404 | ++ * sees the device). Unlike the other starting mode, Manager.honor_device_enumeration == false |
405 | ++ * (maybe, it is better to rename the flag) when device_coldplug() and device_catchup() are called. |
406 | ++ * Hence, let's conditionalize the operations by using the flag. After switch-root, systemd-udevd |
407 | ++ * will (re-)process all devices, and the Device.found and Device.state will be adjusted. |
408 | ++ * |
409 | ++ * - On reload or reexecute, we can trust enumerated_found, deserialized_found, and deserialized_state. |
410 | ++ * Of course, deserialized parameters may be outdated, but the unit state can be adjusted later by |
411 | ++ * device_catchup() or uevents. */ |
412 | ++ |
413 | ++ if (!m->honor_device_enumeration && !MANAGER_IS_USER(m)) { |
414 | ++ found &= ~DEVICE_FOUND_UDEV; /* ignore DEVICE_FOUND_UDEV bit */ |
415 | ++ if (state == DEVICE_PLUGGED) |
416 | ++ state = DEVICE_TENTATIVE; /* downgrade state */ |
417 | ++ if (found == DEVICE_NOT_FOUND) |
418 | ++ state = DEVICE_DEAD; /* If nobody sees the device, downgrade more */ |
419 | ++ } |
420 | + |
421 | +- if (d->deserialized_state < 0 || |
422 | +- (d->deserialized_state == d->state && |
423 | +- d->deserialized_found == d->found)) |
424 | ++ if (d->found == found && d->state == state) |
425 | + return 0; |
426 | + |
427 | +- d->found = d->deserialized_found; |
428 | +- device_set_state(d, d->deserialized_state); |
429 | ++ d->found = found; |
430 | ++ device_set_state(d, state); |
431 | + return 0; |
432 | + } |
433 | + |
434 | +@@ -682,13 +725,9 @@ static void device_found_changed(Device *d, DeviceFound previous, DeviceFound no |
435 | + } |
436 | + |
437 | + static void device_update_found_one(Device *d, DeviceFound found, DeviceFound mask) { |
438 | +- Manager *m; |
439 | +- |
440 | + assert(d); |
441 | + |
442 | +- m = UNIT(d)->manager; |
443 | +- |
444 | +- if (MANAGER_IS_RUNNING(m) && (m->honor_device_enumeration || MANAGER_IS_USER(m))) { |
445 | ++ if (MANAGER_IS_RUNNING(UNIT(d)->manager)) { |
446 | + DeviceFound n, previous; |
447 | + |
448 | + /* When we are already running, then apply the new mask right-away, and trigger state changes |
449 | diff --git a/debian/patches/series b/debian/patches/series |
450 | index 59f0a08..9b099f0 100644 |
451 | --- a/debian/patches/series |
452 | +++ b/debian/patches/series |
453 | @@ -124,3 +124,4 @@ lp1999275/binfmt-util-also-check-if-binfmt-is-mounted-in-read-write.patch |
454 | lp1999275/binfmt-check-if-binfmt-is-mounted-before-applying-rules.patch |
455 | lp1999275/unit-check-more-specific-path-to-be-written-by-systemd-bi.patch |
456 | lp2036358-wait-online-exit-early-if-all-links-are-ignored.patch |
457 | +lp2037281-core-device-ignore-DEVICE_FOUND_UDEV-bit-on-switching-roo.patch |
458 | diff --git a/debian/tests/upstream b/debian/tests/upstream |
459 | index f05f14c..0d60a21 100755 |
460 | --- a/debian/tests/upstream |
461 | +++ b/debian/tests/upstream |
462 | @@ -24,4 +24,10 @@ export TEST_SHOW_JOURNAL=warning |
463 | export TEST_REQUIRE_INSTALL_TESTS=0 |
464 | export TEST_PREFER_NSPAWN=1 |
465 | export NO_BUILD=1 |
466 | + |
467 | +# Temporarily disable tests running in QEMU on ppc64el (LP: #1992178) |
468 | +if [ "$DPKGARCH" = "ppc64el" ]; then |
469 | + export TEST_NO_QEMU=1 |
470 | +fi |
471 | + |
472 | test/run-integration-tests.sh |
Thanks for executing autopkgtests and test builds in a PPA!
I verified that the patch cherry-picked from upstream matches upstream's logic (lp2037281- core-device- ignore- DEVICE_ FOUND_UDEV- bit-on- switching- roo.patch) , so that should be fine.
Also the logic in the Ubuntu Core read-only-etc hacks patch is looking good to me. It's sad that we cannot find a better way around this, other than patching systemd. But from reading the bug report comments that seems to be hard. I have one remark about this specific patch:
- bug #2035122 needs to be integrated in Noble's UBUNTU- read-only- etc-hacks. patch.
=> Will this happen with the next systemd merge? Please state your plans in the bug report, so it's clear to the SRU team, also target it to the other missing series (Lunar, Mantic), marking it WONTFIX, as this only applies to Ubuntu Core.
Otherwise, those changes seem to be fine!