On 17-08-31 12:18:38, Tom H wrote:
On Wed, Aug 30, 2017 at 3:16 PM, Tony Nelson tonynelson@georgeanelson.com 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:
OK, now I get it. I have another chroot for f20, which is after the /bin -> /usr/bin transition, that works because it doesn't need any help.
...
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.
Sadly, no, not without editing them. The only pathmunge()'ing I see is for root's use of sbin. I added a file to /etc/profile.d to pathmunge /bin, which sets the path for both interactive and login shells.
I still have an issue of no saved history on plain interactive shells, so I do specify a login shell. My f20 chroot doesn't have the problem, either as a login shell or not as shown by `shopt login_shell`, but it's a more complicated (overlayfs over ro mount) setup, as well as newer than the CentOS5 setup.
The history issue with CentOS5 chroot is new with f26, and worked in f20.