PATH should be adjusted for the snap when using `snap run --shell`

Bug #1780459 reported by Mike Pontillo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Triaged
Low
Unassigned

Bug Description

It's difficult to debug snaps if the $PATH doesn't adjust to what I would expect for the purposes of running binaries in the snap. For example, when debugging the MAAS snap:

    $ sudo snap run --shell maas

    # maas-region --help
    bash: maas-region: command not found

    # /snap/maas/current/bin/maas-region --help
    /usr/bin/env: 'python3': No such file or directory

It's pretty clear that the main reason for this is the $PATH isn't
updated to include bin/ directories internal to the snap (though shared
library paths may be incorrect too); when I use `snap run --shell` I
don't see any directories such as the following included:

    /snap/$SNAP/current/.../bin

I'm testing this on my old Xenial machine, so I'm not sure if it's
something that has been fixed in a more recent version of snapd.

    $ snap --version
    snap 2.33.1
    snapd 2.33.1
    series 16
    ubuntu 16.04
    kernel 4.4.0-128-generic

Revision history for this message
Paweł Stołowski (stolowski) wrote :

The problem with this is snapd makes no assumptions about paths in the snaps, snaps can have arbitrary structure of the filesystem; apps in the snaps work by providing exact paths to their binaries in the apps definitions (or having a wrapper script inside the snap). We could maybe blindly add bin and sbin of the snap to the PATH, but that's probably it, so I'm not sure it's of much value (and with whatever we do wrt `snap run`, snap-confine would need to be taught to accept).

Changed in snapd:
status: New → Triaged
importance: Undecided → Low
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.