PATH/LD_LIBRARY_PATH not set in snapcraft 7.0
Metadata
Current evaluation
PATH/LD_LIBRARY_PATH regression in core22 snaps was fixed by PR #3758, merged as 6e8835dc8 and released in Snapcraft 7.1.
Resolution: closed resolved
Reason: PR #3758 was merged in commit 6e8835dc8, adding generated environment handling so snap library paths no longer require the snapcraft-runner wrapper. The maintainer confirmed the fix shipped in Snapcraft 7.1.
Evaluated by: mr-cal-bot
No scores available.
Issue body
Working on the core20->core22 migration for the maas-test-db snap I ran in an issue:
since the snapcraft-runner wrapper has been dropped, PATH and LD_LIBRARY_PATH doesn't seem to be set anymore to the correct values when running snap commands.
Thus, applications relying on libraries provided in the snap fail to find them.
As a workaround I added a copy of the snapcraft-runner wrapper in the snap, and ran commands with it (https://paste.ubuntu.com/p/vH6pCdzZNS/), which makes things work, but this is a regression from the previous behavior.
Also, somewhat related, is it expected for hooks to be run with the same environment as applications WRT PATH/LD_LIBARY_PATH?
Up to core20, we explicitly set the command-chain to snapcraft-runner to provide the env:
hooks:
install:
command-chain:
- snap/command-chain/snapcraft-runner
configure:
command-chain:
- snap/command-chain/snapcraft-runner
but it feels like this should be provided by snapcraft too?
All tests were performed with snapcraft 7.0.post24+gitbd286224 (7521), from latest/edge.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | PATH/LD_LIBRARY_PATH regression in core22 snaps was fixed by PR #3758, merged as 6e8835dc8 and released in Snapcraft 7.1. | |
| qwen/qwen3.8-27b | — | closed resolved | Closed as resolved: core22 snaps lost PATH/LD_LIBRARY_PATH after snapcraft-runner was dropped in 7.0. Fixed by PR #3758 (commit 6abfa6309, merged as 6e8835dc8) restoring LD_LIBRARY_PATH handling, released in snapcraft 7.1. | |
| stealth/space-bunny-alpha | — | closed resolved | Snapcraft restored core22 runtime environment handling; fixed by merged PR #3758 (commit 6abfa6309) and released in Snapcraft 7.1. | |
| stealth/space-bunny-alpha | — | closed stale | Closed as stale without a documented resolution after long inactivity. Later core22 environment work in #3758 (6abfa6309) is related but is not recorded as this report's resolution. | |
| qwen/qwen3.6-35b-a3b | — | — | Abandoned. The snapcraft 7.0 regression causing missing PATH and LD_LIBRARY_PATH variables remains unaddressed. No fix was merged or implemented. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as a reported regression in snapcraft 7.0 where PATH and LD_LIBRARY_PATH are unset after dropping the snapcraft-runner wrapper. A manual workaround was provided. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. The snapcraft 7.0 regression causing missing PATH and LD_LIBRARY_PATH variables remains unfixed and appears abandoned. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without comments, indicating the report was abandoned or superseded. The regression causing missing PATH and LD_LIBRARY_PATH after the snapcraft-runner wrapper removal was not addressed here. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
snapcore/snapcraft#3758
(confidence 100%)
The resolving PR added Snapcraft-managed LD_LIBRARY_PATH handling and was merged before the 7.1 release.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2011842 Incorrect default LD_LIBRARY_PATH | snapcraft (launchpad) | open | Core22+ Snapcraft emits unsupported shell expansion for LD_LIBRARY_PATH; the behavior is reproduced and remains blocked on snapd environment-list support. | |
| #1486623 LD_LIBRARY_PATH hardcoded at snap creation time -- RPATH | snapcraft (launchpad) | closed | Hardcoded LD_LIBRARY_PATH behavior was declared obsolete: a maintainer said in 2023 that it no longer applies to core22; discussion had moved to canonical/snapcraft#38. | |
| #1978859 Snapcraft doesn't set parts lib & include directories to CFLAGS/CXXFLAGS/LDFLAGS/LD_LIBRARY_PATH since Snapcraft 4.0 | snapcraft (launchpad) | closed | CMake stage discovery was fixed in Snapcraft 7.1.2 by PR #3217. Automatic LD_LIBRARY_PATH support was closed as intentional: core20+ requires users to set it explicitly. | |
| #1635 snap: remove leaking LD_LIBRARY_PATH | snapcraft | merged | Merged as da9181487: PR #1635 removed LD_LIBRARY_PATH leakage from snapcraft-classic, fixing LP #1723208 and preventing breakage on hosts such as Trusty. | |
| #4159 Environment stops working in snapcraft if defined | snapcraft | closed | PATH and LD_LIBRARY_PATH are now retained when top-level environment variables are defined for core22+, via merged PR #3741 (ec190695c). | |
| #1992557 snapcraft remote-build snapcraft.yaml validation too strict | snapcraft (launchpad) | closed | Strict validation in snapcraft remote-build rejected empty LD_LIBRARY_PATH for core22 snaps. Resolved by the new remote builder, which fixes the legacy core18/20 implementation bug. | |
| #1667148 Need a way to set LD_LIBRARY_PATH | snapcraft (launchpad) | closed | Closed as obsolete: current snapd supports setting top-level LD_LIBRARY_PATH to $SNAP/lib and expands snap variables correctly. | |
| #1570945 Add SNAP_LIBRARY_PATH to LD_LIBRARY_PATH | snapcraft (launchpad) | closed | Fixed in canonical/snapcraft#462, merged as commit a983e470b, by prepending SNAP_LIBRARY_PATH to generated LD_LIBRARY_PATH values so binaries use the OS snap's OpenGL libraries. |