Re: f26 chroot PATH doesn't include /bin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 30, 2017 at 3:16 PM, Tony Nelson
<tonynelson@xxxxxxxxxxxxxxxxx> wrote:
>
> I have an old CentOS5 that I chroot into. On my old f20 box, PATH
> included /bin, but now on f26 it does not. I don't understand how
> this could happen; I would think that PATH is set inside the chroot
> by the shell. How does PATH get set? I see how it is modified and
> have fixed my issue, provided I use a login shell.

It's because chroot keeps PATH set. So if your pre-chroot PATH doesn't
include "/sbin" or "/bin", they won't be in the chrooted PATH:

root@fedraw ~ # echo $PATH
/usr/sbin:/usr/bin

root@fedraw ~ # chroot /bb ./busybox sh

\u@\h \w # echo $PATH
/usr/sbin:/usr/bin

\u@\h \w # exit

root@fedraw ~ # PATH=/sbin:/bin:/usr/sbin:/usr/bin chroot /bb ./busybox sh

\u@\h \w # echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin

\u@\h \w # exit

root@fedraw ~ #

If you use a login shell (eg, "chroot /bb bash -l" instead of "chroot
/bb bash"), the dotfiles that will be sourced will set the appropriate
chrooted PATH.
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux