NSA325 Problem with permanent PATH in PROFILE

hanschuetz
hanschuetz Posts: 7  Freshman Member
edited December 2018 in Personal Cloud Storage

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


All Replies

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    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/

  • hanschuetz
    hanschuetz Posts: 7  Freshman 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 


     
  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    How did you install MetaRepository?
  • hanschuetz
    hanschuetz Posts: 7  Freshman 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.

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
  • hanschuetz
    hanschuetz Posts: 7  Freshman 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?

  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    As you can see /etc/profile contains now the snippet
    &nbsp;&nbsp;&nbsp; for file in $( ls /i-data/sysvol/.PKG/RandomTools/etc/profile.d/ )<br>&nbsp;&nbsp;&nbsp; do<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; full=/i-data/sysvol/.PKG/RandomTools/etc/profile.d/$file<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; [ -x $full ] && . $full<br>&nbsp;&nbsp;&nbsp; done<br>
    So any executable file in /i-data/sysvol/.PKG/RandomTools/etc/profile.d/ will be sourced. 

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




  • hanschuetz
    hanschuetz Posts: 7  Freshman 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?


  • Mijzelf
    Mijzelf Posts: 2,598  Guru Member
    First Anniversary 10 Comments Friend Collector First Answer
    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
    <div>if [ -t 1 ]  ; then<br></div><div></div>
    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.
     



Consumer Product Help Center