Bug 588200 - [with a simple fix] lvcreate: command not found
Summary: [with a simple fix] lvcreate: command not found
Alias: None
Product: Fedora
Classification: Fedora
Component: schroot
Version: 12
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Zach Carter
QA Contact: Fedora Extras Quality Assurance
Depends On:
Blocks: 588207
TreeView+ depends on / blocked
Reported: 2010-05-03 06:27 UTC by Oron Peled
Modified: 2010-12-03 15:09 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2010-12-03 15:09:44 UTC
Type: ---

Attachments (Terms of Use)

Description Oron Peled 2010-05-03 06:27:50 UTC
Description of problem:
schroot fails to enter an lvm-snapshot chroot.

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

How reproducible:
Create an lvm-snapshot type schroot. For example, create
an /etc/schroot/chroot.d/lenny-i386.conf as follows:
 description=Debian lenny LVM snapshot
 mount-options=-o atime,sync,user_xattr
 lvm-snapshot-options=--size 2G

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:

Alternatively, change the hard-coded defaults in the schroot command itself

Comment 1 Zach Carter 2010-05-18 13:27:33 UTC
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 23:08:32 UTC
schroot-1.2.3-4.fc12 has been submitted as an update for Fedora 12.

Comment 3 Fedora Update System 2010-05-24 19:35:02 UTC
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 20:10:51 UTC
schroot-1.2.3-8.fc13 has been submitted as an update for Fedora 13.

Comment 5 Fedora Update System 2010-05-26 21:51:09 UTC
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 22:25:04 UTC
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

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


Comment 7 Zach Carter 2010-06-09 21:11:55 UTC
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.


Comment 8 Bug Zapper 2010-11-03 15:46:58 UTC
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: 

Comment 9 Bug Zapper 2010-12-03 15:09:44 UTC
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.