/snap/bin not on PATH for noninteractive ssh?

Dan Kegel dank at kegel.com
Wed Jan 4 19:56:34 UTC 2017

Does /etc/profile.d/apps-bin-path.sh not fire on noninteractive logins?
Evidently not:
$ ssh pi3 'echo $PATH'

Workaround #1: make it fire, dammit:

--- .bashrc.orig 2017-01-04 19:55:33.105726685 +0000
+++ .bashrc 2017-01-04 19:54:11.505653043 +0000
@@ -5,7 +5,9 @@
 # If not running interactively, don't do anything
 case $- in
     *i*) ;;
-      *) return;;
+      *) # Work around rsync snap PATH problem
+         . /etc/profile.d/apps-bin-path.sh
+         return;;

 # don't put duplicate lines or lines starting with space in the history.

Workaround #2: invoke rsync with --rsync-path.  Ugly.

Long story:

rsync doesn't seem to be provided in ubuntu core 16.  (It's in
classic, of course, but my world wants to be able to rsync
to a host, and I have not yet tried arranging to start a classic
environment automatically on boot and running an sshd.)

Creating a snap for rsync appears to be a piece of cake (yay!):

name: rsync
version: '3.1.1'
summary: fast, versatile, remote (and local) file-copying tool
description: |
 rsync is a fast and versatile file-copying tool which can copy locally
 and to/from a remote host. It offers many options to control its behavior,
 and its remote-update protocol can minimize network traffic to make
 transferring updates between machines fast and efficient.
 It is widely used for backups and mirroring and as an improved copy
 command for everyday use.

grade: stable
confinement: devmode
    plugin: nil
    - rsync
    command: rsync

Built and installed fine with

sudo classic
 sudo apt install snapcraft
sudo snap install --dangerous --devmode rsync_3.1.1_armhf.snap

But rsync to the machine still doesn't work,
since it expects rsync to be on PATH on the remote machine,
so you need one of the workarounds mentioned above.

End of story :-)

More information about the Snapcraft mailing list