Bug 588200 - [with a simple fix] lvcreate: command not found
[with a simple fix] lvcreate: command not found
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: schroot (Show other bugs)
12
All Linux
low Severity medium
: ---
: ---
Assigned To: Zach Carter
Fedora Extras Quality Assurance
:
Depends On:
Blocks: 588207
  Show dependency treegraph
 
Reported: 2010-05-03 02:27 EDT by Oron Peled
Modified: 2010-12-03 10:09 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-12-03 10:09:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Oron Peled 2010-05-03 02:27:50 EDT
Description of problem:
schroot fails to enter an lvm-snapshot chroot.

Version-Release number of selected component (if applicable):
schroot-1.2.3-3.fc12.i686

How reproducible:
Create an lvm-snapshot type schroot. For example, create
an /etc/schroot/chroot.d/lenny-i386.conf as follows:
 ------------------------------------------------------
 [lenny-i386]
 type=lvm-snapshot
 description=Debian lenny LVM snapshot
 aliases=stable,default
 priority=3
 #groups=sbuild
 users=oron
 source-root-users=oron
 #source-root-groups=admin
 device=/dev/vg00/chroot-lenny
 mount-options=-o atime,sync,user_xattr
 lvm-snapshot-options=--size 2G
 run-setup-scripts=true
 run-exec-scripts=true
 ------------------------------------------------------


Steps to Reproduce:
1. schroot -c lenny-i386
2. Fails with:
     /etc/schroot/setup.d/05lvm: line 38: lvcreate: command not found
3. Echoing $PATH in /etc/schroot/setup.d/05lvm confirms that it does not
    include /sbin or /usr/sbin

Additional info:
This can be trivially fixed by adding to /etc/chroot/script-defaults the following:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

Alternatively, change the hard-coded defaults in the schroot command itself
Comment 1 Zach Carter 2010-05-18 09:27:33 EDT
Thanks for the report Oron.   Sorry it took so long to get to it, I've been travelling.   I'll try to post an update soon.
Comment 2 Fedora Update System 2010-05-21 19:08:32 EDT
schroot-1.2.3-4.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/schroot-1.2.3-4.fc12
Comment 3 Fedora Update System 2010-05-24 15:35:02 EDT
schroot-1.2.3-4.fc12 has been pushed to the Fedora 12 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update schroot'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/schroot-1.2.3-4.fc12
Comment 4 Fedora Update System 2010-05-25 16:10:51 EDT
schroot-1.2.3-8.fc13 has been submitted as an update for Fedora 13.
http://admin.fedoraproject.org/updates/schroot-1.2.3-8.fc13
Comment 5 Fedora Update System 2010-05-26 17:51:09 EDT
schroot-1.2.3-8.fc13 has been pushed to the Fedora 13 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update schroot'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/schroot-1.2.3-8.fc13
Comment 6 Roger Leigh 2010-06-07 18:25:04 EDT
As upstream, I would be interested to know why lvcreate wasn't found in the default PATH.  In Debian, it's /sbin/lvcreate; is this the same for Fedora?
The only time we alter the environment is when calling execve(2) to invoke the user shell/program in the chroot, where we also provide a new environment.  And for the case of the setup scripts, we provide a completely clean environment with just the variables the scripts need to function; this does not include PATH.

My question here is what does /bin/sh set PATH to if unset.  On Debian, this is done in /etc/profile:

if [ "`id -u`" -eq 0 ]; then
  PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
else
  PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi

which means lvcreate is found when the script is run as root.  Is this not the case on Fedora?

I'm not opposed to switching to a hard-coded path.  I just want to be sure that it's
1) the same path
2) really required, since it's working fine on other systems


Regards,
Roger
Comment 7 Zach Carter 2010-06-09 17:11:55 EDT
In fedora (which uses bash), I believe the /etc/profile is only sourced for interactive login shells.  If you want /etc/profile to be read in a non-interactive shell, you could "export BASH_ENV=/etc/profile". From the bash man page:

"When bash is started non-interactively, to run a shell script, for  example,  it  looks for  the  variable  BASH_ENV in the environment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute.  Bash behaves as if the following command were executed:
              if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
but the value of the PATH variable is not used to search for the file name."

If the clean environment you provide for the setup scripts does not include BASH_ENV (or ENV for sh), then that might explain why the /etc/profile is not being used to set the PATH appropriately.

-Zach
Comment 8 Bug Zapper 2010-11-03 11:46:58 EDT
This message is a reminder that Fedora 12 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 12.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '12'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 12's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 12 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 9 Bug Zapper 2010-12-03 10:09:44 EST
Fedora 12 changed to end-of-life (EOL) status on 2010-12-02. Fedora 12 is 
no longer maintained, which means that it will not receive any further 
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of 
Fedora please feel free to reopen this bug against that version.

Thank you for reporting this bug and we are sorry it could not be fixed.

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