Commit Graph

3978 Commits

Author SHA1 Message Date
Ngọc Quân Trần 8b8321ff1f Update Vietnamese translation 2021-07-14 01:33:20 +00:00
Daniel Șerbănescu db7cb61c7a Update Romanian translation 2021-07-13 16:19:08 +00:00
Daniel Mustieles 8a8be05442 Updated Spanish translation 2021-07-13 09:03:32 +02:00
Enrico Nicoletto 4f23b46873 Update Brazilian Portuguese translation 2021-07-12 20:33:03 +00:00
Baurzhan Muftakhidinov f6e59bb31f Update Kazakh translation 2021-07-12 16:50:36 +00:00
Mike Fleetwood 39e7156697 Copy XFS UUID when copying the file system (!85)
For the same reason as in the previous commit, the UUID is copied when
copying every file system type except for XFS, where a new XFS is
created with a new UUID.

Again preview of the copy operation expects the UUID to be copied.
(Look in Partition > Information of the source and pasted partitions
before the operation is applied).

Fix as before by specifying the desired file system UUID when creating
the new XFS as part of the copy operation.

However there is an extra complication.  The XFS kernel driver refuses
to mount a file system with a duplicate UUID of an already mounted XFS.

    # mkfs.xfs -L xfs_copy /dev/sdb1
    # mount /dev/sdb1 /mnt/1
    # tail -2 /var/log/messages
    Jun  3 21:41:24 localhost kernel: XFS (sdb1): Mounting V5 Filesystem
    Jun  3 21:41:24 localhost kernel: XFS (sdb1): Ending clean mount

    # /dev/sdb1: LABEL="xfs_copy" UUID="d654fc7f-e417-4ec6-88e8-8a7d0d46b7d8" TYPE="xfs"
    # mkfs.xfs -L xfs_copy -m uuid="d654fc7f-e417-4ec6-88e8-8a7d0d46b7d8" /dev/sdb2
    # mount /dev/sdb2 /mnt/2
    mount: wrong fs type, bad option, bad superblock on /dev/sdb2,
           missing codepage or helper program, or other error.

           In some cases useful info is found in syslog - try
           dmesg | tail or so.
    # echo $?
    32
    # tail -1 /var/log/messages
    Jun  3 21:41:31 localhost kernel: XFS (sdb2): File system has duplicate UUID d654fc7f-e417-4ec6-88e8-8a7d0d46b7d8 - can't mount

Handle this specifying the needed option [1] when mounting the second
XFS during the copy.

    # mount -o nouuid /dev/sdb2 /mnt/2
    # mount | grep /dev/sdb
    /dev/sdb1 on /mnt/1 type xfs (rw,relatime,seclabel,attr2,inode64,noquota)
    /dev/sdb1 on /mnt/1 type xfs (rw,relatime,seclabel,nouuid,attr2,inode64,noquota)

Duplicating the UUID may seem troublesome, but it is being done:
1.  To make the GParted copied XFS be as much a clone as possible, to
    match what is does with other file systems.
2.  It has a valid use case; of cloning a Linux installation to a new
    drive or restoring a partition image backup.  In these cases it is
    much simpler if the UUID of the copy remains the same because it
    avoids having to edit GRUB2 configuration and fstab file system
    mounting which is nearly always done via UUID.
3.  GParted has the new UUID operation, to change the UUID for cases
    when a copied file system needs to be mounted at the same time as
    the source.

[1] xfs(5) - xfs - layout, mount options, and supported file attributes
    for the XFS filesystem
    https://man7.org/linux/man-pages/man5/xfs.5.html
    "MOUNT OPTIONS
    ...
    nouuid Don't check for double mounted file systems using the file
           system uuid.
    "

Closes !85 - Make XFS copy duplicate the file system label and UUID
2021-06-06 18:52:13 +00:00
Mike Fleetwood 36e43ed7a7 Copy XFS label when copying the file system (!85)
As GParted performs block copy of partitions then the label, which is
stored in the file system superblock, is also copied.  This is true for
copies performed using the GParted internal block copy and for EXT2/3/4
and NTFS which are copied using the file system specific commands
e2image and ntfsclone respectively.  However when an XFS file system is
copied the label is not copied because a new file system is created
using mkfs.xfs and the files copied using xfsdump | xfsrestore.

Preview of the copy operation in GParted also reflects the fact that the
label will be copied.

Fix this by simply specifying the desired label when creating the new
destination XFS.

