Ok so I tried various settings for paramiko, but it seems that it is not able to open a "login" shell, which is required to load the ~/.profile
which in turn loads the Nix environment. We run on Ubuntu 20.04, but I assume it is not the only distro that behaves like this.
An alternative approach is to invoke bash through paramiko and configure it to open a login shell. See the example below where $SHELL
is /bin/bash
(Ubuntu default).
euriqa@red-chamber:/tmp/artiq$ ssh red-chamber-rpi 'openocd --version'
bash: openocd: command not found
euriqa@red-chamber:/tmp/artiq$ ssh red-chamber-rpi '$SHELL -l -c "openocd --version"'
Open On-Chip Debugger 0.10.0-snapshot (2021-05-17-15:29)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
A few questions @sb10q
- This can be inserted into the openocd command we send through paramiko. Do you think this is a reasonable solution?
- Should this become an option for
artiq_flash
, for example --bash
? And if so, should we use $SHELL
in the command or explicitly invoke /bin/bash
? (The -l -c
options might not work on other shell commands).
If we decide what to do, I can make a PR.