← Back to issue list

apt package cache marks packages that don't exist

View original Github issue

Metadata

Project
craft-parts
Number
#647
Type
issue
State
open
Author
mr-cal
Labels
Created
Updated
Closed

Current evaluation

craft-parts marks a stage-package then fails with PackageNotFound, suspected stale apt cache or python-apt misuse; unreproducible. Maintainer noted in Feb 2026 it could be solved by PR #1446 (merged two-pass mark_packages fix).

Suggested action: keep open

Reason: The reporter could not reproduce the failure, and the maintainer's only substantive comment (2026-02-10) links PR #1446, which was merged (cf118b5f) and reworks mark_packages into a two-pass candidate-then-mark flow. However, the reported symptom (PackageNotFound for libpython3.11-stdlib:arm64 after apt-get update) is not clearly the same as #1446's versioned-interdependency bug, so the fix is unconfirmed and the issue should stay open pending verification.

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

Issue body

### Bug Description craft-parts marks a package to install then fails find the package. Possible problems could be that the cache is stale, `apt update` needs to be run, or there is a problem with how the `python-apt` library is used. ### To Reproduce I have not been able to reproduce this failure, perhaps it depends on the age or condition of the instance or base instance. See more details on the reproducer [here](https://github.com/snapcore/snapcraft/issues/4542) ### part yaml ```shell parts: netplan: plugin: nil stage-packages: - libnetplan0:arm64 ``` ### Relevant log output ```shell 24-01-24 21:06:41.591 Fetching stage-packages 2024-01-24 21:06:41.591 Requested stage-packages: ['libnetplan0:arm64', 'libpython3-stdlib:arm64', 'libpython3.11-minimal:arm64', 'libpython3.11-stdlib:arm64', 'netplan.io:arm64', 'python3-dbus:arm64', 'python3-minimal:arm64', 'python3-netifaces:arm64', 'python3-yaml:arm64', 'python3.11-minimal:arm64', 'python3:arm64'] 2024-01-24 21:06:41.691 Executing: ['apt-get', 'update'] 2024-01-24 21:06:42.088 :: Hit:1 http://archive.ubuntu.com/ubuntu mantic InRelease 2024-01-24 21:06:42.094 :: Hit:2 http://archive.ubuntu.com/ubuntu mantic-updates InRelease 2024-01-24 21:06:42.114 :: Hit:3 http://archive.ubuntu.com/ubuntu mantic-backports InRelease 2024-01-24 21:06:42.235 :: Hit:4 http://security.ubuntu.com/ubuntu mantic-security InRelease 2024-01-24 21:06:45.560 :: Reading package lists... 2024-01-24 21:06:46.370 Marking libpython3.11-stdlib:arm64 (and its dependencies) to be fetched 2024-01-24 21:06:46.374 Stage package not found in part 'netplan': libpython3.11-stdlib:arm64. 2024-01-24 21:06:46.384 Traceback (most recent call last): 2024-01-24 21:06:46.384 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/executor/part_handler.py", line 897, in _fetch_stage_packages 2024-01-24 21:06:46.385 fetched_packages = packages.Repository.fetch_stage_packages( 2024-01-24 21:06:46.385 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/deb.py", line 602, in fetch_stage_packages 2024-01-24 21:06:46.385 return cls._fetch_stage_debs( # type: ignore[no-any-return] 2024-01-24 21:06:46.385 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/deb.py", line 262, in wrapped 2024-01-24 21:06:46.385 return method(*args, **kwargs) 2024-01-24 21:06:46.385 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/deb.py", line 647, in _fetch_stage_debs 2024-01-24 21:06:46.386 apt_cache.mark_packages(set(package_names)) 2024-01-24 21:06:46.386 File "/snap/snapcraft/10445/lib/python3.10/site-packages/craft_parts/packages/apt_cache.py", line 309, in mark_packages 2024-01-24 21:06:46.386 raise errors.PackageNotFound(name_arch) 2024-01-24 21:06:46.386 craft_parts.packages.errors.PackageNotFound: Package no ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 22.5
Staleness: 40
Complexity: 55
Confidence: 60
Support Request: 10
keep open craft-parts marks a stage-package then fails with PackageNotFound, suspected stale apt cache or python-apt misuse; unreproducible. Maintainer noted in Feb 2026 it could be solved by PR #1446 (merged two-pass mark_packages fix).
qwen/qwen3.6-35b-a3b
Staleness: 80
Complexity: 45
Confidence: 75
Support Request: 5
needs triage craft-parts marks non-existent packages for installation, triggering a PackageNotFound error. Open for over two years with no labels or maintainer triage, awaiting review.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 45
Confidence: 85
Support Request: 10
needs triage Bug where apt cache marks non-existent packages causing fetch failures. Unlabelled and awaiting maintainer triage despite recent author comment referencing a potential fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 60
Confidence: 85
Support Request: 10
needs triage craft-parts incorrectly marks non-existent packages for installation due to a stale apt cache or python-apt handling issue. Currently open, with the maintainer suggesting PR #1446 may resolve it.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: craft-parts#1446 (confidence 55%)

    Maintainer comment 'Could be solved by #1446'; PR merged as cf118b5f fixing mark_packages candidate handling, but exact symptom match is unconfirmed.

  • Related To: craft-parts#1468 (confidence 45%)

    Commit c2836c97 'fix(deb): refresh apt cache before marking packages' addresses the stale-cache hypothesis raised in the issue body.

Related issues

Issue Project State Summary Similarity
#3528 apt cache: improve error handling when packages do not have candidates available (CRAFT-136) (CRAFT-218) snapcraft merged Merged apt cache error handling that adds null checks for package candidates, preventing crashes when versions are unavailable. The change raises a clear PackageNotFoundError and optimizes unmarking logic, resolving multiple internal bug reports.
71%