Merge ~wilkmarcin/ubuntu/+source/clevis:lp2065149-noble-ps-invalid-option--o into ubuntu/+source/clevis:ubuntu/noble-devel

Proposed by Marcin Wilk
Status: Needs review
Proposed branch: ~wilkmarcin/ubuntu/+source/clevis:lp2065149-noble-ps-invalid-option--o
Merge into: ubuntu/+source/clevis:ubuntu/noble-devel
Diff against target: 102 lines (+70/-1)
4 files modified
debian/changelog (+8/-0)
debian/control (+2/-1)
debian/patches/lp2065149-ps-invalid-option--o.patch (+59/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Dariusz Gadomski (community) Approve
Review via email: mp+499667@code.launchpad.net

Description of the change

Backported existing upstream fix https://github.com/latchset/clevis/commit/55eb002f7955279aebe4ca720c51ebd5f4d893f5

    * debian/patches/lp2065149-ps-invalid-option--o.patch: initramfs:
      fix killing child PIDs. Thanks to Oldřich Jedlička
      <email address hidden>. (LP: #2065149)

Please tag & sponsor.

PPA: ppa:wilkmarcin/wilkmarcin-srus

Steps to test:
Install clevis and clevis-initramfs packages version 20-1 on Ubuntu Noble.
Reboot the system. The following error will appear in the boot messages:
```
Begin: Running /scripts/local-bottom ... ps: invalid option -- 'o'
BusyBox v1.36.1 (Ubuntu 1:1.36.1-6ubuntu3.1) multi-call binary.

Usage: ps

Show list of processes

 w Wide output
 l Long output
done.
Begin: Running /scripts/init-bottom ... done.
```
Next, install the patched version:
# sudo add-apt-repository ppa:wilkmarcin/wilkmarcin-srus
# sudo apt update
# sudo apt install clevis-initramfs -y

Reboot the system. The aforementioned error will no longer appear.

Package Test Results:

autopkgtest [17:15:08]: test run-testsuite: -----------------------]
autopkgtest [17:15:08]: test run-testsuite: - - - - - - - - - - results - - - - - - - - - -
run-testsuite PASS
autopkgtest [17:15:08]: @@@@@@@@@@@@@@@@@@@@ summary
run-testsuite PASS

To post a comment you must log in.
Revision history for this message
Dariusz Gadomski (dgadomski) wrote :

lgtm

review: Approve

Unmerged commits

363234f... by Marcin Wilk

Update maintainer

8d8b61f... by Marcin Wilk

Update changelog

39db123... by Marcin Wilk

[PATCH] initramfs: fix killing child PIDs

Signed-off-by: Marcin Wilk <email address hidden>

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 f587c29..977f737 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,11 @@
6+clevis (20-1ubuntu0.24.04.1) noble; urgency=medium
7+
8+ * debian/patches/lp2065149-ps-invalid-option--o.patch: initramfs:
9+ fix killing child PIDs. Thanks to Oldřich Jedlička
10+ <oldium.pro@gmail.com>. (LP: #2065149)
11+
12+ -- Marcin Wilk <marcin.wilk@canonical.com> Tue, 20 Jan 2026 14:26:53 +0100
13+
14 clevis (20-1) unstable; urgency=medium
15
16 * New upstream version 20. Closes: #1068640
17diff --git a/debian/control b/debian/control
18index 4334c23..96aab76 100644
19--- a/debian/control
20+++ b/debian/control
21@@ -1,5 +1,6 @@
22 Source: clevis
23-Maintainer: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
24+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
25+XSBC-Original-Maintainer: Christoph Biedl <debian.axhn@manchmal.in-ulm.de>
26 Homepage: https://github.com/latchset/clevis
27 Standards-Version: 4.6.2
28 Vcs-Browser: https://git.in-ulm.de/cbiedl/clevis
29diff --git a/debian/patches/lp2065149-ps-invalid-option--o.patch b/debian/patches/lp2065149-ps-invalid-option--o.patch
30new file mode 100644
31index 0000000..57026a5
32--- /dev/null
33+++ b/debian/patches/lp2065149-ps-invalid-option--o.patch
34@@ -0,0 +1,59 @@
35+From 55eb002f7955279aebe4ca720c51ebd5f4d893f5 Mon Sep 17 00:00:00 2001
36+From: =?UTF-8?q?Old=C5=99ich=20Jedli=C4=8Dka?= <oldium.pro@gmail.com>
37+Date: Tue, 29 Oct 2024 20:32:21 +0100
38+Subject: [PATCH] initramfs: fix killing child PIDs
39+Origin: upstream, https://github.com/latchset/clevis/commit/55eb002f7955279aebe4ca720c51ebd5f4d893f5
40+Bug: https://github.com/latchset/clevis/pull/496
41+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/clevis/+bug/2065149
42+Applied-Upstream: commit: 55eb002f7955279aebe4ca720c51ebd5f4d893f5
43+---
44+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
45+
46+MIME-Version: 1.0
47+Content-Type: text/plain; charset=UTF-8
48+Content-Transfer-Encoding: 8bit
49+
50+Ubuntu's initramfs Busybox does not support `ps -o pid,ppid`, so fallback
51+to unpredictable `ps -l`. In any case use `awk` to find the position of PID
52+and PPID columns and dump appropriate child PIDs. This should be hopefully
53+bullet-proof.
54+
55+Also clean-up leftover PID file.
56+
57+Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
58+---
59+ .../scripts/local-bottom/clevis.in | 15 +++++++++++++--
60+ 1 file changed, 13 insertions(+), 2 deletions(-)
61+
62+diff --git a/src/initramfs-tools/scripts/local-bottom/clevis.in b/src/initramfs-tools/scripts/local-bottom/clevis.in
63+index fff3d75..4798f20 100755
64+--- a/src/initramfs-tools/scripts/local-bottom/clevis.in
65++++ b/src/initramfs-tools/scripts/local-bottom/clevis.in
66+@@ -34,11 +34,22 @@ esac
67+ [ -s /run/clevis.pid ] || exit 0
68+
69+ pid=$(cat /run/clevis.pid)
70+-child_pids=$(ps -o pid,ppid | awk -v pid="$pid" '$2==pid { print $1 }')
71++child_pids="$({ ps -o pid,ppid 2>/dev/null || ps -l ||
72++ { echo 'clevis: unable to get list of processes' >&2; exit 1; }; } |
73++ awk -v pid="$pid" '
74++ NR==1 {
75++ for (i=1; i<=NF; i++) if ($i == "PID") pid_col = i; else if ($i == "PPID") ppid_col = i
76++ if (!pid_col || !ppid_col) { print "clevis: unable to find PID and/or PPID columns in ps output" | "cat >&2"; exit 1 }
77++ next
78++ }
79++ { if ($ppid_col == pid) print $pid_col }')"
80++
81+ for kill_pid in $pid $child_pids; do
82+- kill "$kill_pid"
83++ kill "$kill_pid" 2>/dev/null
84+ done
85+
86++rm -f /run/clevis.pid
87++
88+ # Not really worried about downing extra interfaces: they will come up
89+ # during the actual boot. Might make this configurable later if needed.
90+
91+--
92+2.43.0
93+
94diff --git a/debian/patches/series b/debian/patches/series
95index f34cc3d..ecbbe16 100644
96--- a/debian/patches/series
97+++ b/debian/patches/series
98@@ -6,3 +6,4 @@ for-upstream/2020-05-21.embed-more-programs-in-initram.patch
99
100 # patches for Debian
101 debian/2020-05-21.set-unprivileged-user.patch
102+lp2065149-ps-invalid-option--o.patch

Subscribers

People subscribed via source and target branches