Closes !85 - Make XFS copy duplicate the file system label and UUID
2021-06-06 18:52:13 +00:00
Curtis Gedak 325c6eb247 Handle change in path for udisks2-inhibit executable (!84)
Debian (and derived) distros with the udisks2 [1] repository and the
additional 'udisks2-inhibit' executable had the location changed from:
    /usr/lib/udisks2/
to:
    /usr/libexec/udisks2/
with udisks2 version 2.8.4-2 and the following commit:

    f6744a33 - Move the daemons to /usr/libexec now that's allowed in the policy
    f6744a3364

Distros such as Fedora and openSUSE are unaffected as the udisks [2]
repository does not contain 'udisks2-inhibit'.

[1] udisks2 Debian (and derived) repository
    https://salsa.debian.org/utopia-team/udisks2

[2] udisks repository
    https://github.com/storaged-project/udisks

Closes !84 - Handle change in path for udisks2-inhibit executable
2021-05-31 16:47:32 +00:00
Andika Triwidada 665277c6ef Update Indonesian translation 2021-05-31 10:50:26 +00:00
Rafael Fontenelle 8d5cab86ab Update Brazilian Portuguese translation 2021-05-23 19:28:31 +00:00
Piotr Drąg b3ab7b8198 Update Polish translation 2021-05-23 13:12:58 +02:00
Mike Fleetwood f230ecc7a2 Fix recognition of SD/MMC device names (!83)
User reported that GParted didn't detect their eMMC drive [1].  Not
recognised device name was /dev/mmcblk0.  Confirmed that the regression
was introduced by this commit [2].  Fix the code and regular expression
used to recognise SD/MMC device names.

[1] GParted forum thread: eMMC drive not detected...?
    http://gparted-forum.surf4.info/viewtopic.php?id=17994

