[FAQ] "Command not found" when using su

Share your own howto's etc. Not for support questions!

[FAQ] "Command not found" when using su

Postby Head_on_a_Stick » 2019-07-30 15:10

The su command in Debian buster is now provided by the util-linux package rather than the login package and it will not include the /sbin directories in PATH unless it is called like this:
Code: Select all
su -

^ Note the dash after the command.

Alternatively, to get an approximation of the old behaviour add this line to /etc/login.defs:
Code: Select all
ALWAYS_SET_PATH yes

See also https://www.debian.org/releases/buster/ ... -variables & https://bugs.debian.org/cgi-bin/bugrepo ... bug=905409
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [FAQ] "Command not found" when using su

Postby cuckooflew » 2019-07-31 02:33

Thanks again, much needed this Howto, I lost count on how many posts there are, and it was because the person between the chair and keyboard did not know about the new way su is handled on Debian. It had me confused when I first installed Debian 10, but I did some searches, and read about it here: https://wiki.debian.org/NewInBuster
My grand father knows all about everything:
…one flew east, one flew west,
One flew over the cuckoo’s nest.
cuckooflew
 
Posts: 42
Joined: 2018-05-10 19:34
Location: Some where out west

Re: [FAQ] "Command not found" when using su

Postby mrkapqa » 2019-08-04 15:54



This info suggests using "sudo" instead of "su" .
but to get sudo working, i always had to to do "usermod -aG sudo username" as root
and to get to root it seems that "su" is no more appropriate.

i do understand that when one upgrades from an earlier edition , this info might be included and shown during the upgrade , but for new installs this info is nowhere to be seen.
I think it would be fair that an info screen would display such a " major change" after or during installation.

so in either case it is a bit confusing, and it doesn't clearly state why this change was necessary, if at all.
mrkapqa
 
Posts: 125
Joined: 2014-04-22 08:30

Re: [FAQ] "Command not found" when using su

Postby Bulkley » 2019-08-04 16:31

Head_on_a_Stick wrote:The su command in Debian buster is now provided by the util-linux package rather than the login package . . .


Not to sideline your information but do you have any idea why they did that? I've been using su for 20+ years without issue and now, seemingly out of the blue, someone decided to change it. Geez, when something works, don't fix it.
Bulkley
 
Posts: 5826
Joined: 2006-02-11 18:35

Re: [FAQ] "Command not found" when using su

Postby Head_on_a_Stick » 2019-08-04 17:15

mrkapqa wrote:to get sudo working, i always had to to do "usermod -aG sudo username" as root

If no root password is entered in the installer then the sudo package is installed and the first user is added to the sudo group automatically. Please continue any further discussion in your other thread, it is off-topic here, thanks.

Bulkley wrote:do you have any idea why they did that?

To align Debian with the other major distributions, this bug report has the full discussion: https://bugs.debian.org/cgi-bin/bugrepo ... bug=905409
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: [FAQ] "Command not found" when using su

Postby sickpig » 2019-08-07 13:02

pkexec is in built, why not use that?
haven = Sir P.G. Wodehouse's books. U havent lived unless u have read one :)
User avatar
sickpig
 
Posts: 314
Joined: 2019-01-23 10:34

Re: [FAQ] "Command not found" when using su

Postby Head_on_a_Stick » 2019-08-07 18:59

sickpig wrote:pkexec is in built

Not necessarily:
Code: Select all
E485:~$ pkexec apt update
loksh: pkexec: not found
E485:~127$

And pkexec will not include the /sbin directories in PATH so the command will still not be found.
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to Docs, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable