As I mentioned in this other thread: Using update module as a rootfs-image
I am currently experimenting with Mender 2.6 and noticed a strange PATH issue while using the shell provided by mender-connect. This is with Yocto, meta-mender branch dunfell.
When I run some Mender CLI commands through the remote shell, I get errors such as these:
root@osu-00e0709d97ea:~# mender show-artifact
ERRO[0000] Failed to read the current active partition: exec: "mount": executable file not found in $PATH
dev-setup-offline-1.0.13
root@osu-00e0709d97ea:~# mender send-inventory
ERRO[0000] failed to force updateCheck: getMenderDaemonPID: Failed to run systemctl
root@osu-00e0709d97ea:~#
But I can launch “mount” and “systemctl” manually in the same shell:
root@osu-00e0709d97ea:~# mount
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
[...]
root@osu-00e0709d97ea:~# systemctl --help
systemctl [OPTIONS...] COMMAND ...
[...]
Also, the same Mender CLI commands issued on a terminal on the device (or by SSH) work fine:
root@osu-00e0709d97ea:~# mender show-artifact
dev-setup-offline-1.0.13
root@osu-00e0709d97ea:~# mender send-inventory
root@osu-00e0709d97ea:~#
After some experimentation, I noticed that PATH is set (which is why I can run mount and others), but it is not exported (doesn’t show when you type “env” in a remote shell, but does when using a local shell). Exporting PATH fixes the issue for this terminal session (the issue comes back if the remote shell is closed and reopened):
root@osu-00e0709d97ea:~# echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
root@osu-00e0709d97ea:~# export PATH
root@osu-00e0709d97ea:~# mender show-artifact
dev-setup-offline-1.0.13
root@osu-00e0709d97ea:~# mender send-inventory
root@osu-00e0709d97ea:~#
Is there something missing in the mender-connect client configuration, or systemd service?