]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(lsinitrd): resolve initrd to real path
authorBenjamin Drung <benjamin.drung@canonical.com>
Tue, 8 Jul 2025 15:58:18 +0000 (17:58 +0200)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Wed, 9 Jul 2025 04:35:59 +0000 (00:35 -0400)
`lsinitrd /boot/initrd.img` fails in case the initrd is zstd compressed:

```
$ dracut --zstd --no-early-microcode --force
$ 3cpio --examine /boot/initrd.img
0 zstd
$ lsinitrd /boot/initrd.img
Image: /boot/initrd.img: 0
========================================================================
Warning : /boot/initrd.img is a symbolic link, ignoring
Version:

Arguments:
dracut modules:
Warning : /boot/initrd.img is a symbolic link, ignoring
Warning : /boot/initrd.img is a symbolic link, ignoring
========================================================================
========================================================================
cpio: premature end of archive

dracut cmdline:
Warning : /boot/initrd.img is a symbolic link, ignoring
```

The `CAT` variable is `zstd -d -c`. The zstd man page says about the
`--force` parameter: "disable input and output checks. Allows [...]
operating on links". So this zstd behavior is intentional.

Resolve the initrd path to the real path. Then `lsinitrd` prints the
correct content and image size:

```
$ lsinitrd /boot/initrd.img
Image: /boot/initrd.img-6.14.0-23-generic: 15M
[...]
```

Bug-Ubuntu: https://launchpad.net/bugs/2116183

lsinitrd.sh

index ea26a260d5905aa6ec87cd1b408d34988f741283..688d659e96c21648e70c172e4424d219df3c01af 100755 (executable)
@@ -173,6 +173,7 @@ if ! [[ -f $image ]]; then
     usage
     exit 1
 fi
+image=$(realpath "$image")
 
 TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
 # shellcheck disable=SC2064