Discussion:
Bug#1088959: initramfs-tools: copy_exec copies file as symlink to the wrong binary instead
Add Reply
Marc Lehmann
2024-12-03 13:40:01 UTC
Reply
Permalink
Package: initramfs-tools
Version: 0.142+deb12u1
Severity: important

Dear Maintainer,

I have this line in one of my initramfs-hooks:

copy_exec /sbin/losetup /sbin/losetup.util-linux

Because I require the util-linux losetup. This worked fine until I
recently upgraded. After the upgrade and regenerating the initrd, the
system became unbootable, because the result was this, according to
lsinitramfs -l:

usr/sbin/losetup.util-linux -> losetup

i.e. instead of copying the file, it created a symlink to a completely
unrelated file, namely the losetup utility from busybox or klibc, which made the
system unbootable, and, of course, quite hard to recover from with the
limited utilities in the initramfs.

My /usr/sbin/losetup file (merged usr) is indeed the file form util-linux,
and not a symlink, which suggests that something is seriously broken
in the copy_exec function. To further verify this, I adde4d a ls -l
$DESTDIR/sbin/losetup.util-linux directly after the copy_exec, and indeed,
it was a symlink, so copy_exec is the culprit.

I removed most of the automatically-generated details in this report
because I wrote it on another system, but will supply any missing details
required to track this down.

busybox-static is installed, and initramfs-tools's BUSYBOX is set to "y".
Ben Hutchings
2025-03-02 14:30:01 UTC
Reply
Permalink
Control: tag -1 patch pending

This is fixed by
<https://salsa.debian.org/kernel-team/initramfs-tools/-/commit/d5c24307ad032932ccb42929ca739c9d76745be7>.

I will need to backport that to bookworm later.

Ben.
--
Ben Hutchings
Any smoothly functioning technology is indistinguishable
from a rigged demo.
Loading...