Closed gibmat closed 1 year ago
Ignoring the current PATH
doesn't really feel right in general and may also affect our ability to test or limit some of those commands by altering PATH
to use alternative versions of the binaries being looked for.
A reasonable fix would be to tweak the error a tiny bit to hint that it wasn't found in the normal lookup PATH so the user may get the hint that they need to include it in their PATH or run as root.
Ive not looked into this in great detail yet, but I was thinking we could check the lvm thin tools as part of checking which storage pool drivers were available on the server and send a hint back to the lxd init client.
Yeah, that'd be an alternative, having an extra field in the DriverInfo which is then plumbed all the way to be stored in memory and returned in /1.0
output. It's definitely possible though it's honestly more work than I'm willing to put into this at this point ;)
Especially for a driver that's as unpopular as LVM :)
Required information
Issue description
Originally reported as Debian bug #1027321; I've waited a while to see if the original reporter would confirm my workaround as described below, but that hasn't happened yet and I wanted to get the bug forwarded.
The original reporter ran into an issue performing a
lxd init
as a normal user who had already been added to the "lxd" group. They were trying to configure a lvm storage backend, but LXD wasn't able to find the thin-provisioning tools even though they were properly installed. It appears this is caused by thethin_check
binary existing under/usr/sbin/
, which isn't in a normal user's path by default.I have reproduced the issue, and verified that
lxd init
works correctly if I explicitly add/usr/sbin/
to my path when running that command. The logic for this check (https://github.com/lxc/lxd/blob/master/lxd/main_init_interactive.go#L903) relies onos/exec
, and I'm not sure if there's an easy way to inject/usr/sbin/
whenLookPath()
is called.Steps to reproduce
Without modifying
$PATH
Modified
$PATH