← Back to issue list

Charmcraft snap thinks `/cache` is the cache directory if snapd doesn't set `SNAP_USER_COMMON`

View original Github issue

Metadata

Project
charmcraft
Number
#2012
Type
issue
State
open
Author
lengau
Labels
—
Created
Updated
Closed
—

Current evaluation

Charmcraft snap sets XDG_CACHE_HOME to $SNAP_USER_COMMON/cache; when snapd fails to set SNAP_USER_COMMON it becomes unwritable /cache. Maintainer-reported with reproducer, listed as known issue in 3.4 release notes.

Suggested action: keep open

Reason: Maintainer-authored bug with a concrete reproducer and explicit upstream references; it is acknowledged in docs/release-notes/charmcraft-3.4.rst as a known issue scheduled for a patch release. The snapcraft.yaml still contains the problematic XDG_CACHE_HOME: $SNAP_USER_COMMON/cache line, so the issue remains valid and open.

Evaluated by: mr-cal-bot

Impact: 45 Quick Win: 22 Complexity: 35 Confidence: 78 Actionability: 75

Issue body

### Bug Description If snapd [fails to set `$SNAP_USER_COMMON](https://bugs.launchpad.net/snapd/+bug/2090938) in the environment, charmcraft gets `/cache` as its [`$XDG_CACHE_HOME`](https://github.com/canonical/charmcraft/blob/c13f20ae65b6a4d3657dcdd30b2f606ccae86163/snap/snapcraft.yaml#L63), which is generally not writable. Related: - https://bugs.launchpad.net/snapd/+bug/2090938 - https://github.com/canonical/operator-workflows/issues/496 ### To Reproduce With snapd 2.66.1: ``` echo '$SNAP/bin/python -c "from charmcraft import env; print(env.get_host_shared_cache_path())"' | PATH=/snap/bin /usr/bin/snap run --shell charmcraft ``` ### Environment ``` $ snap version snap 2.66.1+25.04 snapd 2.66.1+25.04 series 16 ubuntu 25.04 kernel 6.11.0-9-generic ``` ### charmcraft.yaml ```yaml n/a ``` ### Relevant log output ```shell See: https://github.com/canonical/k8s-operator/actions/runs/12143320826/job/33859924966 ```

Evaluation history

Date Model Scores Action Summary
~deepseek/deepseek-pro-latest
Impact: 45
Quick Win: 22
Complexity: 35
Confidence: 78
Actionability: 75
keep open Charmcraft snap sets XDG_CACHE_HOME to $SNAP_USER_COMMON/cache; when snapd fails to set SNAP_USER_COMMON it becomes unwritable /cache. Maintainer-reported with reproducer, listed as known issue in 3.4 release notes.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 20
Complexity: 30
Confidence: 75
Actionability: 70
needs triage Charmcraft uses /cache as XDG_CACHE_HOME when snapd fails to set SNAP_USER_COMMON, causing write errors. Listed as a known issue in 3.4 release notes, blocked by upstream snapd bug.
qwen/qwen3.8-27b
Impact: 55
Quick Win: 33
Staleness: 60
Complexity: 40
Confidence: 75
Support Request: 5
keep open Charmcraft snap uses unwritable /cache as XDG_CACHE_HOME when snapd fails to set SNAP_USER_COMMON. Listed as a known issue in 3.4 release notes, still unfixed in current code, blocked by upstream snapd bug.
qwen/qwen3.6-35b-a3b
Staleness: 90
Complexity: 40
Confidence: 75
Support Request: 5
close stale Charmcraft snap defaults to unwritable /cache for XDG_CACHE_HOME when snapd fails to set SNAP_USER_COMMON. Open for ~1.6 years with no maintainer comments or labels.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 30
Confidence: 80
Support Request: 10
close stale Charmcraft snap defaults to /cache as XDG_CACHE_HOME when snapd omits SNAP_USER_COMMON. Unlabeled, zero comments, inactive for over a year.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 30
Confidence: 75
Support Request: 10
needs triage Charmcraft snap falls back to unwritable /cache for XDG_CACHE_HOME when snapd omits SNAP_USER_COMMON. Unlabelled, no maintainer comments, open for over 1.5 years.

Update history

No update history recorded yet.

Related work

  • Blocked By: snapd#2090938 (confidence 85%)

    Issue body links to the upstream snapd bug where SNAP_USER_COMMON is not set.

  • Related To: operator-workflows#496 (confidence 80%)

    Issue body explicitly lists this as related.

Related issues

No related issues found above the similarity threshold.