Merge ~bdrung/ubuntu/+source/initramfs-tools:swap into ubuntu/+source/initramfs-tools:ubuntu/devel

Proposed by Benjamin Drung
Status: Superseded
Proposed branch: ~bdrung/ubuntu/+source/initramfs-tools:swap
Merge into: ubuntu/+source/initramfs-tools:ubuntu/devel
Diff against target: 104 lines (+37/-0) (has conflicts)
5 files modified
.gitignore (+2/-0)
debian/.gitignore (+7/-0)
hooks/fsck (+10/-0)
init (+10/-0)
scripts/local-premount/resume (+8/-0)
Conflict in hooks/fsck
Conflict in init
Conflict in scripts/local-premount/resume
Reviewer Review Type Date Requested Status
Jeffery To Pending
Review via email: mp+468583@code.launchpad.net

This proposal has been superseded by a proposal from 2024-07-02.

To post a comment you must log in.

Unmerged commits

5678695... by Benjamin Drung

resume: always write valid resume device to /sys/power/resume

Users report that hibernation does not work on Ubuntu 24.04 (noble). The
initrd only sets the major:minor in `/sys/power/resume` in case of
resuming from hibernation, but systemd v255 will not allow hibernate to
start if the resume device has not be set in the kernel.

`blkid -p -o value -s TYPE $device` reports `swap` for swap partitions
and for swap files on Ubuntu 24.04 (noble). The type for resume images
is `swsuspend`.

So also set the major:minor in `/sys/power/resume` when the swap type is
`swap`.

Fixes: b3a78e4f8057 (" - resume: only resume when the partition contains a resume image - Fix resuming a hibernate session from a swapfile")
Fixes: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2057687

8fd3b04... by Benjamin Drung

fsck: Mention file system name in failed identification warning

`update-initramfs` might be unable to identify the file system type of
the root file system:

```
$ update-initramfs -u
update-initramfs: Generating /boot/initrd.img-5.15.0-1059-kvm
W: Couldn't identify type of root file system for fsck hook
```

This error message can be confusing and misleading for the user. The
Ubuntu bug reported initially assumed it to be a bug in initramfs-tools
but later found out that the file system missed the label.

Mention the file system name in failed identification warning to help
the user finding the reason.

Bug-Ubuntu: https://launchpad.net/bugs/2068077
Forwarded: https://salsa.debian.org/kernel-team/initramfs-tools/-/merge_requests/118
Signed-off-by: Benjamin Drung <email address hidden>

68dae92... by Jeffery To

Fix resume failure due to resume=UUID=... in certain cases

If resume= has not been set on the kernel command line, and either:
* RESUME=UUID=... is set in /etc/initramfs-tools/conf.d/resume
* RESUME=auto is set in /etc/initramfs-tool/conf.d/resume and swap is a
  traditional partition (not in LVM)

Then the resume variable will be set to a UUID, which causes the resume
local-premount script to fail as it expects the resume variable to be a
device path.

This moves the UUID handling further down, outside of the parse kernel
command line options loop, to catch these cases.

Fixes: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1769297
Fixes: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1853982
Fixes: https://bugs.launchpad.net/ubuntu/+source/initramfs-tools/+bug/1957194
Signed-off-by: Jeffery To <email address hidden>

326e5a7... by Benjamin Drung

Release initramfs-tools 0.142ubuntu28

Signed-off-by: Benjamin Drung <email address hidden>

0a8e905... by Benjamin Drung

auto_add_modules: group dracut-install calls for block modules

Group calls to `dracut-install` that use the same `-s` parameter.

Benchmark results
=================

Benchmark on a Raspberry Pi Zero 2W on Ubuntu 24.04 (noble) on
2024-06-04. Previous commit:

```
bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ): 228.483 s ± 5.953 s [User: 57.447 s, System: 162.737 s]
  Range (min … max): 219.897 s … 240.041 s 10 runs
```

