PATH not exported by default when used as init= shell

Bug #320188 reported by Loïc Minier
2
Affects Status Importance Assigned to Milestone
bash (Ubuntu)
Won't Fix
Undecided
Unassigned
dash (Ubuntu)
Won't Fix
Undecided
Unassigned
debootstrap (Ubuntu)
Fix Released
Low
Colin Watson

Bug Description

Hi,

When using dash or bash as init= shell on the kernel command line, PATH isn't set by the kernel in init's environment and hence not in dash's or bash's environment. Both cope fine with this, but they don't export PATH for subcommands which is desirable as all commands except init have a PATH set.

One example of this is if you try to run debootstrap's second stage from such a shell: it wil fail while dpkg-installing base-files and base-passwd because dpkg wants a PATH to be set.

Bye,

Revision history for this message
Loïc Minier (lool) wrote :
Revision history for this message
Loïc Minier (lool) wrote :
Revision history for this message
Oliver Grawert (ogra) wrote :

confirming, this bug forces me to export PATH in a qemu wrapper script (a script called /bin/installer is executed as init in this case), the code example is:

# write installer script to image
cat > $BUILDDIR/installer <<EOF
#!/bin/bash
set -e

export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export LC_ALL=C
/debootstrap/debootstrap --second-stage

....

EOF

Changed in bash:
status: New → Confirmed
Revision history for this message
Oliver Grawert (ogra) wrote :

confirming for dash as well, same issue

Changed in dash:
status: New → Confirmed
Revision history for this message
Loïc Minier (lool) wrote :

Adding debootstrap to tasklets and wontfixing dash/bash tasks: upstream commented that they don't want to assume PATH should be exported and hence debootstrap should export PATH for dpkg.

Changed in bash:
status: Confirmed → Won't Fix
Changed in dash:
status: Confirmed → Won't Fix
Changed in debootstrap:
status: New → Triaged
Revision history for this message
Colin Watson (cjwatson) wrote :

Fixed upstream for the next sync from Debian.

Changed in debootstrap (Ubuntu):
assignee: nobody → cjwatson
importance: Undecided → Low
status: Triaged → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package debootstrap - 1.0.12

---------------
debootstrap (1.0.12) unstable; urgency=low

  [ Otavio Salvador ]
  * Improve code to choose between libc packages. Thanks to Luca Favatella
    <email address hidden> for first version of the patch.

  [ Colin Watson ]
  * Remove partial support for emitting translated progress messages with
    gettext. Don't panic; d-i still has all the support necessary for this.
    debootstrap's own support for doing this outside d-i with gettext's
    shell bindings has been completely broken ever since it was added in
    2003, though, and nobody has complained. Fixing it would require a big
    pile of infrastructure and some non-trivial patches, plus arranging to
    copy all the translations over from base-installer, and it just doesn't
    seem worth it, so lose the cruft (LP: #188690).
  * Export PATH, just to make sure. It isn't necessarily exported by shells
    running from init=/bin/sh or similar, and the upstream bash maintainer
    is unwilling to export it by default; it's easy enough to do so here
    (LP: #320188).

debootstrap (1.0.11) unstable; urgency=low

  * Add (Ubuntu) jaunty as a symlink to gutsy.
  * Clarify that --second-stage is needed to complete the bootstrapping
    process after --foreign.
  * Fix --make-tarball= option (closes: #484869).
  * Fix old Debian scripts and all Ubuntu scripts to cope with Anthony's
    change in 1.0.8 to make --second-stage not bother recalculating required
    and base.
  * Rename 'repeat' to 'repeatn', since 'repeat' is a reserved word in zsh;
    although strictly speaking this seems like an incompatibility in zsh
    when linked to /bin/sh (closes: #340058).
  * Fix --unpack-tarball= option (thanks, Torsten Landschoff; closes:
    #500759).
  * Fix handling of relative DEBOOTSTRAP_DIR (thanks, Mikhail Gusarov;
    closes: #503460).
  * Cope with ancient versions of chroot(8) that don't call chdir() (thanks,
    Patrik Arvhult; closes: #350635).
  * Recommend gnupg for --keyring option (thanks, Robert Millan; closes:
    #467571).
  * Note that you can't --include packages with non-required Pre-Depends
    (see #487908).
  * Mention /sys in EXAMPLE section of manual page, and use "defaults"
    rather than "none" as the mount options for /proc (thanks, Raúl Sánchez
    Siles; closes: #410787).
  * Add /dev/console to devices.tar.gz (after all, MAKEDEV's 'consoleonly'
    was added for boot-floppies in the first place; see
    https://lists.ubuntu.com/archives/ubuntu-devel/2009-January/027230.html).
  * Add support for squeeze (closes: #513488).

 -- Colin Watson <email address hidden> Wed, 18 Mar 2009 10:42:22 +0000

Changed in debootstrap:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.