Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 656400 - sys-apps/baselayout-2.5-r1 removal of ROOTPATH breaks zsh root access
Summary: sys-apps/baselayout-2.5-r1 removal of ROOTPATH breaks zsh root access
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-24 11:25 UTC by Mike Auty (RETIRED)
Modified: 2018-07-12 21:05 UTC (History)
9 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Auty (RETIRED) gentoo-dev 2018-05-24 11:25:41 UTC
Hiya,

I just installed baselayout-2.5-r1 and then attempting to su resulting in a number of errors from inside the zshrc trying to run env/grep etc.  After a little debugging it appeared this is because whilst normal login worked fine, using su would not properly set the path.  It was setting from other files within env.d, and I eventually tracked it down to the ROOTPATH value missing from /etc/env.d/50baselayout.

This occurred when SSHing in, even after running env-update, logging off and re-logging in.

The commit that caused the issue ( https://gitweb.gentoo.org/proj/baselayout.git/commit/?id=9cac4dd130637fa2c1f1a64bf3c9d2509284e6dd ) suggests that ROOTPATH is no longer necessary, but /etc/zsh/zprofile (part of app-shells/zsh) does still use it, and therefore sets it incorrectly for any zsh users logging in as root after updating to this package.

It's not clear how best to deal with multiple different shells using customary values likes ROOTPATH.  In the short term, an explicit message to inform people using other shells that things have changed might help.

Please let me know if you need any other information...
Comment 1 Juergen Rose 2018-05-24 18:03:47 UTC
I have a similar issue. If I login as root and echo PATH in the beginning of /etc/profile /bin is included. But then PATH is replaced by ${ROOTPATH}, which is

/etc/profile:   ROOTPATH=|/usr/x86_64-pc-linux-gnu/gcc-bin/7.3.0:/usr/lib/llvm/6/bin:/opt/nvidia-cg-toolkit/bin:/usr/lib64/subversion/bin:/opt/eagle/bin|


Which was with baselayout-2.4.1-r2:

/etc/profile:   ROOTPATH=|/usr/x86_64-pc-linux-gnu/gcc-bin/7.3.0:/usr/lib/llvm/6/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
Comment 2 Jochen Schlick 2018-05-24 20:22:25 UTC
similar problem with bash using su. /bin and /usr/bin are no longer part of PATH. And then other tools like /bin/egrep which are obviously shell-scripts no longer work (e.g. /bin/egrep calls grep directly without path)
Comment 3 Mike Gilbert gentoo-dev 2018-05-24 20:47:57 UTC
Another issue: the app-admin/sudo ebuild uses ROOTPATH at build time to set a "secure path" in the resulting binary.
Comment 4 Mike Gilbert gentoo-dev 2018-05-24 20:50:13 UTC
(In reply to Juergen Rose from comment #1)

It sounds like you need to run etc-update to update /etc/profile. The version shipped with baselayout-2.5 does not refer to ROOTPATH in any way.
Comment 5 Mike Gilbert gentoo-dev 2018-05-24 20:51:07 UTC
(In reply to Jochen Schlick from comment #2)

I'm not able to reproduce that issue. /bin and /usr/bin should appear in PATH with bash and baselayout-2.5.
Comment 6 Michael Cook 2018-05-25 21:19:07 UTC
I'm having this issue too.
Comment 7 Michael Cook 2018-05-25 21:30:40 UTC
Looks like /etc/zsh/zprofile needs to be updated if removal of ROOTPATH is staying.
Comment 8 Juergen Rose 2018-05-26 11:38:57 UTC
(In reply to Mike Gilbert from comment #4)
> (In reply to Juergen Rose from comment #1)
> 
> It sounds like you need to run etc-update to update /etc/profile. The
> version shipped with baselayout-2.5 does not refer to ROOTPATH in any way.

Neither dispatch-conf nor etc-update want to update anysthing:

root@lynxold:/root(11)# dispatch-conf 
root@lynxold:/root(12)# etc-update
Scanning Configuration files...
Exiting: Nothing left to do; exiting. :)
root@lynxold:/root(13)#
Comment 9 Juergen Rose 2018-05-26 12:06:47 UTC
(In reply to Juergen Rose from comment #8)
> (In reply to Mike Gilbert from comment #4)
> > (In reply to Juergen Rose from comment #1)
> > 
> > It sounds like you need to run etc-update to update /etc/profile. The
> > version shipped with baselayout-2.5 does not refer to ROOTPATH in any way.
> 
> Neither dispatch-conf nor etc-update want to update anysthing:
> 
> root@lynxold:/root(11)# dispatch-conf 
> root@lynxold:/root(12)# etc-update
> Scanning Configuration files...
> Exiting: Nothing left to do; exiting. :)
> root@lynxold:/root(13)#

I have to correct, at the system, where etc-update did not find anything to update /etc/profile was anyhow magically replace by a new version.
Comment 10 Martin Kletzander 2018-05-27 12:20:37 UTC
Running dispatch-conf/etc-update fixes /etc/profile, but not /etc/zsh/zprofile, which still honours ${ROOTPATH}.  Even if it is not set.  And that's the problem.   Not even rebuilding zsh after the upgrades fixes it.  In order for this to work with both older and newer versions of baselayout we either need to remove /etc/zsh/profile and use /etc/profile instead, but I'm not sure if /etc/zsh/profile serves any purpose, so in case it does, that might not be possible.  In that case ${ROOTPATH} should be honoured only if it is set.
Comment 11 Martin Kletzander 2018-05-27 12:56:46 UTC
(In reply to Martin Kletzander from comment #10)
> Running dispatch-conf/etc-update fixes /etc/profile, but not
> /etc/zsh/zprofile, which still honours ${ROOTPATH}.  Even if it is not set. 
> And that's the problem.   Not even rebuilding zsh after the upgrades fixes
> it.  In order for this to work with both older and newer versions of
> baselayout we either need to remove /etc/zsh/profile and use /etc/profile
> instead, but I'm not sure if /etc/zsh/profile serves any purpose, so in case
> it does, that might not be possible.  In that case ${ROOTPATH} should be
> honoured only if it is set.

Sorry, my bad, disregard that, it won't help, $ROOTPATH is stil used in so many places.  For example:

xdm appends it to pathin /etc/init.d/xdm, but if it doesn't exist it still appends the colon separator.
subversion, llvm and gcc still append their bin folders into $ROOTPATH
And there will possibly be more.
Comment 12 Piotr Karbowski (RETIRED) gentoo-dev 2018-05-28 19:08:56 UTC
Can we revert baselayout update until other things like sudo and zsh are aligned?
Comment 13 William Hubbs gentoo-dev 2018-05-29 16:21:20 UTC
All, in baselayout 2.6, we leave ROOTPATH in /etc/env.d, which means it
will be available, we just unset it in /etc/profile.
Does that fix the issues?
Comment 14 Søren Dalby Larsen 2018-05-29 16:50:08 UTC
Baselayout 2.6 fixes it (for  me). Thanks.
Comment 15 Mike Auty (RETIRED) gentoo-dev 2018-05-30 00:13:11 UTC
Yep, baselayout-2.6 doesn't seem to exhibit the same problems, thanks.  5:)  Happy for this to be closed if you're happy...
Comment 16 William Hubbs gentoo-dev 2018-05-31 16:30:26 UTC
Closing per above comments. Baselayout-2.6 fixes the issue.
Comment 17 William Hubbs gentoo-dev 2018-06-03 16:00:46 UTC
This does fix the immediate issue. However, .zprofile should be modified
once the new baselayout goes stable to not refer to ROOTPATH.
Comment 18 Larry the Git Cow gentoo-dev 2018-06-05 20:39:06 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d09566dc69f7806142d67955f8d05383d60d0622

commit d09566dc69f7806142d67955f8d05383d60d0622
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2018-05-24 19:27:50 +0000
Commit:     William Hubbs <williamh@gentoo.org>
CommitDate: 2018-06-05 20:35:33 +0000

    app-shells/zsh: check for /usr/sbin in ROOTPATH before using it
    
    The maintainer, radhermit@gentoo.org, authorized me to fix this bug
    (williamh).
    
    Closes: https://bugs.gentoo.org/656400
    Closes: https://github.com/gentoo/gentoo/pull/8550
    Closes: https://github.com/gentoo/gentoo/pull/8566

 app-shells/zsh/files/zprofile-4                    | 42 ++++++++++++++++++++++
 .../zsh/{zsh-5.5.1.ebuild => zsh-5.5.1-r1.ebuild}  |  2 +-
 app-shells/zsh/zsh-9999.ebuild                     | 11 ++----
 3 files changed, 45 insertions(+), 10 deletions(-)