Bug 28524

Summary: /usr/sbin not in the PATH of root
Product: Mageia Reporter: Denis Bitouzé <dbitouze>
Component: RPM PackagesAssignee: Mageia Bug Squad <bugsquad>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: Normal CC: lewyssmith, ouaurelien
Version: 8   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Source RPM: CVE:
Status comment:

Description Denis Bitouzé 2021-03-05 09:49:27 CET
Description of problem:
After a fresh install of Mageia 8, /usr/sbin is not in the PATH of root (and, hence, urpmi for instance is not found).
Comment 1 Aurelien Oudelet 2021-03-05 11:19:47 CET
Hi, thanks reporting this.
How do you obtain root privileges?

Best use:
$ su -
# echo $PATH
/usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin

Therefore, urpmi is found on all my systems.

Note that this path is displayed on all my systems, even in 3 freshly Virtual Machines installed with Plasma, Gnome or Mate Desktops.

To be root, you must use "su -" with a minus (6 key on AZERTY keyboard).

https://wiki.mageia.org/en/Never_use_just_su

Status: NEW => NEEDINFO
CC: (none) => ouaurelien

Comment 2 Denis Bitouzé 2021-03-05 11:31:00 CET
Indeed, `su -` instead of `su` did the trick. But, IIRC, `urpmi` was found with just `su` until Mageia 7.
Comment 3 Aurelien Oudelet 2021-03-05 11:42:26 CET
(In reply to Denis Bitouzé from comment #2)
> Indeed, `su -` instead of `su` did the trick. But, IIRC, `urpmi` was found
> with just `su` until Mageia 7.

And this is a bug in Mageia 7.
/sbin (/usr/sbin) programs must not be in User's path.

Now we use a better $PATH for user and for root.
Closing this.

Status: NEEDINFO => RESOLVED
Resolution: (none) => WORKSFORME

Comment 4 Lewis Smith 2021-03-05 21:05:36 CET
For the record on my M8 system:
 $ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/games:/usr/games:/usr/lib64/qt5/bin
yet
 $ urpmi whatever
 Dim ond yr uwchddefnyddiwr all osod pecynnau  [Only superuser can install pkgs]

 $ sudo urpmi (or whatever)
works fine for all 'su' commands. You need to be in the 'wheel' group for sudo:
 $ sudo urpmi whatever
 [sudo] password for lewis: 
 Dim pecyn o'r enw whatever    [no pkg of this name]

 $ su
 Password: 
 # echo $PATH
 /usr/local/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/lib64/qt5/bin
 # urpmi whatever
 Dim pecyn o'r enw whatever    [no pkg of this name]

CC: (none) => lewyssmith