Bug 1335294 - [RFE] improve commands run as non-root
Summary: [RFE] improve commands run as non-root
Keywords:
Status: NEW
Alias: None
Product: LVM and device-mapper
Classification: Community
Component: lvm2
Version: unspecified
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: LVM Team
QA Contact: cluster-qe
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-05-11 19:41 UTC by David Teigland
Modified: 2025-05-17 08:28 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Embargoed:
rule-engine: lvm-technical-solution?
rule-engine: lvm-test-coverage?


Attachments (Terms of Use)

Description David Teigland 2016-05-11 19:41:35 UTC
Description of problem:

Improve lvm commands run as non-root.

Perhaps we could add a new config setting "allow_non_root".  When 0, an lvm command would fail instead of printing a warning and continuing (often with further errors).

A default of allow_non_root=0 makes sense because it's consistent with the default permissions of the lvmetad socket, other sockets, /dev/mapper/control, /dev nodes, and probably some other things.

With special user configuration of permissions and special lvm options (e.g. --driverloaded n), the user can also set allow_non_root=1.

Currently, I'm getting the following as non-root:

use_lvmetad=0

$ vgs
  WARNING: Running as a non-root user. Functionality may be unavailable.
  /dev/mapper/control: open failed: Permission denied
  Failure to communicate with kernel device-mapper driver.
  Incompatible libdevmapper (unknown version) and kernel driver (unknown version).

use_lvmetad=1

$ vgs
  WARNING: Running as a non-root user. Functionality may be unavailable.
  lvmetad_socket_present failed: Permission denied
  WARNING: Failed to connect to lvmetad. Falling back to device scanning.
  /dev/mapper/control: open failed: Permission denied
  Failure to communicate with kernel device-mapper driver.
  Incompatible libdevmapper (unknown version) and kernel driver (unknown version).

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Alasdair Kergon 2016-05-12 00:44:28 UTC
It's just a difference in perspective here.

Running as non-root is a perfectly valid thing to do if you've set up your system's environment to support that.

Although commands try to communicate with the dm driver during initialisation, failure to make contact is not an error at that stage - that only happens later if the command really needs to use the driver.

Comment 3 Alasdair Kergon 2016-05-12 00:58:32 UTC
Also fixed this message:

lvmetad_socket_present failed: Permission denied

Any error involving a file in the filesystem must provide the name of the file concerned and the system call name, optionally qualified with further relevant arguments or the function name.

https://www.redhat.com/archives/lvm-devel/2016-May/msg00048.html

https://git.fedorahosted.org/cgit/lvm2.git/patch/?id=a6203657a0bf4b15017724a8212cc61a8672afa5

Comment 4 David Teigland 2016-05-12 15:38:33 UTC
> Running as non-root is a perfectly valid thing to do if you've set up your
> system's environment to support that.

Yes, that's good, but I'm interested here in the common case where someone has *not* set up or changed their environment, i.e. the defaults.  It appears that everywhere across the system, the default is for root-only lvm.  So, I'm suggesting that lvm's *default* behavior should *match* the defaults made everywhere else.  Instead, lvm is currently assuming that the user has set up their environment in a way that makes it useful to run non-root.  That assumption is wrong the vast majority of the time, so I think the default should be changed to match the common/majority case.


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