Project

General

Profile

Bug #16304

tails-persistence-setup/parted can't create a persistent partition (constraints)

Added by CyrilBrulebois 3 months ago. Updated 3 months ago.

Status:
Rejected
Priority:
Elevated
Assignee:
-
Category:
-
Target version:
Start date:
01/06/2019
Due date:
% Done:

0%

QA Check:
Feature Branch:
Type of work:
Code
Blueprint:
Starter:
Affected tool:

Description

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, 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.)

History

#1 Updated by CyrilBrulebois 3 months ago

It might just be a matter of catching up with the USB image integration branch. Using my latest iteration of test/16003-growing-system-partition I'm getting this:

Failing Scenarios:
cucumber features/usb_install.feature:130 # Scenario: The system partition is updated when booting from a USB drive where a Tails USB image was copied

1 scenario (1 failed)
11 steps (1 failed, 3 skipped, 7 passed)
11m4.828s

due to:

    And the FAT filesystem on the system partition on "usbimage" is at least 4000M large                     # features/step_definitions/usb.rb:838
      FAT partition is too small: 1802485248 is less than 4194304000.
      <false> is not true. (Test::Unit::AssertionFailedError)
      ./features/step_definitions/usb.rb:849:in `/^the FAT filesystem on the system partition on "([^"]+)" is at least (\d+)(.+) large$/'
      features/usb_install.feature:138:in `And the FAT filesystem on the system partition on "usbimage" is at least 4000M large'

(Which matches my initial observation: 1.7 GB partition.)

Hopefully the resize will be done correctly and parted will be happier?

#2 Updated by intrigeri 3 months ago

  • Assignee set to CyrilBrulebois
  • QA Check set to Info Needed
  • build from feature/buster branch
  • copy the resulting IMG file into a.img and extend it with: truncate -s 8G a.img

That's not supported yet. It will be once 3.12 the USB image integration branch is merged. Until then, feature/buster lacks the code to resize the system partition.

Can you reproduce this in a case that's supported, i.e. with a USB drive created by Tails Installer?

#3 Updated by CyrilBrulebois 3 months ago

Right, it seems various things going on at the same time got me confused: I was doing the IMG→8G dance plus addition to libvirt as USB+removable (for USB image test suite development), at the same time a coworker was learning how to do the addition to libvirt as USB+removable bit only (for buster). This led to the later confusion that this IMG→8G dance was supposed to be supported in buster, when I was trying to debug another issue (#16303) outside the test suite.

Sorry about the confusion, will retry with a proper setup (probably after preparing a workaround for #16303, which is actually hit by the test suite).

#4 Updated by intrigeri 3 months ago

  • Status changed from New to Rejected
  • Assignee deleted (CyrilBrulebois)
  • QA Check deleted (Info Needed)

Given you've filed tickets about problems that occur after the persistent volume was created, I'll assume this ticket was 100% about the misunderstanding we've cleared above => closing.

#16302 and the beta + RC testing will tell us if there's a problem with the USB image.

Also available in: Atom PDF