Repository navigation
Description
systemd version the issue has been seen with
systemd-255.4-1.fc40.x86_64
Used distribution
Fedora 40
Linux kernel version used
6.8.1-300.fc40.x86_64
CPU architectures issue was seen on
x86_64
Component
systemd-repart
Expected behaviour you didn't see
systemd-repart should detect the usr-verity partition and copy it to the destination.
Continuation from https://lists.freedesktop.org/archives/systemd-devel/2024-March/050152.html
Unexpected behaviour you saw
systemd-repart is unable to find the correct partition and fails with the message:
Unable to automatically discover suitable partition to copy blocks from.
Steps to reproduce the problem
Clone https://github.com/septatrix/systemd-issue and run the test script.
The test script also contains another workaround using VerityMatchKey= only copying the usr partition and creating the hash anew however this results in a different root hash without any obvious reason.
Additional program output to the terminal or log subsystem illustrating the issue
Failed to find TPM2 pcrlock policy file 'pcrlock.json': No such file or directory
Opened '/run/user/1000/tmp.w077B7QbJH/image-copy' in O_RDONLY access mode, with O_DIRECT enabled.
Determined sector size 512 based on discovered partition table.
loop0: Acquired exclusive lock.
Successfully acquired /dev/loop0, devno=7:0, nr=0, diskseq=352
Kernel was quicker than us in adding partition 1.
Opened /dev/loop0p1 (fd=3, whole_block_devnum=7:0, diskseq=352).
Kernel was quicker than us in adding partition 2.
Opened /dev/loop0p2 (fd=4, whole_block_devnum=7:0, diskseq=352).
Kernel was quicker than us in adding partition 3.
Opened /dev/loop0p3 (fd=7, whole_block_devnum=7:0, diskseq=352).
Probed fstype 'erofs' on partition /dev/loop0p2.
Mounting rootfs (tmpfs) on /run/systemd/mount-rootfs (MS_NODEV "")...
Mounting /proc/self/fd/4 (erofs) on /run/systemd/mount-rootfs/usr (MS_RDONLY|MS_NODEV "")...
Mounting /proc/self/fd/3 (vfat) on /run/systemd/mount-rootfs/efi (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_NOSYMFOLLOW "umask=0077")...
Sized 'a-copy' to 55.0M.
Not resizing partition table, as there currently is none.
Sector size of device is 512 bytes. Using grain size of 4096.
No machine ID set, using randomized partition UUIDs.
Automatically found partition 259:5 of right type 8484680c952148c69c11b0720656f69e.
Partition 259:5 has non-matching partition type 8484680c952148c69c11b0720656f69e (needed: 77ff5f63e7b64633acf41565b864c0e6), ignoring.
Unable to automatically discover suitable partition to copy blocks from.
Failed to umount /run/systemd/mount-rootfs, ignoring: Device or resource busy
Failed to umount /run/systemd/mount-rootfs, ignoring: Device or resource busy
Activity
septatrix commentedon Apr 5, 2024
I tried a workaround to create the partitions as empty partitions and then fill them using sd-sysupdate though that failed with the message
File system type not supported or not known.. The only method apart from manually fiddling with parted or a similar tool is to manually create definition files for repart:While this works it is very ugly and quite annoying to automate. Furthermore this requires me to create split artifacts of the image.
septatrix commentedon Apr 25, 2024
From the mailinglist:
@daandemeyer what exactly would those arguments be and can I log or compare them somehow?
septatrix commentedon Oct 17, 2024
Interestingly it turns out that the amount of data blocks differs...
septatrix commentedon Oct 17, 2024
One thing which I had to manually add was the
--seed, as sd-repart does not extract the seed from the previous verity partition which I guess makes sense but is definitely something one has to watch out for.daandemeyer commentedon Sep 24, 2025
I think this was fixed by #36631