Partitioning on boot sometimes aborts because of partprobe failing
We received a WB report (da054cb0246450ddda6657a8a9999d70) about a failure on second boot.
Apprently due to the execution of partprobe from init-premount script.
Only probe for partitions on the boot device.
Without arguments partprobe will scan all devices, and if it
encounters a device it doesn't support (e.g. fake raid-0 arrays) it
will return non-zero, thus aborting Tails' partitioning script,
resulting in an unbootable install.
So, the bug report is about a USB image booted on a non-UEFI computer, where the partitioning script fails at the partprobe command and thus doesn't execute the sgdisk command which sets legacy BIOS bootable.
The error message of the partprobe command is "Error: Can't have a partition outside the disk!". I didn't yet look into what could have caused this error.
I think that this could be the cause of some of the issues reported on #16389.
I started investigating what the cause for "Can't have a partition outside the disk" could be.
partprobe fails with this error if
(part->geom.end >= disk->dev->length). So I see these possible causes:
- We use a too big partition size in the sgdisk command to create the partition.
- partprobe gets an incorrect partition geometry, which has a too big
- partprobe compares with a different device size (
disk->dev->length) than what we used to calculate the partition size for the sgdisk command.
Just saw #16389#note-71. I assume that the user reporting this same issue on XMPP is the same user who sent the bug report, because they describe exactly the same issue and both already did some investigation on their own.
anonym found out that the partprobe error was caused by a fake raid array and is unrelated to the partition we create. Therefore I will now stop investigating and prepare the fix anonym suggested.
anonym already pushed a commit to bugfix/16389-explicit-partprobe.
I don't see how this issue could be solved by
sgdisk --recompute-chs, which did fix the second boot issue for at least one user. So I don't want to hijack #16389 for this and will restore the old feature branch there and use the partprobe related branch here.