Package: reportbug Version: 13.0.2 Severity: important X-Debbugs-Cc: pravors...@meta.ua
When running snap-installed commands (such as "microk8s") via SSH in a non-login shell context, the SNAP-provided /snap/bin path is not added to the PATH environment. This leads to an error such as: ssh root@server -C "microk8s version" bash: microk8s --version: No such file or directory Similarly, the following command also fails: ssh root@server -C "bash -c 'microk8s version'" However, running through a login shell works: ssh root@server -C "bash -l -c 'microk8s version'" MicroK8s v1.29.13 revision 7598 Additionally, environment checks reveal that /snap/bin is missing in a non-login SSH context: ssh root@server -C "printenv" PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Whereas a login shell includes /snap/bin: ssh root@server -C "bash -l -c printenv" PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin Interestingly, systemd’s environment generator does produce the correct PATH (including /snap/bin): ssh root@server -C "/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator" PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin The file /usr/lib/environment.d/990-snapd.conf is present and correctly sets PATH, despite this, the environment is not applied for non-login SSH commands. PATH=$PATH:/snap/bin Impact: This leads to complications in automated tools (e.g. Ansible’s "command" module), since /snap/bin is not found without manually modifying global /etc/environment or forcing a login shell. Steps to reproduce: 1. Install snapd and a snap-based tool (e.g. microk8s). 2. Attempt to run the snap command via a non-login SSH command: ssh root@server -C "microk8s version" 3. Observe "No such file or directory" error. Expected result: /snap/bin is in PATH by default for non-interactive SSH sessions, allowing direct usage of snap-installed commands. -- Package-specific info: ** Environment settings: EDITOR=editor INTERFACE=text ** /home/user/.reportbugrc: reportbug_version "13.0.2" mode advanced ui text realname "Andrii Pravorskyi" email "pravors...@meta.ua" no-cc list-cc-me smtphost reportbug.debian.org -- System Information: Debian Release: trixie/sid APT prefers testing-debug APT policy: (500, 'testing-debug'), (500, 'testing'), (50, 'unstable') Architecture: amd64 (x86_64) Kernel: Linux 6.12.10-amd64 (SMP w/16 CPU threads; PREEMPT) Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE Locale: LANG=uk_UA.UTF-8, LC_CTYPE=uk_UA.UTF-8 (charmap=UTF-8), LANGUAGE not set Shell: /bin/sh linked to /usr/bin/dash Init: systemd (via /run/systemd/system) LSM: AppArmor: enabled -- no debconf information