File: fix-crypt-honor-timeout-setting-when-using-UUID-LABEL-etc.patch

package info (click to toggle)
dracut 110-5
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,720 kB
  • sloc: sh: 24,899; ansic: 5,236; makefile: 346; perl: 186; python: 48; javascript: 19
file content (50 lines) | stat: -rw-r--r-- 2,916 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From: Benjamin Drung <benjamin.drung@canonical.com>
Date: Fri, 13 Mar 2026 14:45:50 +0100
Subject: fix(crypt): honor timeout setting when using UUID, LABEL, etc

Test 20 fails on slow architectures, because it runs into a timeout:

```
[ TIME ] Timed out waiting for device dev-disk-by\x2duuid-1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device - /dev/disk/by-uuid/1dc514cd-8268-4a33-873f-84f8eb02d3e0.
[DEPEND] Dependency failed for systemd-cryptsetup@testluks.service - Cryptography Setup for testluks.
[DEPEND] Dependency failed for cryptsetup.target - Local Encrypted Volumes.
[  118.452336] systemd[1]: dev-disk-by\x2duuid-1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device: Job dev-disk-by\x2duuid-1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device/start timed out.
[  118.465917] systemd[1]: Timed out waiting for device dev-disk-by\x2duuid-1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device - /dev/disk/by-uuid/1dc514cd-8268-4a33-873f-84f8eb02d3e0.
[  118.483854] systemd[1]: Dependency failed for systemd-cryptsetup@testluks.service - Cryptography Setup for testluks.
[  118.500894] systemd[1]: Dependency failed for cryptsetup.target - Local Encrypted Volumes.
[  118.519552] systemd[1]: cryptsetup.target: Job cryptsetup.target/start failed with result 'dependency'.
[  118.535383] systemd[1]: systemd-cryptsetup@testluks.service: Job systemd-cryptsetup@testluks.service/start failed with result 'dependency'.
[  118.549404] systemd[1]: dev-disk-by\x2duuid-1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device: Job dev-disk-by\x2duuid-1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device/start failed with result 'timeout'.
```

`parse-crypt.sh` is supposed to set the timeout for this device
(defaulting to `infinity`), but it uses the wrong unit name in case the
source device in `/etc/crypttab` uses `UUID`, `PARTLABEL`, `LABEL`, or
`PARTUUID`. For example: it converts
`UUID=1dc514cd-8268-4a33-873f-84f8eb02d3e0` to
`UUID\x3d1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device`
instead of
`dev-disk-by\x2duuid-1dc514cd\x2d8268\x2d4a33\x2d873f\x2d84f8eb02d3e0.device`.

Use `label_uuid_to_dev` to map the source device from `/etc/crypttab` to
a device path.

Forwarded: https://github.com/dracut-ng/dracut-ng/pull/2300
---
 modules.d/70crypt/parse-crypt.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules.d/70crypt/parse-crypt.sh b/modules.d/70crypt/parse-crypt.sh
index 8f28f8a..e3404c3 100755
--- a/modules.d/70crypt/parse-crypt.sh
+++ b/modules.d/70crypt/parse-crypt.sh
@@ -37,7 +37,8 @@ else
     tout=$(getarg rd.luks.key.tout)
 
     if [ -e /etc/crypttab ]; then
-        while read -r _ _dev _ || [ -n "$_dev" ]; do
+        while read -r _ _source_device _ || [ -n "$_source_device" ]; do
+            _dev=$(label_uuid_to_dev "$_source_device")
             set_systemd_timeout_for_dev "$_dev"
         done < /etc/crypttab
     fi