[2] 52930f30ae
    Refactor load_proc_partitions_info_cache() a bit (#131)

Closes !83 - Fix recognition of SD/MMC device names
2021-05-19 15:36:23 +00:00
Yuri Chornoivan 3b8ba168f9 Update Ukrainian translation 2021-05-19 05:45:05 +00:00
Anders Jonsson 7ca827fe64 Update Swedish translation 2021-05-18 20:13:18 +00:00
Curtis Gedak 26f4dc504a Replace deprecated gtk_show_uri() method for help window (!82)
The gtk_show_uri() [1] method was deprecated as of gtk3 version 3.22 and
has been replaced with gtk_show_uri_on_window [2].

[1] https://developer.gnome.org/gtk3/stable/gtk3-Filesystem-utilities.html#gtk-show-uri
[2] https://developer.gnome.org/gtk3/stable/gtk-migrating-2-to-3.html#id-1.6.3.3.7

Note that AppInfo::launch_uris() has been removed because with
glib/glibmm >= 2.58 AppInfo::launch_uris() always reports success even
when yelp is not launched and in such cases prevents the dialog
reporting the error from being displayed.

Closes !82 - Replace deprecated gtk_show_uri() method for help window
2021-05-17 20:24:54 +00:00
Seong-ho Cho f5b17f40fe Update Korean translation 2021-05-17 15:28:35 +00:00
Ask Hjorth Larsen 90c030771a Updated Danish translation 2021-05-11 19:33:40 +02:00
Hugo Carvalho 2d20196100 Update Portuguese translation 2021-05-04 18:04:05 +00:00
Curtis Gedak 1bd0fa656e Append -git to version for continuing development 2021-05-03 09:18:26 -06:00
Curtis Gedak 9523b54cd9 ========== gparted-1.3.0 ========== 2021-05-03 09:02:58 -06:00
Jiri Grönroos 6b5693847b Update Finnish translation 2021-05-01 12:08:31 +00:00
Piotr Drąg c5e7226d25 Update Polish translation 2021-05-01 13:37:39 +02:00
Ngọc Quân Trần 99d5933f6f Update Vietnamese translation 2021-04-27 01:42:36 +00:00
Fran Dieguez 55226bc4c8 Update Galician translation 2021-04-26 13:17:51 +00:00
Kukuh Syafaat cc9394e958 Update Indonesian translation 2021-04-26 11:24:23 +00:00
Fran Dieguez 9593417ab7 Update Galician translation 2021-04-26 11:12:11 +00:00
Hannie Dumoleyn 9cd17781d2 Update Dutch translation 2021-04-26 10:12:35 +00:00
Hannie Dumoleyn 26b78dfb23 Update Dutch translation 2021-04-26 10:07:20 +00:00
Daniel Mustieles 985968abac Updated Spanish translation 2021-04-26 07:46:39 +02:00
Daniel Mustieles 8730a5b7f7 Updated Spanish translation 2021-04-26 07:46:33 +02:00
Baurzhan Muftakhidinov 7c56d64d99 Update Kazakh translation 2021-04-26 03:56:47 +00:00
Claude Paroz 37b4aec3b1 Updated French translation 2021-04-25 21:35:07 +02:00
Rafael Fontenelle 9ca0467583 Update Brazilian Portuguese translation 2021-04-25 19:15:45 +00:00
Daniel Șerbănescu 9a63a62448 Update Romanian translation 2021-04-25 18:06:15 +00:00
Yuri Chornoivan 5c5f54b3f2 Update Ukrainian translation 2021-04-25 17:57:36 +00:00
Daniel Șerbănescu 53c77f08d5 Update Romanian translation 2021-04-25 17:54:07 +00:00
Anders Jonsson 188fc4f7b7 Update Swedish translation 2021-04-25 16:48:30 +00:00
Mike Fleetwood c4ca7d3e9b Mark remaining get_filesystem_*() methods as returning const strings 2021-04-25 15:49:35 +00:00
Mike Fleetwood 1c9ecc5dbd Comment differences between FileSystem::execute_command() methods 2021-04-25 15:49:35 +00:00
Mike Fleetwood 5752682c12 Report this LUKS passphrase request reason as resize (#59)
So far when prompting for the LUKS passphrase the dialog always looks
like this:

    +------------------------------------------------+
    |           LUKS Passphrase /dev/sdb1            |
    +------------------------------------------------+
    | Enter LUKS passphrase to open /dev/sdb1        |
    | Passphrase:    [                             ] |
    |                                                |
    |                                                |
    |                          [ Cancel ] [ Unlock ] |
    +------------------------------------------------+

Specifically the first line of the dialog says the reason to provide the
passphrase is to open the encryption mapping.  Now the passphrase may
also be requested when resizing the encryption mapping, as part of a
resize of check operation, show the appropriate reason in the password
dialog.

Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood 80624bfd40 Also prompt for LUKS password as required for check operation (#59)
A check operation involves (1) checking the file system, (2) growing the
encryption volume and (3) growing the file system.  Therefore prompt for
the LUKS passphrase as required when composing a check operation too.

Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood f3aec1f4b1 Pass LUKS password as needed when resizing open mapping (#59)
This is the final piece which enables GParted to pass the LUKS
passphrase when resizing an open LUKS encryption mapping when
'cryptsetup resize' will prompt for it.

Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood d7503fd5ed Add ability for small writes to stdin of operation tracked child processes (#59)
This is the equivalent to what was previously done when adding opening
of LUKS mappings.  Namely to add a way to pass the LUKS passphrase to
'cryptsetup luksOpen' via standard input.  Previously the functionality
was added to Utils::execute_command() [1].  Now it is also needed to
pass the LUKS passphrase to 'cryptsetup resize', which is executed as
part of applying resize and check operations to an encrypted file
system.  So add this functionality to FileSystem::execute_command().

For now writing to stdin is only needed for the one variant of
FileSystem::execute_command() which doesn't have progress tracking
callbacks.  Writing to stdin can easily be added to the other progress
tracking callback variants of execute_command() when needed.

[1] 8dff80edc6
    Add ability for small writes to stdin of child processes (#795617)

Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood 2ccbc3ec92 Extract common code into generate_encryption_mapping_name() (#59)
Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood 83abcd8873 Ask for LUKS passphrase for resize operation as required (#59)
When composing a resize operation on an open encryption mapping, use the
existing LUKS password dialog to prompt for the passphrase, if and only
if 'cryptsetup resize' will prompt and GParted doesn't already have a
password.  'cryptsetup resize' will prompt for a LUKS passphrase when
the passphrase was stored in the kernel keyring service,
key_loc == KEYLOC_KeyRing.  See the previous commit "Capture LUKS
mapping master encryption key location (#59)" for more details.

As commented in the code GParted specifically doesn't support the case
where the LUKS passphrase is changed while GParted is running and it
knew the old passphrase.  When resizing an open encryption mapping
GParted will just pass the old out of date passphrase it knows and the
resize will fail like this:

    # cryptsetup status sdb2_crypt | egrep 'type|key location'
      type:         LUKS2
      key location: keyring
    # dmsetup table --target crypt
    sdb2_crypt: 0 491520 crypt aes-xts-plain64 :64:logon:cryptsetup:3d040240-97ba-4559-af98-72c3be500498-d0 0 8:18 32768

    # echo -n oldpassword | cryptsetup -v --size 491520 resize sdb2_crypt
    No key available with this passphrase.
    Command failed with code -2 (no permission or bad passphrase).
    # echo $?
    2

To work around this either close and restart GParted or close and reopen
the encryption mapping.  The former because GParted doesn't save
passwords across a restart so will prompt and the latter because GParted
will use the wrong old passphrase to try to open the mapping and then
prompt for the correct passphrase until successfully opened.

Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood 099b85fe18 Capture LUKS mapping master encryption key location (#59)
ISSUE OVERVIEW

When GParted tries to resize an open LUKS encryption mapping and the
volume (master) key was stored in the kernel keyring service [1] it
fails like this:

    Check and repair file system ([Encrypted] ext4) on /dev/...(ERROR)
    + calibrate /dev/sdd1                                      (SUCCESS)
    + check file system on /dev/mapper/sdd1_crypt for errors...(SUCCESS)
    + grow encryption volume to fill the partition             (ERROR)
      + cryptsetup -v resize 'sdd1_crypt'                      (ERROR)
          Command failed with code -1 (wrong or missing parameters).
          Nothing to read on input.

This error occurs with cryptsetup >= 2.0, kernel >= 4.10 and LUKS2
format because the crypt Device-Mapper target no longer has the volume
key so cryptsetup resize prompts for a passphrase, but GParted doesn't
provide it.

THIS COMMIT

Additionally capture the location of the volume (master) key location
for active encryption mappings.  Do this the using the same method that
cryptsetup uses [2][3].  Namely if the first character of the KEY is a
":" then the key *was* stored in the kernel keyring service, otherwise
it *is* store in the Device-Mapper crypt target as previously.

    # echo -n badpassword | cryptsetup luksFormat --type luks1 /dev/sdb1 -
    # echo -n badpassword | cryptsetup luksOpen /dev/sdb1 sdb1_crypt
    # cryptsetup status sdb1_crypt | egrep 'type|key location'
      type:         LUKS1
      key location: dm-crypt

    # echo -n badpassword | cryptsetup luksFormat --type luks2 /dev/sdb2 -
    # echo -n badpassword | cryptsetup luksOpen /dev/sdb2 sdb2_crypt
    # cryptsetup status sdb2_crypt | egrep 'type|key location'
      type:         LUKS2
      key location: keyring

    # dmsetup table --target crypt
    sdb1_crypt: 0 520192 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 0 8:17 4096
    sdb2_crypt: 0 491520 crypt aes-xts-plain64 :64:logon:cryptsetup:3d040240-97ba-4559-af98-72c3be500498-d0 0 8:18 32768
                                               ^
First character of the KEY field --------------'

[1] Integration with the kernel keyring service
    https://gitlab.com/cryptsetup/cryptsetup/blob/v2.0.0/docs/Keyring.txt
    "
    Starting with cryptsetup 2.0 we load [Volume Key] VK in kernel
    keyring by default for LUKSv2 devices ...

    In summary, the key description visible in dm-crypt table line is a
    reference to VK that usually no longer exists in kernel keyring
    service if you used cryptsetup to for device activation.
    "

[2] cryptsetup/v2.3.5/lib/libdevmapper.c:_dm_target_query_crypt()
    https://gitlab.com/cryptsetup/cryptsetup/-/blob/v2.3.5/lib/libdevmapper.c#L2031
        if (key_[0] == ':')
            *act_flags |= CRYPT_ACTIVATE_KEYRING_KEY;

[3] cryptsetup/v2.3.5/src/cryptsetup.c:action_status()
    https://gitlab.com/cryptsetup/cryptsetup/-/blob/v2.3.5/src/cryptsetup.c#L839
        log_std("  key location: %s\n", (cad.flags & CRYPT_ACTIVATE_KEYRING_KEY) ? "keyring" : "dm-crypt");

Closes #59 - Resize of LUKS2 encrypted file system fails with "Nothing
             to read on input"
2021-04-25 15:49:35 +00:00
Mike Fleetwood 1f65b2547a Ignore libparted unrecognised disk label message from encryption mappings (#152)
When GParted probes an open encryption mapping which is either blank or
contains a file system which libparted doesn't recognise, such as:
exfat, f2fs, lvm2 pv, minix or reiser4, then the partition also gets
this warning message:
    /dev/mapper/sdb11_crypt: unrecognised disk label

Clear the message so that it isn't shown in the GUI.

Note that the message is still written to stderr by GParted, like all
libparted exceptions are.  This is done by GParted's libparted exception
handler:
    GParted_Core::ped_exception_handler()
      _ped_exception_handler()

Closes #152 - GParted crashed when trying to probe an encrypted
              partition containing content that libparted doesn't
              recognise
2021-04-15 16:33:01 +00:00
Mike Fleetwood c830c6770d Reorder cases in set_device_and_disk() and use if fail return early (#152)
The previous commit "Resolve empty drive displayed as blank minor logic
issue (#152)" left the code in set_device_and_disk() some what
unsightly.

Refactor the whole function.  Use if fail return early pattern for
failure of the get_device() call at the start of the function.  Reorder
the 4 cases into a single depth if then else if chain.  Hopefully this
is a little easier to follow.

Closes #152 - GParted crashed when trying to probe an encrypted
              partition containing content that libparted doesn't
              recognise
2021-04-15 16:33:01 +00:00
Mike Fleetwood b3ff339ac7 Resolve empty drive displayed as blank minor logic issue (#152)
The previous commit "Remove coding landmine in get_disk() (#152)" made
an empty drive without a disk label (partition table) display as
nothing, instead of the normal single unallocated partition with warning
"unrecognised disk label".

The previous commit said:
    3. The two remaining direct calls to get_disk() where the strict
       parameter is explicitly set to false, from set_device_from_disk()
       and detect_filesystem_in_encryption_mapping(), are when scanning.
       As the pass strict=false they don't allow the PedDevice deletion
       to occur if no recognised disk label is found.

This is true, but get_disk(..., strict=false) additionally returned true
even if there was no disk label.  And in set_device_from_disk() the
empty drive case is inside the if branch of the get_disk() call
returning true.

Simply fix this by calling get_disk(), ignoring the return value.

Closes #152 - GParted crashed when trying to probe an encrypted
              partition containing content that libparted doesn't
              recognise
2021-04-15 16:33:01 +00:00
Mike Fleetwood c4ef43aa5d Remove coding landmine in get_disk() (#152)
get_disk() is the wrapper around libparted's ped_disk_new() which reads
a disk label from the specified device and if successful creates the in
memory PedDisk object to represent it.  In the case that libparted
doesn't recognise a disk label or a file system, having get_disk() go
and destroy the passed in PedDevice object via parameter lp_device is
very unexpected behaviour hence describing it as a coding landmine.

BACKGROUND

1. Early on GParted only worked with devices with valid disk labels.
   FileSystem.h:open_device_and_disk() required both ped_device_get()
   and ped_disk_new() to succeed or neither to succeed.
2. Commit [1] added support for devices which didn't yet have a disk
   label.  open_device_and_disk() had default parameter strict=true
   added.  While scanning strict=false was passed which allowed
   open_device_and_disk() to return success if only ped_device_get()
   succeeded and ped_disk_new() failed when the disk was empty.  All
   other times open_device_and_disk() was called with default
   strict=true, still requiring both or neither to succeed.
3. Commit [2] added support for whole disk file systems.  The now named
   get_device_and_disk() had it's functionality split between
   get_device() and get_disk().  This result in the code landmine being
   left behind: get_disk() destroying the passed device object if
   default parameter strict=true and no disk label or file system was
   detected.

ANALYSIS

1. Since support for whole disk file systems [2] all current calls to
   get_device_and_disk() let the strict parameter default to true and
   are only called on known partitions within disk labels when applying
   a change to that partition.  Therefore they don't care about the
   behaviour of get_disk(), just that get_device_and_disk() maintains
   that both ped_device_get() and ped_disk_new() succeed or neither
   succeed.
2. Two direct calls to get_disk() where the strict parameter defaults to
   true, from calibrate_partition() and erase_filesystem_signatures(),
   only do so on known partitions within disk labels as part of applying
   a change to that partition.  Therefore ped_disk_new() will succeed
   and so PedDevice isn't deleted when not wanted.
3. The two remaining direct calls to get_disk() where the strict
   parameter is explicitly set to false, from set_device_from_disk() and
   detect_filesystem_in_encryption_mapping(), are when scanning.  As the
   pass strict=false they don't allow the PedDevice deletion to occur if
   no recognised disk label is found.

FIX

Remove the strict parameter from get_disk() and get_device_and_disk() as
it's no longer needed.  Remove the code landmine by removing the side
affect of destroying the PedDevice object if a disk label isn't found.
Make sure get_device_and_disk() maintains the all or nothing behaviour.

Also don't pass lp_device by reference to a pointer to get_disk() so the
code can't change where lp_device points.

[1] 038c5c5d99
    P (special thanks to mantiena-baltix for bringing this issue to my

[2] 51ac4d5648
    Split get_device_and_disk() into two (#743181)

Closes #152 - GParted crashed when trying to probe an encrypted
              partition containing content that libparted doesn't
              recognise
2021-04-15 16:33:01 +00:00