Welcome!

The kernel problem with recent updates has been solved. Find the solution here

Important information
-- Required MX 15/16 Repository Changes
-- Information on torrent hosting changes
-- Information on MX15/16 GPG Keys
-- Spectre and Meltdown vulnerabilities

News
-- Introducing our new Website
-- MX Linux on social media: here

Current releases
-- MX-18.3 Point Release release info here
-- Migration Information to MX-18 here
-- antiX-17.4.1 release info here

New users
-- Please read this first, and don't forget to add system and hardware information to posts!
-- Here are the Forum Rules

How to add to the path? (solved)

Help for Current Versions of MX
Post Reply
Vincent17
Forum Novice
Forum  Novice
Posts: 73
Joined: Tue Feb 20, 2018 1:07 am

How to add to the path? (solved)

#1

Post by Vincent17 » Tue Feb 20, 2018 1:19 am

Hello,
New user, settling in to MX-Linux (MX-17_January_x64). So far, so good :)
I want to import some apps from my other distro(s). In an attempt to avoid confusion, I have created /usr/FDlibs and /usr/FDapps. I want those directories in the paths, so I added PATH="$PATH:/usr/FDapps" immediately before "export PATH" in /etc/profile, and a file containing "/usr/FDlibs" to ld.so.conf.d directory. This does not work. For example, after restart,

Code: Select all

$ notecase  
command not found
$ /usr/FDapps/notecase
error while loading shared libs
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/ ; /usr/FDapps/notecase
>>success<<
EDIT Typo: /usr/lib64/ should read /usr/FDlibs/
Certainly my added apps will feel unwelcome like this. How can I get the augmented paths to be accepted at startup? Thanks in advance.
Last edited by Vincent17 on Sat Feb 24, 2018 2:39 pm, edited 3 times in total.

User avatar
bwich12
Forum Regular
Forum Regular
Posts: 182
Joined: Tue Jul 12, 2016 9:14 am

Re: adding to the path

#2

Post by bwich12 » Tue Feb 20, 2018 6:11 am

I had a similar problem and despite spending some time in /etc and its various subdirectories I was not able to identify the location where PATH is set. See this post, it helped me to set my bash/zsh config files:
https://unix.stackexchange.com/question ... th-to-path

User avatar
greywolf
Forum Regular
Forum Regular
Posts: 117
Joined: Sun Apr 20, 2008 9:06 pm

Re: adding to the path

#3

Post by greywolf » Tue Feb 20, 2018 8:31 am

Vincent17 wrote:Hello,
New user, settling in to MX-Linux (MX-17_January_x64). So far, so good :)
I want to import some apps from my other distro(s). In an attempt to avoid confusion, I have created /usr/FDlibs and /usr/FDapps. I want those directories in the paths, so I added PATH="$PATH:/usr/FDapps" immediately before "export PATH" in /etc/profile, and a file containing "/usr/FDlibs" to ld.so.conf.d directory. This does not work. For example, after restart,

Code: Select all

$ notecase  
command not found
$ /usr/FDapps/notecase
error while loading shared libs
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/ ; /usr/FDapps/notecase
>>success<<
Certainly my added apps will feel unwelcome like this. How can I get the augmented paths to be accepted at startup? Thanks in advance.
Try putting the "export" command above in your "/home/<yourusername>/.bashrc" file (without quotes).

greywolf.
It is about the Dragons - it was always about the Dragons!

Vincent17
Forum Novice
Forum  Novice
Posts: 73
Joined: Tue Feb 20, 2018 1:07 am

Re: adding to the path

#4

Post by Vincent17 » Tue Feb 20, 2018 1:30 pm

Thank you both. Adding

Code: Select all

PATH=$PATH:/usr/FDapps
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/FDlibs
export LD_LIBRARY_PATH
to my .bashrc file solves the problem.
I'd still be interested to know how to set these globally.

User avatar
Stevo
Developer
Posts: 20096
Joined: Fri Dec 15, 2006 8:07 pm

Re: adding to the path (solved)

#5

Post by Stevo » Tue Feb 20, 2018 3:11 pm

Maybe try setting those in /etc/environment?

Vincent17
Forum Novice
Forum  Novice
Posts: 73
Joined: Tue Feb 20, 2018 1:07 am

Re: adding to the path (solved)

#6

Post by Vincent17 » Tue Feb 20, 2018 7:17 pm

Stevo, thank you for the tip. I added
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/usr/FDapps
to my /etc/environment file (originally blank). On reboot, that was the path for root and user. No luck with library path, however. By the way, PATH=$PATH:/usr/FDapps does not work: I was not able to log in after a reboot. According to https://askubuntu.com/questions/866161/ ... ile#866169, "/etc/environment doesn't support including the old value of a variable automatically."

In my limited understanding so far:
/etc/environment: a path here is taken as the executable path for all users. Library path is ignored. [EDIT: wrong; see post #8]
/etc/rc.local: PATH or LD_LIBRARY_PATH exported from here applies to root only
/home/user/.bashrc: paths here apply to user only

path change in /etc/profile is not accepted.
additional path in a file in /etc/ld.so.conf.d/ is not accepted.
Last edited by Vincent17 on Sat Feb 24, 2018 1:47 pm, edited 3 times in total.

User avatar
bwich12
Forum Regular
Forum Regular
Posts: 182
Joined: Tue Jul 12, 2016 9:14 am

Re: adding to the path (solved)

#7

Post by bwich12 » Thu Feb 22, 2018 5:46 am

Stevo wrote:Maybe try setting those in /etc/environment?
I had already tried /etc/environment a while ago and it didn't work. I've rechecked now and found that it DOES work for root but not for normal users. (This is 64 bit MX-16.1.) I am amazed that Vincent17 got it to work with users.

@Vincent17: You are right in that this file is no script file. Supposedly it's only allowed to contain env definitions, ie XXX="YYY", and nothing else.

Vincent17
Forum Novice
Forum  Novice
Posts: 73
Joined: Tue Feb 20, 2018 1:07 am

Re: How to add to the path? (solved)

#8

Post by Vincent17 » Sat Feb 24, 2018 1:39 pm

I have everything working well, but my efforts to understand continue ::). Here's a correction to something I said above:
With this /etc/environment file,

Code: Select all

PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/sbin:/usr/sbin:/usr/test1
LD_LIBRARY_PATH=/usr/test2
after restart, test1 is in $PATH for root and user. test2 is in $LD_LIBRARY_PATH for root only!!
@bwich12, thanks for saying that I "got it to work". That makes it sound like I knew what I was doing!
MX-17_January_x64, full install

Post Reply

Return to “MX Help”