This commit:

```
bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ): 226.658 s ± 5.861 s [User: 54.878 s, System: 160.566 s]
  Range (min … max): 220.091 s … 237.076 s 10 runs
```

bb20916... by Benjamin Drung

Use copy_modules_dir instead of dracut-install calls

dracut-install has some startup costs and reducing the number of
dracut-install will increase the execution time. So use
`copy_modules_dir` again for calls that do not use `-s`.

Benchmark results
=================

Benchmark on a Raspberry Pi Zero 2W on Ubuntu 24.04 (noble) on
2024-06-04. Previous commit:

```
bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ): 236.326 s ± 6.033 s [User: 62.455 s, System: 165.245 s]
  Range (min … max): 229.254 s … 244.094 s 10 runs
```

This commit:

```
bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ): 228.483 s ± 5.953 s [User: 57.447 s, System: 162.737 s]
  Range (min … max): 219.897 s … 240.041 s 10 runs
```

The expected difference (for two dracut-install calls less) is a few
seconds which fits within the margin of error. The changes of the range
is a good indicator.

3121df3... by Benjamin Drung

reduce number of dracut-install calls

dracut-install has a slow start-up time on ARM devices. Alper Nebi Yasak
wrote: "On my ARM64 Chromebooks dracut-install takes about 2-3 seconds
to start up even for a single module." [1]

Instead of `manual_add_modules` calling `dracut-install` directly,
collect the wanted kernel modules in a temporary file. Call
dracut-install at the end on all modules in one go.

Since the `vmxnet` hook from `open-vm-tools` and `bootcdinitramfshook`
from `bootcd` look at the copied kernel modules, call
`apply_add_modules` before calling the hooks to not break those hooks.

`hidden_dep_add_modules` looks at the installed kernel modules. So call
`apply_add_modules` before it. Since it is the last function that
installs kernel modules, let it call dracut-install directly.

This can be a breaking change. To restore the previous behavior, call
`apply_add_modules` without arguments after a `manual_add_modules` call.

Benchmark results
=================

Benchmark on a Raspberry Pi Zero 2W on Ubuntu 24.04 (noble) on
2024-06-03. initramfs-tools 0.142ubuntu25.1:

```
bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ): 402.751 s ± 5.592 s [User: 166.316 s, System: 228.909 s]
  Range (min … max): 394.380 s … 411.445 s 10 runs
```

This commit:

```
bdrung@zero2w:~$ sudo hyperfine --warmup 1 -r 10 "update-initramfs -u"
Benchmark 1: update-initramfs -u
  Time (mean ± σ): 236.326 s ± 6.033 s [User: 62.455 s, System: 165.245 s]
  Range (min … max): 229.254 s … 244.094 s 10 runs
```

LP: #2065180
Forwarded: https://salsa.debian.org/kernel-team/initramfs-tools/-/merge_requests/114
[1] https://salsa.debian.org/kernel-team/initramfs-tools/-/merge_requests/102

949a2ce... by Benjamin Drung

mkinitramfs: Resolve hidden dependencies after all modules were copied

Move the `hidden_dep_add_modules` call after all kernel modules were
copied. Hooks might add or remove kernel modules that will infuence what
kernel modules `hidden_dep_add_modules` will add.

c2dfc45... by Benjamin Drung

hook-functions: Use firmware search order from kernel

`add_firmware` should behave like the kernel searches for the firmware
files in `_request_firmware`. This functions calls
`fw_get_filesystem_firmware` (that iterates over the paths) for
uncompressed files, then `.zstd`, and then `.xz`.

See also https://salsa.debian.org/kernel-team/initramfs-tools/-/merge_requests/108

4ef7091... by Benjamin Drung

Release initramfs-tools 0.142ubuntu27

