Synology: Preserve your path

After DSM update ipkg/opkg stops working.

Always remember > Trust is good – verification is better

EDIT: apply to /root/.profile as well

Use your favorite ssh-client to connect to your diskstation as root

# ssh root@your-ds
# cp /etc/profile /etc/profile.org
# vi /etc/profile

If you mess up in vi Esc:q! and start again

Find the line reading

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

Place the cursor under the first slash ‘/’ and press i to insert text.

Modify path according to your environment ipkg or opkg

PATH=opt/bin:/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

PATH=/Apps/opt/bin:/Apps/opt/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin

Press Esc to go back to command mode and then press uppercase Z twice to save and close vi.

For good measure – verify the changes you made

# cat /etc/profile

Activate the path modification by sourcing profile

# source /etc/profile

During the next DSM update your profile will probably be replaced by the update process and to prevent that you can make the file readonly by doing

# chmod 0444 /etc/profile[/code]

Bash: persistent path

Bash: preserving path

Edit ~/.profile

#ruby gems
#remember - : = security-breach
export PATH=$PATH:~/.gem/ruby/2.2.0/bin
#node_gyp fordrer python2
export PYTHON=/usr/bin/python2

Source your profile to use immidiately

source ~/.profile

Logout / Login to verify your path

echo $PATH
echo $PYTHON