You are not logged in.

#1 2024-08-20 04:55:22

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

How can I put the /usr/bin directory upper in the PATH?

How can I put the /usr/bin upper in the PATH? When I run the which command, it gives me something like this: /sbin/binary, but sbin is symlink to /usr/bin. And I don't think that symlink should be placed higher than /usr/bin. How can I put the /usr/bin/ upper in the PATH? I don't want it to be local; I want it to be global.

Offline

#2 2024-08-20 05:02:19

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: How can I put the /usr/bin directory upper in the PATH?

/sbin shouldn't be in PATH at all, and it's not by default. Check your shell configs.

Offline

#3 2024-08-20 05:05:46

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

Scimmia wrote:

/sbin shouldn't be in PATH at all, and it's not by default. Check your shell configs.

I use fish shell as my default ones. I searched for the PATH keyword in the config.fish file, and it gave this lines:

set -gx PATH "$PATH:/home/aljustiet/.local/bin"
set -gx PATH "$PATH:/home/aljustiet/Documents/platform-tools"
set -gx PATH "$PATH:/home/aljustiet/go/bin"

Offline

#4 2024-08-20 05:06:08

mpan
Member
Registered: 2012-08-01
Posts: 1,597
Website

Re: How can I put the /usr/bin directory upper in the PATH?

On Arch “/sbin” is a symlink to “/usr/bin”, so there is no difference⁽¹⁾ which one you put higher. There is nothing to fix.

In case this would happen to another directory, one that would be a problem, the right question to ask is determining what modifies PATH and eliminating that factor. See what is invoked in your shell’s configuration, possibly also anything executed during DE’s start (like “~/.xinitrc” if using xorg) etc. Additional things may be present in “/etc/profile.d/”.

As a last resort you might patch PATH at some later stage (e.g. “~/.profile”). But this shouldn’t be necessary, if a cleaner solution is possible.
____
⁽¹⁾ To be technically correct: unless the program checks the name with which it was invoked. But a program generally shouldn’t change its behavior based on which binaries directory it was put in.


Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#5 2024-08-20 05:07:37

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: How can I put the /usr/bin directory upper in the PATH?

Ah fish. Arch isn't set up for that, it sets up shells that deal with /etc/profile correctly. You have to do it all yourself.

Offline

#6 2024-08-20 05:09:39

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

mpan wrote:

On Arch “/sbin” is a symlink to “/usr/bin”, so there is no difference⁽¹⁾ which one you put higher. There is nothing to fix.

In case this would happen to another directory, one that would be a problem, the right question to ask is determining what modifies PATH and eliminating that factor. See what is invoked in your shell’s configuration, possibly also anything executed during DE’s start (like “~/.xinitrc” if using xorg) etc. Additional things may be present in “/etc/profile.d/”.

As a last resort you might patch PATH at some later stage (e.g. “~/.profile”). But this shouldn’t be necessary, if a cleaner solution is possible.
____
⁽¹⁾ To be technically correct: unless the program checks the name with which it was invoked. But a program generally shouldn’t change its behavior based on which binaries directory it was put in.

I use Ly as DM, and Hyprland as WC.

Offline

#7 2024-08-20 05:15:57

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

Scimmia wrote:

Ah fish. Arch isn't set up for that, it sets up shells that deal with /etc/profile correctly. You have to do it all yourself.

I changed the default shell from fish to bash and rebooted, but when I type which ls, it still gives the binaries from the /sbin symlink.

Offline

#8 2024-08-20 05:18:45

Scimmia
Fellow
Registered: 2012-09-01
Posts: 13,726

Re: How can I put the /usr/bin directory upper in the PATH?

How about with a new, clean user account? How about just logged into a TTY?

Last edited by Scimmia (2024-08-20 05:19:16)

Offline

#9 2024-08-20 05:37:26

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

Scimmia wrote:

How about with a new, clean user account? How about just logged into a TTY?

I created the user test with the bash as the default shell. I logged in using the ly DM, and there, when I run the which ls, it still gives the /sbin/ls. Should I try to do it without DM?

Last edited by aljustiet (2024-08-20 05:39:51)

Offline

#10 2024-08-20 05:51:15

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

The Ly DM was setting up the default PATH variable, so I changed the config to look like this

path = /usr/bin:/usr/local/sbin:/usr/local/bin

Offline

#11 2024-08-20 07:28:09

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,209

Re: How can I put the /usr/bin directory upper in the PATH?

Stop using ly, it breaks many more things and will generally lead to weird bugs in your session.

Offline

#12 2024-08-20 13:10:01

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

V1del wrote:

Stop using ly, it breaks many more things and will generally lead to weird bugs in your session.

Should I use lemurs instead?

Offline

#13 2024-08-20 15:00:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,828

Re: How can I put the /usr/bin directory upper in the PATH?

Do you actually need a DM? How many users use that system?

Offline

#14 2024-08-20 15:01:20

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

seth wrote:

Do you actually need a DM? How many users use that system?

Only one.

Offline

#15 2024-08-20 15:14:02

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 75,828

Re: How can I put the /usr/bin directory upper in the PATH?

So "no".
https://wiki.archlinux.org/title/Getty# … al_console
https://wiki.archlinux.org/title/Start_X_at_login

And then just autostart some screenlocker in your xinitrc, you'll boot straight into a locked GUI session, enter your password to unlock and can use the system immediately.
(It's technically not required to auto-lock the session, but it provides a level of protection not necessarily equal to an actual login, but probably sufficient? Basically depends on whether you've an encrypted $HOME)

Offline

#16 2024-08-21 04:24:00

aljustiet
Member
Registered: 2024-02-09
Posts: 89
Website

Re: How can I put the /usr/bin directory upper in the PATH?

seth wrote:

So "no".

Does it work with Wayland compositor?

Last edited by aljustiet (2024-08-21 05:08:07)

Offline

#17 2024-08-21 05:06:26

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 9,003
Website

Re: How can I put the /usr/bin directory upper in the PATH?

It's even simpler under Wayland 'cos you don't have to source the /etc/X11/xinit/xinitrc.d/ files.

Just add the launch command to ~/.profile (or ~/.bash_profile if you're still using bash) to start the compositor automatically on login.

I launch different desktops depending on the TTY number:

case "$(tty)" in
   /dev/tty1) exec sway > ~/.local/share/sway/sway.log 2>&1 ;;
   /dev/tty2) exec startx ;;
   /dev/tty3) setfont latarcyrheb-sun32 ; exec tty-clock -cs
esac

And please don't full-quote unnecessarily, it degrades the readability of the thread.


Jin, Jîyan, Azadî

Offline

Board footer

Powered by FluxBB