« Back to all recent discussions

NSA325 Problem with permanent PATH in PROFILE

hanschuetzhanschuetz Posts: 7  Junior Member
edited December 2018 in Questions

Hello everyone,

I want to extend my Profile with a new path.

I edited the profile (located at „/etc/“) with the vi-editor and saved it.

After a reboot all changes are missing.

What am I doing wrong?

Ist the profile in the right location?

I hope someone could help me.

Horst


#NAS_Dec_2018


Answers

  • MijzelfMijzelf Posts: 418  Advanced Warrior Member
    The problem is that /etc/ is on a ramdrive, and so your changes are lost on reboot.

    The easiest way around is to install the RandomTools package, which will inject code in /etc/profile to include the scripts in /i-data/sysvol/.PKG/RandomTools/etc/profile.d/

  • hanschuetzhanschuetz Posts: 7  Junior Member
    Hello Mijzelf,

    sorry for the delayed response. I was on holiday.

    First: I made a mistake. I have a NSA325 and not a NSA325 V2.

    I have a description for the download and installation of the RandomTools you talked about.   
    http://zyxel.nas-central.org/wiki/3rd_party_zypkgs#RandomTools

    I downloaded and installed the MetaRepository_20160513_arm_013.zpkg, but the
    file is not shown in the list. 

    What am I doing wrong?

    Horst 


     
  • MijzelfMijzelf Posts: 418  Advanced Warrior Member
    How did you install MetaRepository?
  • hanschuetzhanschuetz Posts: 7  Junior Member
    Hello Mijzelf,

    I downloaded the file 
    MetaRepository_20160513_arm_013.zpkg 
    and 
    RandomTools_20170220_arm_012.zpkg
    with Windows10.


    Then I copied the files to NSA325 admin to directory "zy-pkgs"


    After this, I pressed the button "Retrieve List from Internet", but the files are not listed.

  • MijzelfMijzelf Posts: 418  Advanced Warrior Member
  • hanschuetzhanschuetz Posts: 7  Junior Member
    Hello Mijzelf,
    many thanks. With this installation instructions I could solve the problem.
    I think, the problem was the file extention "txt" on the file web_prefix.

    The RandomTool is now installed.

    How can I get the path extention into the correct file (file name?) and where should the file be stored?

  • MijzelfMijzelf Posts: 418  Advanced Warrior Member
    As you can see /etc/profile contains now the snippet
        for file in $( ls /i-data/sysvol/.PKG/RandomTools/etc/profile.d/ )
        do
            full=/i-data/sysvol/.PKG/RandomTools/etc/profile.d/$file
            [ -x $full ] && . $full
        done
    So any executable file in /i-data/sysvol/.PKG/RandomTools/etc/profile.d/ will be sourced. 

    Create a file containing
    export PATH=<your-path>:${PATH}
    Make it executable, and you're done.




  • hanschuetzhanschuetz Posts: 7  Junior Member
    Hello Mijzelf,

    many thanks.

    In my NSA325 the directory "profile.d" is under 
    "/i-data/c25b59b4/.system/zy-pkgs/etc/"

    I hope, this is correct.

    Now I see the path extenion with "echo $PATH", but
    under "info.php" Environment Path is not displayed. 

    Why?

  • MijzelfMijzelf Posts: 418  Advanced Warrior Member
    I hope, this is correct.

    Yes it is. The path I gave is for firmware 5 models (NAS5xx, NAS326). A more generic path for a firmware 4 model is /i-data/md0/.system/zy-pkgs/etc/profile.d/, or /usr/local/zy-pkgs/etc/profile.d/, which points to the same directory. That c25b59b4 is unique for your box (and is the first 4 bytes of the GUID of the raid array.)

    Now I see the path extenion with "echo $PATH", but
    under "info.php" Environment Path is not displayed.

    Why?
    I guess you are looking at info.php in a webbrowser, and not on on a command line? In that case you are actually looking at the PATH variable of the php binary which is started by the webserver. In Linux a process inherits it's environment from it's parent, and apache doesn't have the right PATH.

    /etc/profile is only invoked by the shell. And actually, the injection of the profile.d/ directory is guarded by
    if [ -t 1 ]  ; then
    That checks if stdout is a real pipe, and so if it's running in a 'real shell'. So only interactive shells get the new PATH. If any shell would get it, it could break the firmware.
     



Sign In or Register to comment.