RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1475018 - Downgrading LVM2 from 7.4 to 7.3 causes "Invalid units specification" in every command
Summary: Downgrading LVM2 from 7.4 to 7.3 causes "Invalid units specification" in ever...
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: lvm2
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: LVM and device-mapper development team
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
: 1478226 (view as bug list)
Depends On: 1452932
Blocks: TRACKER-bugs-affecting-libguestfs
TreeView+ depends on / blocked
 
Reported: 2017-07-25 20:59 UTC by Richard W.M. Jones
Modified: 2021-09-03 12:39 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1452932
Environment:
Last Closed: 2017-08-05 13:53:45 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Richard W.M. Jones 2017-07-25 20:59:45 UTC
+++ This bug was initially created as a clone of Bug #1452932 +++

Description of problem:

This issue affects libguestfs in RHEL 7.4.

If you use the configuration file from lvm2 >= 2.02.171 with any earlier
lvm2, all lvm utilities break with the error:

  Invalid units specification

This happens because lvm.conf contains:

	# Default value for --units argument.
	units = "r"

The problem is that the very slightly older version of LVM2
doesn't understand this, and worse than that, every command -- even
ones that don't care about units, such as lvs --help --
fails with the mysterious error message:

  Invalid units specification

Comment 2 Alasdair Kergon 2017-07-26 13:34:52 UTC
How did the situation arise?  Just guessing, but was this 7.3->7.4; edit something in lvm.conf; then 7.4->7.3?  Was any .rpmnew file created but ignored?  We'll then have a think about whether any spec file changes could improve the way cases like these get handled in future.

The error message goes back 15 years and certainly needs to be improved to explain what it's talking about!

Comment 3 Richard W.M. Jones 2017-07-26 13:40:08 UTC
It's to do with how libguestfs caches a copy of lvm.conf during builds.
This means (because of the randomness of global brew build-overrides) that
we either cache the copy from >= 2.02.171 [bad] or < 2.02.171 [good].

We can't use the host copy of the config file because it might have
administrator changes that would break libguestfs.

Really the problem here is that the units line should be commented out,
since "r" is the default setting (see also commit f8234d6e5).

Comment 4 Alasdair Kergon 2017-07-26 13:49:49 UTC
To be quite clear, there is no requirement for the 7.3 package to understand the config file shipped with 7.4, and it's safer to stop to let the user finish their incomplete downgrade procedure than to continue and ignore new things the old package doesn't understand.

The issue here is how the user managed not to be aware that the file needed manual attention after downgrading i.e. what additional notifications might be possible and whether there are some cases that could be covered by better rpm scriptlets.  (For example, if this situation can ever arise when only default config files are in use.)

Comment 5 Alasdair Kergon 2017-07-26 13:52:55 UTC
(In reply to Richard W.M. Jones from comment #3)
> It's to do with how libguestfs caches a copy of lvm.conf during builds.

Then we need to understand this better and work out how to fix the dependencies.

> We can't use the host copy of the config file because it might have
> administrator changes that would break libguestfs.

So what is it used for?  Is it edited at all or is libguestfs really trying always to run with the built-in settings and not use a config file at all?

Comment 6 Zdenek Kabelac 2017-07-26 13:55:54 UTC
lvm2 does not support easy 'downgrade' in terms - you can take any 'newer' configuration file  and use it with old version of lvm2.

It's even more important if you write NEW lvm2 metadata with new command,
and you would expect such new format would be fully usable with older version
of lvm2.


Nowadays lvm2 fully supports execution of  lvm2 command without any configuration file at all - since all settings are built-in and are embedded in the binary and even fully exposable with 'lvm config' command.

So we have:

1.  lvm2 should probably distribute minimal config file (possibly referring man pages and the way how to generate it

2.  User should change minimal amount of thing in configure

3.  lvm2 of course cannot 'just' ignore whatever user has set for a setting -  but ATM lvm2 has no idea from where the unknown setting came from - since it could have been users' setting or uncommented default from installation - but it's clear the configured settings needs to be respected - since they are configure command to do some operation in described way - so lvm2 should not in general auto magically discard them without knowing what they are for (i.e. older version does not understand new option value)

4. There are settings with different degree of influence - so i.e.  ignoring  'units' with invalid value - probably has different impact the ignoring invalid i.e. filter setting -  so lvm2 may probably do a more fail-safe acceptance of some values for those 'less important' settings -  we need to identify them...
IMHO  units is rather  WARNING level then error level.

Comment 7 Richard W.M. Jones 2017-07-26 14:20:06 UTC
(In reply to Alasdair Kergon from comment #5)
> So what is it used for?  Is it edited at all or is libguestfs really trying
> always to run with the built-in settings and not use a config file at all?

It's used to construct the appliance.  We can't use the one from the
host because it could contain arbitrary changes, and we cannot download
the virgin config file at the point that the appliance gets built on the
end user machine.

However I did learn a couple of things from comment 6: (1) that no
config file is really needed and (2) the 'lvm config' command.  We
can probably work around this by adding:

rm -f /etc/lvm/lvm.conf

and/or

lvm config > /etc/lvm/lvm.conf

to the appliance init script.

> lvm2 does not support easy 'downgrade' in terms - you can take any
> 'newer' configuration file  and use it with old version of lvm2.

libguestfs doesn't expect or need this, but the problem is with global
buildroot overrides where we get some arbitrary new version of lvm2
when we didn't ask for it.

Comment 8 Alasdair Kergon 2017-07-26 14:42:12 UTC
Yes, you're looking for something like 'lvm config --type default --unconfigured --withcomments --ignorelocal --withspaces' plus the page of preamble at the start of the file.  (We can probably add an option to produce that too.)

Comment 9 Richard W.M. Jones 2017-07-26 15:23:47 UTC
Empty lvm.conf seems to work fine.  I posted patches (for libguestfs):

https://www.redhat.com/archives/libguestfs/2017-July/msg00285.html

Comment 11 Richard W.M. Jones 2017-07-27 21:53:23 UTC
(In reply to Richard W.M. Jones from comment #9)
> Empty lvm.conf seems to work fine.  I posted patches (for libguestfs):
> 
> https://www.redhat.com/archives/libguestfs/2017-July/msg00285.html

These are upstream in:
https://github.com/libguestfs/libguestfs/commit/10cf01419aff4d7913d1a3011ec0f1ba11afe0c9

Comment 12 Richard W.M. Jones 2017-07-27 21:54:08 UTC
Thanks Alasdair, feel free to close this bug or reassign to libguestfs
if you want.

Comment 13 Richard W.M. Jones 2017-08-04 08:08:23 UTC
*** Bug 1478226 has been marked as a duplicate of this bug. ***


Note You need to log in before you can comment on or make changes to this bug.