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

Re: Why /usr/sbin is not in my root $PATH ?



On Thu, Feb 21, 2019 at 09:31:31AM +0100, Pierre Couderc wrote:
> On 2/21/19 9:15 AM, Reco wrote:
> > On Thu, Feb 21, 2019 at 09:07:09AM +0100, Pierre Couderc wrote:
> > > Why /usr/sbin is not in my root $PATH ?

Because you upgraded to buster (or unstable), and Debian in its infinite
wisdom has changed the behavior of su between stretch and buster.

> > Make a habit of using 'su -', as this behaviour is here to stay.

Or use one of several other workarounds, for example putting /usr/sbin
and /sbin into your regular user account's PATH.

> > It's a change in Debian, see #833256.
> > There are two su utilities, from 'shadow' and from 'util-linux'.
> > Preserving user's environment unless '-' is specified is a feature of
> > util-linux's su.
> > 
> Thnk you very much. This is the answer I needed. Sorry for the noise ;)

It's not noise.  This is going to be the number one support issue for
buster, I just know it.  This question is going to come up repeatedly.
The su change breaks *so* much.

Red Hatters have apparently been living with this behavior for years,
and they came up with the "su -" workaround.  And hey, if that works
for them, great.

The problem with "su -" is that it strips out *all* of your environment,
*and* it changes your working directory to /root.  So, some things which
work perfectly well in stretch (with "su") will no longer work in buster
(with "su -").

Example 1:

$ make
$ su -
# make install    # fails because you're no longer in the build dir

Example 2:

$ export LANG=something LESS=-X ...
$ su -
# man something   # your environment settings have been lost

I haven't upgraded to buster yet, so I haven't had to make any changes to
my own environment yet, but I suspect I'll be adding /usr/sbin and /sbin
to my regular account's PATH.  That will break the smallest amount of
stuff for my usage patterns, as I will be able to continue using a normal
"su" which will retain my environment and my working directory.


Reply to: