← 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

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.

Suggested action: needs triage

Reason: No labels, no comments, and no maintainer acknowledgement in 285 days, so this has never been triaged. The core symptom appears addressed in craft-parts (commit c2836c97 'fix(deb): refresh apt cache before marking packages (#1468)' makes install_packages run apt-get update before marking, and snapcraft/parts/parts.py refreshes after installing package repositories), but the issue also raises unresolved design questions (async apt update on boot, retry-on-failure) and a workaround via a purge command (canonical/charmcraft#1042, still open and blocked by craft-providers#639), so it should not be auto-closed without a maintainer confirming the current behavior.

Impact: 50 Quick Win: 22.5 Staleness: 70 Complexity: 55 Confidence: 55 Support Request: 10

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
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22.5
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.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 45
Confidence: 85
Support Request: 15
needs triage Snapcraft base images retain stale apt caches, causing build-package installation failures when new packages appear in repositories. Proposed fixes include pre-install updates or retry logic. Open 209 days, no comments, awaiting triage.

Update history

No update history recorded yet.

Related work

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

    Explicitly referenced in the issue body as a workaround (purge command for all apps); that issue is open and blocked by craft-providers#639.

  • Likely Fixed By: craft-parts#1468 (confidence 60%)

    craft-parts commit c2836c97 'fix(deb): refresh apt cache before marking packages' makes Ubuntu.install_packages run refresh_packages_list() before apt-cache mark, which should let new build-packages be found; not explicitly linked to this issue.

Related issues

No related issues found above the similarity threshold.