Random "Could not find a required package in 'build-packages'" errors
Metadata
Current evaluation
Fixed by merged canonical/snapcraft#3099 (commit bcc1a08fa), ensuring the package cache is refreshed when required build packages are unavailable.
Resolution: closed resolved
Reason: PR #3099 was merged as commit bcc1a08fa and changed repository refresh behavior so missing build packages trigger a cache refresh, addressing the skipped apt-get update.
Evaluated by: mr-cal-bot
No scores available.
Issue body
@kenvandine had it yesterday and it happened for me just now - apparently randomly, Snapcraft dies complaining about missing packages. It's a different package every time, too.
> Could not find a required package in 'build-packages': g++
For now, a `snapcraft clean` helped.
I've managed to grab a debug log, attached.
===
After a closer look, this is due to the fact that `apt-get update` never ran in the instance (as it failed early).
To reproduce:
$ snap refresh multipass --edge
$ snap refresh snapcraft --stable
$ snapcraft
# fails with ProviderFileCopyError
$ snap refresh snapcraft --candidate
$ snapcraft
# fails with Could not find a required package in 'build-packages':
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged canonical/snapcraft#3099 (commit bcc1a08fa), ensuring the package cache is refreshed when required build packages are unavailable. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR snapcore/snapcraft#3099 (commit bcc1a08fa), which refreshes the package cache when required build packages are missing after an earlier provider failure. | |
| stealth/space-bunny-alpha | — | closed not a bug | Closed as an environment-related failure: apt-get update exited early, leaving build-package metadata unavailable. Running snapcraft clean was a workaround; no code fix was applied. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after tracing the error to a failed early apt-get update. snapcraft clean serves as a workaround. No code fix was applied. | |
| qwen/qwen3.6-35b-a3b | — | — | Root cause identified as early apt-get update failures skipping package installation. Closed without resolution, likely abandoned. Workaround remains snapcraft clean. |
Update history
| Date | Change |
|---|---|
| created |
Related work
-
Likely Fixed By:
canonical/snapcraft#3099
(confidence 100%)
Merged fix titled "repo: always refresh cache when build packages are required".
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3099 repo: always refresh cache when build packages are required | snapcraft | merged | Merged #3099 in commit bcc1a08fa, ensuring Snapcraft refreshes the package cache whenever a requested build package is not already installed. | |
| #1547672 invalid package name in "build-packages" message is not very helpful | snapcraft (launchpad) | closed | Fixed by merged ubuntu-core/snapcraft PR #355 (f4b75f95a), which updated build-packages errors to name the invalid package. |