← Back to issue list

classic snap are missing some env variables for reaching command name. (snap build, executing it fails)

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1670388
Type
issue
State
open
Author
~didrocks
Labels
amd64 apport-bug xenial
Created
Updated
Closed
—

Current evaluation

Classic snap wrappers omit snap-local PATH entries, so commands such as chuck-norris-cli can pass packaging but fail at runtime; the confirmed report remains open.

Suggested action: needs triage

Reason: The report was changed to Confirmed as affecting multiple users, and current metadata generation still intentionally omits PATH and LD_LIBRARY_PATH for classic confinement, while the model only documents that commands must use a relative path. Decide whether to require or validate `$SNAP`-relative commands in classic snaps, or support snap-local PATH lookup; no specific resolving commit was identified.

Evaluated by: mr-cal-bot

Impact: 65 Quick Win: 32 Complexity: 35 Confidence: 92 Actionability: 75

Issue body

1. Classic snap, where snapcraft.yaml can be found on lp:~didrocks/+junk/chuck-norris-webserver-classic. 2. Note that it declares and builds ok: apps:   node-service:     command: chuck-norris-app     daemon: simple     restart-condition: always   cli:     command: chuck-norris-cli 3. Building and installing, executing: $ chuck-norris-webserver-classic.cli /snap/chuck-norris-webserver-classic/x2/command-cli.wrapper: 2: exec: chuck-norris-cli: not found The issue is that indeed, the wrapper don't add $SNAP/bin/ to $PATH: #!/bin/sh exec "chuck-norris-cli" "$@" The non classic version works as it does add it to the path. Note that specifying "bin/chuck-norris-cli" instead of just "chuck-norris-cli" works in classic and generate something like: exec "$SNAP/bin/node" "$SNAP/bin/chuck-norris-cli" "$@" 4. Another side effect is that it's not the snap node version which is used in that case. The script declares "#!/usr/bin/env node" resolving to system one. #!/bin/sh exec "chuck-norris-cli" "$@" -> will resolve to the system one, while if specified as bin/chuck-norris-cli: exec "$SNAP/bin/node" "$SNAP/bin/chuck-norris-cli" "$@" I would expect in both case to prefer the snap version. ProblemType: Bug DistroRelease: Ubuntu 16.04 Package: snapcraft 2.27.1 [modified: usr/lib/python3/dist-packages/snapcraft/_baseplugin.py usr/lib/python3/dist-packages/snapcraft/plugins/python.py] ProcVersionSignature: Ubuntu 4.4.0-64.85-generic 4.4.44 Uname: Linux 4.4.0-64-generic x86_64 NonfreeKernelModules: zfs zunicode zcommon znvpair zavl ApportVersion: 2.20.1-0ubuntu2.5 Architecture: amd64 CurrentDesktop: Unity Date: Mon Mar 6 16:06:59 2017 InstallationDate: Installed on 2012-05-28 (1743 days ago) InstallationMedia: Ubuntu 12.04 LTS "Precise Pangolin" - Release amd64 (20120425) PackageArchitecture: all SourcePackage: snapcraft UpgradeStatus: Upgraded to xenial on 2014-10-31 (857 days ago)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 65
Quick Win: 32
Complexity: 35
Confidence: 92
Actionability: 75
needs triage Classic snap wrappers omit snap-local PATH entries, so commands such as chuck-norris-cli can pass packaging but fail at runtime; the confirmed report remains open.
stealth/space-bunny-alpha
Impact: 58
Quick Win: 30
Complexity: 42
Confidence: 90
Actionability: 88
close resolved Classic snap wrappers fail to find snap-local binaries by bare name; a later Snapcraft runner commit addresses the confirmed PATH bug.
qwen/qwen3.6-35b-a3b
Impact: 10
Quick Win: 6
Complexity: 20
Confidence: 85
Actionability: 70
close not a bug Classic snap command wrappers missing $SNAP/bin in PATH, causing command execution failures. Reported in 2017 for snapcraft 2.27.1.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 20
Staleness: 95
Complexity: 55
Confidence: 65
Support Request: 10
close stale Classic-confinement snapcraft 2.27.1 app wrappers omit $SNAP/bin from PATH, so bare command names fail at runtime and shebangs resolve to system binaries instead of snap ones. Reported 2017, zero comments; later addressed in snapcraft via snapcraft-runner workaround (#2889).
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 40
Confidence: 90
Support Request: 10
close stale Classic snap command wrapper fails to include $SNAP/bin in PATH, causing execution failures. Reported in 2017 for snapcraft 2.27.1 on Ubuntu 16.04; remains unaddressed and outdated.
qwen/qwen3.6-35b-a3b
Staleness: 98
Complexity: 45
Confidence: 85
Support Request: 10
close stale Classic snaps fail to execute commands due to missing $SNAP/bin/ in wrapper PATH, causing execution errors and fallback to system binaries. Unaddressed since 2017.
qwen3.6-35b-a3b-mtp-q6
Staleness: 98
Complexity: 45
Confidence: 95
Support Request: 15
close stale Classic snap wrapper generation bug on Ubuntu 16.04 where $SNAP/bin/ is not added to PATH, causing command execution failures. Issue is over 9 years old and targets an EOL distribution.

Update history

Date Change
created

Related work

  • Related To: snapcraft (launchpad)#1681861 (confidence 95%)

    Reports the same classic wrapper problem and documents relative `$SNAP/bin/` command paths.

Related issues

Issue Project State Summary Similarity
#1681722 classic snaps cannot find stage packages in $PATH snapcraft (launchpad) open Classic snaps cannot resolve executables staged in payload bin directories because Snapcraft omits those directories from PATH; this longstanding request remains untriaged.
73%
#1681861 classic snaps recurse snapcraft (launchpad) open Classic PATH recursion was addressed by commit 343ac2862, which added the snapcraft-runner workaround; current metadata tests still expect that runner in command chains.
71%