Signed-off-by: Benjamin Drung <email address hidden>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/.gitignore b/.gitignore
2new file mode 100644
3index 0000000..42eda44
4--- /dev/null
5+++ b/.gitignore
6@@ -0,0 +1,2 @@
7+*~
8+.#*
9diff --git a/debian/.gitignore b/debian/.gitignore
10new file mode 100644
11index 0000000..bc79963
12--- /dev/null
13+++ b/debian/.gitignore
14@@ -0,0 +1,7 @@
15+/*.debhelper
16+/*.debhelper.log
17+/*.substvars
18+/.debhelper
19+/files
20+/initramfs-tools/
21+/initramfs-tools-core/
22diff --git a/hooks/fsck b/hooks/fsck
23index f6348e8..e0cfad0 100755
24--- a/hooks/fsck
25+++ b/hooks/fsck
26@@ -44,6 +44,10 @@ _read_fstab_entry () {
27 # Find a specific fstab entry and print its type (if found, and pass != 0)
28 # $1=mountpoint
29 get_fsck_type_fstab () {
30+<<<<<<< hooks/fsck
31+=======
32+ local device
33+>>>>>>> hooks/fsck
34 eval "$(_read_fstab_entry "$1")"
35
36 # Not found by default.
37@@ -51,9 +55,15 @@ get_fsck_type_fstab () {
38 # Ignore filesystem type for /, as it is not available and
39 # therefore never used at boot time
40 if [ "${MNT_DIR}" = "/" ] || [ "${MNT_TYPE}" = "auto" ]; then
41+<<<<<<< hooks/fsck
42 MNT_FSNAME="$(resolve_device "${MNT_FSNAME}")"
43 if ! get_fstype "${MNT_FSNAME}"; then
44 echo "W: Couldn't identify type of $2 file system for fsck hook" >&2
45+=======
46+ device="$(resolve_device "${MNT_FSNAME}")"
47+ if ! get_fstype "${device}"; then
48+ echo "W: Couldn't identify type of $2 file system '$MNT_FSNAME' for fsck hook" >&2
49+>>>>>>> hooks/fsck
50 fi
51 else
52 echo "${MNT_TYPE}"
53diff --git a/init b/init
54index e270969..22fcbe7 100755
55--- a/init
56+++ b/init
57@@ -167,10 +167,13 @@ for x in $(cat /proc/cmdline); do
58 ;;
59 resume=*)
60 RESUME="${x#resume=}"
61+<<<<<<< init
62 case $RESUME in
63 UUID=*)
64 RESUME="/dev/disk/by-uuid/${RESUME#UUID=}"
65 esac
66+=======
67+>>>>>>> init
68 ;;
69 resume_offset=*)
70 resume_offset="${x#resume_offset=}"
71@@ -247,6 +250,13 @@ fi
72 if [ -n "${noresume}" ] || [ "$RESUME" = none ]; then
73 noresume=y
74 else
75+<<<<<<< init
76+=======
77+ case $RESUME in
78+ UUID=*)
79+ RESUME="/dev/disk/by-uuid/${RESUME#UUID=}"
80+ esac
81+>>>>>>> init
82 resume=${RESUME:-}
83 fi
84
85diff --git a/scripts/local-premount/resume b/scripts/local-premount/resume
86index 6bd98e8..b7e975d 100755
87--- a/scripts/local-premount/resume
88+++ b/scripts/local-premount/resume
89@@ -65,7 +65,15 @@ case "${SWAPTYPE}" in
90 # that less likely.
91 sleep 0.1
92 fi
93+<<<<<<< scripts/local-premount/resume
94
95+=======
96+ ;;
97+esac
98+
99+case "${SWAPTYPE}" in
100+ swap|swsuspend|s1suspend|s2suspend|ulsuspend|tuxonice)
101+>>>>>>> scripts/local-premount/resume
102 echo "${MAJMIN}" > /sys/power/resume
103 ;;
104 esac

Subscribers

People subscribed via source and target branches