GParted fails to shrink an LVM PV with lvm2 >= 2.02.171

Bug #1779292 reported by Mike Fleetwood
20
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gparted (Ubuntu)
Fix Released
High
Phillip Susi
Bionic
Fix Released
High
Thomas Ward

Bug Description

[Impact]

GParted in Bionic uses LVM2 versions >= 2.02.172. Because of this higher LVM version, the confirmation prompt added to the pvresize system makes all LVM2 resize operations involving shrinking (and possibly expanding) LVM Physical Volumes fail because of unexpected output.

As such, gparted on Bionic cannot be used to resize LVM physical partitions.

This was fixed by syncing a newer version from Debian in Cosmic series, however still impacts the Bionic series. If we intend to have Bionic as an LTS (as we do), then we need to patch this.

[Test Case]

(0) Prerequisites: A drive with an LVM2 partition on it for the PV, and a VG with LVs within that do NOT take up the entirety of the LVM2 partition (so for a 100GB LVM PV, consume anything less than that so we can resize the PV; you may resize LVs for this if you need to).

With existing software versions:

(1) Boot up a LiveCD/LiveUSB, open `gparted` on it.

(2) Attempt to resize with current gparted on the repos / image.

Current Result: ERROR due to unexpected message.

With patched version:

(1) Boot up LiveCD/LiveUSB

(2) Install PPA version of `gparted` (or from -proposed if this has landed in proposed for verification)

(3) Attempt to shrink PV to make some free space (provided that step 0 is met).

Expected Result: SUCCESS

[Regression Potential]

Messing with gparted could lead to other problems, This is always a risk. The potential for regression on this is low, however, provided that the patch is applied carefully.

The patch literally only changes the the arguments passed to pvresize of --yes to 'confirm' that we want to do the changes. This change is already applied in upstream versions later than that in Bionic, therefore the regression risk of this is low.

[Other Info]

This was test-built and *actively tested* in a PPA with the upstream patch (or rather, the patch listed in this bug initially). I (Thomas Ward, who applied the SRU template here) got the upstream patch for the debdiff from upstream's master repository for the patch included in the debdiff. (https://gitlab.gnome.org/GNOME/gparted/commit/5892b72890748c1d3e96bd7e25800c8aab351025)

Note that the PPA was tested from a LiveUSB of 18.04.1(.0) and was used on a production system to resize the PV of my 18.04 laptop so I could put a new partition with Clonezilla Live-HDD version on it. It works if you wish to test it, even though it uses the patch originally attached and not a patch pulled directly from upstream's master branches/repos.

[Original Bug Description]

== GParted fails to shrink the LVM2 PV reporting this

# lvm pvresize -v --setphysicalvolumesize 786432K '/dev/sda9'
0 physical volume(s) resized / 1 physical volume(s) not resized

Wiping internal VG cache
Wiping cache of LVM-capable devices
/dev/sda9: Requested size 712.00 MiB is less than real size 1.00 GiB. Proceed? [y/n]:[n]
Physical Volume /dev/sda9 not resized.

== Confirmed on Ubuntu 18.04 LTS with these packages

$ dpkg -l lvm2 gparted
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-=====================-===============-===============-================================================
ii gparted 0.30.0-3ubuntu1 amd64 GNOME partition editor
ii lvm2 2.02.176-4.1ubu amd64 Linux Logical Volume Manager

== Relevant bug references

Issue #1 - Can't shrink LVM partition due to pvresize prompt
https://gitlab.gnome.org/GNOME/gparted/issues/1

Bug 1460577 - regression: lvm2 pvresize command suddenly became interactive, breaking automated usage
https://bugzilla.redhat.com/show_bug.cgi?id=1460577

== Attached patch

Attached is the upstream patch to workaround the change in pvresize.
Patch applies to gparted >= 0.14.0.

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: gparted 0.30.0-3ubuntu1
ProcVersionSignature: Ubuntu 4.15.0-23.25-generic 4.15.18
Uname: Linux 4.15.0-23-generic x86_64
ApportVersion: 2.20.9-0ubuntu7.2
Architecture: amd64
CurrentDesktop: XFCE
Date: Fri Jun 29 10:35:14 2018
InstallationDate: Installed on 2018-03-12 (108 days ago)
InstallationMedia: Xubuntu 18.04 LTS "Bionic Beaver" - Alpha amd64 (20180306.1)
SourcePackage: gparted
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Mike Fleetwood (mfleetwo) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Fix LVM2 PV shrinking with lvm2 2.02.171 and later" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Phillip Susi (psusi)
Changed in gparted (Ubuntu):
status: New → Triaged
importance: Undecided → High
assignee: nobody → Phillip Susi (psusi)
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gparted - 0.32.0-1ubuntu1

---------------
gparted (0.32.0-1ubuntu1) cosmic; urgency=medium

  * Sync with Debian. Remaining change:
    - Don't set --enable-xhost-root (LP: #1737248) (Closes: #883812)

gparted (0.32.0-1) unstable; urgency=medium

  * New upstream release (Closes: #902681, #649213, #653454) (LP: #1779292)
  * Change build dep from libparted0-dev to libparted-dev (Closes: #878629)
  * Drop build dep on rarian-compat (Closes: #885651)
  * Drop --enable-online-resize as it is enabled by default
  * Merge misc minor packaging changes from Jeremy Bicha (Closes: #883901)
  * Recommend e2fsprogs (Closes: #887225)

 -- Jeremy Bicha <email address hidden> Thu, 23 Aug 2018 19:11:07 -0400

Changed in gparted (Ubuntu):
status: Triaged → Fix Released
Jeremy Bícha (jbicha)
Changed in gparted (Ubuntu Bionic):
status: New → Triaged
importance: Undecided → High
Revision history for this message
Thomas Ward (teward) wrote :

Bionic debdiff attached

description: updated
description: updated
Jeremy Bícha (jbicha)
Changed in gparted (Ubuntu Bionic):
status: Triaged → In Progress
assignee: nobody → Thomas Ward (teward)
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Mike, or anyone else affected,

Accepted gparted into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/gparted/0.30.0-3ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in gparted (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Thomas Ward (teward) wrote :

Hi, Brian and all affected.

Confirmed this works with the test cases I wrote as well as in the cloned copy of my hard drive externally on another system - this worked perfectly and allows us to now shrink LVM PVs.

Marking as verification-done and verification-done-bionic.

tags: added: verification-done verification-done-bionic
removed: verification-needed verification-needed-bionic
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gparted - 0.30.0-3ubuntu2

---------------
gparted (0.30.0-3ubuntu2) bionic; urgency=medium

  * d/patches/lvm2_prompt_patch.patch: Apply upstream patch to fix pvresize
    compatibility with LVM2 >= 2.02.171, which broke LVM PV resizing due to
    the addition of a confirmation dialogue for the resize. (LP: #1779292)

 -- Thomas Ward <email address hidden> Thu, 27 Dec 2018 16:06:14 -0500

Changed in gparted (Ubuntu Bionic):
status: Fix Committed → Fix Released
Revision history for this message
Chris Halse Rogers (raof) wrote : Update Released

The verification of the Stable Release Update for gparted has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.