← Back to issue list

Base images store out-of-date apt package caches

View original Github issue

Metadata

Project
snapcraft
Number
#5879
Type
issue
State
open
Author
lengau
Labels
—
Created
Updated
Closed
—

Current evaluation

Stale APT metadata in cached LXD base images made newly published build-packages appear missing; craft-parts PR #1468 has since added a cache refresh before package marking.

Suggested action: close resolved

Reason: craft-parts PR #1468 was merged as commit c2836c97 and refreshes the APT cache before marking packages, with a regression test for stale-cache BuildPackageNotFound errors. This directly addresses the reported failure in the craft-parts dependency used by Snapcraft.

Evaluated by: mr-cal-bot

Impact: 55 Quick Win: 35 Complexity: 30 Confidence: 96 Actionability: 92

Issue body

### Bug Description This is pretty hard to reproduce and not specifically a bug in snapcraft (I put it here to keep it logged somewhere, as I'm unsure where the fix needs to go). @bepri encountered this today when trying to update a snapcraft.yaml file What happened is that his LXD base image used for snapcraft was created before noble-updates got a cargo-1.85 package, so adding it as a build-package caused craft-parts to fail when trying to install it (because there was no package with that name). Possible fixes: 0. Asynchronously run `apt update` on boot. 1. Always update before installing build-packages (up side: gets the latest packages. Down side: very slow) 2. If there are errors when installing build-packages, run update and try again before failing. This is also the sort of thing that could be worked around by a user if we implemented [a purge command](https://github.com/canonical/charmcraft/issues/1042) for all apps. That's not a fix, but it makes these types of bugs less annoying for users since they don't have to manually mess with the lxd project ### To Reproduce 1. Create a snapcraft.yaml file that adds your own PPA or similar. 2. Run `snapcraft pack` 3. Add a new package (that's not in the Ubuntu repos) to that PPA 4. Add that package to the `build-packages` for a part Expected behaviour: It installs that build package Actual behaviour: It complains that the package does not exist ### Environment n/a ### snapcraft.yaml ```yaml n/a ``` ### Relevant log output ```shell n/a ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 55
Quick Win: 35
Complexity: 30
Confidence: 96
Actionability: 92
close resolved Stale APT metadata in cached LXD base images made newly published build-packages appear missing; craft-parts PR #1468 has since added a cache refresh before package marking.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 11
Complexity: 40
Confidence: 70
Actionability: 60
needs triage Valid issue about stale apt caches in LXD base images causing build-package failures; open 304 days with no labels, assignee, or maintainer response
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22
Staleness: 70
Complexity: 55
Confidence: 55
Support Request: 10
needs triage LXD base images ship stale apt package caches, so new build-packages (e.g. from a PPA) fail to install. Filed by a maintainer as a design question; craft-parts now refreshes the apt cache before installing build-packages, but no maintainer has confirmed the issue is resolved.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 65
Confidence: 90
Support Request: 10
needs triage LXD base images used by snapcraft have stale apt caches, causing build-package installation failures when new packages appear in repos. Untriaged, no maintainer response after 8 months.
qwen3.6-35b-a3b-mtp-q6
Staleness: 80
Complexity: 65
Confidence: 75
Support Request: 10
needs triage LXD base images used by snapcraft have outdated apt caches, causing build-package installation failures. Unlabelled, no maintainer response, inactive for 230 days.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#1042 (confidence 100%)

    Explicitly cited as a potential purge-command workaround, but that proposal remains open and is not the underlying fix.

  • Likely Fixed By: canonical/craft-parts#1468 (confidence 98%)

    Merged commit c2836c97 refreshes APT metadata before package marking and tests the stale-cache failure.

Related issues

No related issues found above the similarity threshold.