tails-persistence-setup/parted can't create a persistent partition (constraints)
Originally created by @CyrilBrulebois on #16304 (Redmine)
Steps to reproduce:
- build from
feature/buster
branch - copy the resulting IMG file into
a.img
and extend it with:truncate -s 8G a.img
- try to run
tails-persistence-setup
, entering a passphrase and hitting the “Create” button, which should create a 6.3 GB partition after the 1.7 GB ESP.
The “Persistence wizard - Persistence volume creation” returns this failure:
org.freedesktop.UDisks2.Error.Failed: Error creating partition on /dev/sda: Failed add partition to device '/dev/sda' (Unable to satisfy all constraints on the partition.)
Likely call trace (not all calls were traced exactly, but the presence
of various error messages seems to suggest this is the idea anyway):
persistence-setup → perl5lib → udisks2
(udisks_linux_partition_table_handle_create_partition
) → libblockdev
(bd_part_create_part
) → parted (gpt_partition_align
)
This is in udisks2 (src/udiskslinuxpartitiontable.c
):
part_spec = bd_part_create_part (device_name, part_type, offset,
size, BD_PART_ALIGN_OPTIMAL, &error);
if (!part_spec)
{
g_dbus_method_invocation_return_error (invocation,
UDISKS_ERROR,
UDISKS_ERROR_FAILED,
"Error creating partition on %s: %s",
udisks_block_get_device (block),
error->message);
udisks_simple_job_complete (UDISKS_SIMPLE_JOB (job), FALSE, error->message);
goto out;
}
This is in parted (libparted/labels/gpt.c
):
static int
gpt_partition_align (PedPartition *part, const PedConstraint *constraint)
{
PED_ASSERT (part != NULL);
if (_ped_partition_attempt_align (part, constraint,
_non_metadata_constraint (part->disk)))
return 1;
#ifndef DISCOVER_ONLY
ped_exception_throw (PED_EXCEPTION_ERROR,
PED_EXCEPTION_CANCEL,
_("Unable to satisfy all constraints on the partition."));
#endif
return 0;
}
(Other occurrences of this error message exist, but for different
partition types, and we’re definitely using gpt
.)
Trying with the parted
command line, with extra lines/characters for
emphasis:
root@amnesia:~# parted /dev/sda
GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
,----------
| (parted) p
| Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the
| space (an extra 13254656 blocks) or continue with the current setting?
| Fix/Ignore? f
`----------
Model: QEMU QEMU HARDDISK (scsi)
Disk /dev/sda: 8590MB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 1804MB 1802MB fat32 Tails boot, hidden, legacy_boot, esp
(parted) q
Once that’s been done, tails-persistence-setup
doesn’t fail any more
(until one reaches #16303 (closed), of course).
For completeness, here’s a full log when running from a terminal, with
an extra $ENV{DEBUG} = 1;
hardcoded in the tails-persistence-setup
Perl
script:
(tails-persistence-setup:9168): dbind-WARNING **: 00:22:07.182: Couldn't register with accessibility bus: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
Entering Tails::Persistence::Setup::run
Entering underlying_block_device
Leaving underlying_block_device, returning: /org/freedesktop/UDisks2/block_devices/sda1
Entering get_udisks_property: Partition, /org/freedesktop/UDisks2/block_devices/sda1, Table
boot device: /org/freedesktop/UDisks2/block_devices/sda
Entering get_udisks_property: Block, /org/freedesktop/UDisks2/block_devices/sda, PreferredDevice
Working on device /dev/sda
Entering device_has_persistent_volume
Entering device_partition_with_label /org/freedesktop/UDisks2/block_devices/sda, TailsData
Entering get_udisks_property: Partition, /org/freedesktop/UDisks2/block_devices/sda1, Name
Entering underlying_drive
Entering underlying_block_device
Leaving underlying_block_device, returning: /org/freedesktop/UDisks2/block_devices/sda1
block: /org/freedesktop/UDisks2/block_devices/sda1
Entering get_udisks_property: Block, /org/freedesktop/UDisks2/block_devices/sda1, Drive
drive: /org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_1_0000_3a00_3a04_2e7_1
boot drive: /org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_1_0000_3a00_3a04_2e7_1
Entering drive_is_connected_via_a_supported_interface, /org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_1_0000_3a00_3a04_2e7_1
Entering get_udisks_property: Drive, /org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_1_0000_3a00_3a04_2e7_1, ConnectionBus
Entering get_udisks_property: Drive, /org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_1_0000_3a00_3a04_2e7_1, Optical
Entering device_installed_with_tails_installer: /org/freedesktop/UDisks2/block_devices/sda
Entering get_udisks_property: PartitionTable, /org/freedesktop/UDisks2/block_devices/sda, Type
Entering device_partition_with_label /org/freedesktop/UDisks2/block_devices/sda, Tails
Entering get_udisks_property: Partition, /org/freedesktop/UDisks2/block_devices/sda1, Name
Entering device_has_persistent_volume
Entering device_partition_with_label /org/freedesktop/UDisks2/block_devices/sda, TailsData
Entering get_udisks_property: Partition, /org/freedesktop/UDisks2/block_devices/sda1, Name
Entering get_udisks_property: Block, /org/freedesktop/UDisks2/block_devices/sda, Size
Entering get_udisks_property: Partition, /org/freedesktop/UDisks2/block_devices/sda1, Offset
Entering get_udisks_property: Partition, /org/freedesktop/UDisks2/block_devices/sda1, Size
Entering get_udisks_property: Drive, /org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_1_0000_3a00_3a04_2e7_1, Vendor
Entering get_udisks_property: Drive, /org/freedesktop/UDisks2/drives/QEMU_QEMU_HARDDISK_1_0000_3a00_3a04_2e7_1, Model
Running step bootstrap
GLib-LOG **: posix_spawn avoided (fd close requested) at /usr/lib/x86_64-linux-gnu/perl5/5.28/Glib/Object/Introspection.pm line 67.
Entering main Gtk3 loop.
Entering create_persistence_partition
Creating partition of size 6.32GiB at offset 1803550720 on device /dev/sda
waiting...
Entering create_persistent_encrypted_filesystem
Entering Bootstrap::operation_finished
org.freedesktop.UDisks2.Error.Failed: Error creating partition on /dev/sda: Failed add partition to device '/dev/sda' (Unable to satisfy all constraints on the partition.)