← Back to issue list

Snap: Snapcraft currently relies on `libapt` during configure

View original Github issue

Metadata

Project
snapcraft
Number
#5146
Type
issue
State
open
Author
Meulengracht
Labels
Status: Needs information
Created
Updated
Closed

Current evaluation

Snapcraft's configure hook failed to install because importing snapcraft transitively imported apt (via snapcraft_legacy), requiring libapt from the base snap. Maintainers confirmed libapt will be removed in core26; the legacy apt-importing code path has since been removed from the codebase.

Suggested action: keep open

Reason: Maintainers actively engaged as recently as 215 days ago (alfonsosanchezbeato confirmed core26 still plans to remove libapt), and the issue is triaged with a 'Needs information' label. The specific top-level apt import from snapcraft_legacy appears removed (no 'import apt' matches, snapcraft_legacy deleted in commits ffb164b7a/995f0a3bc), but the underlying requirement that the configure hook work without base libapt on core26 remains unverified, so it should stay open pending confirmation.

Impact: 55 Quick Win: 24.75 Staleness: 45 Complexity: 55 Confidence: 60 Support Request: 10

Issue body

### Bug Description Snapcraft currently relies on `libapt` being available from the base snap, which it has been by accident, we corrected this recently (on core22 and core24 that are in beta/candidate) and then it was reported that Snapcraft now fails to install due to its configure hook importing `apt` which unfortunately relies on `libapt` being available. Furthermore this library has just been taking up space in the base. We think this is unfortunate due to the fact that snaps are supposed to work in a snap-only system, where `apt` might not even be part of the equation. Right now it may not be a huge problem, but as we move towards a more snap-focused future, this seems very odd, and we would like for Snapcraft to be able to install on a system where `apt` is not available in the base snap. ### To Reproduce ``` $ sudo snap install core22 --candidate $ sudo snap install snapcraft --classic ``` ### Environment Ubuntu systems that use snap ### snapcraft.yaml ```yaml N/A ``` ### Relevant log output ```shell $ sudo snap install --classic snapcraft error: cannot perform the following tasks: - Run configure hook of "snapcraft" snap if present (run hook "configure": ----- Traceback (most recent call last): File "/snap/snapcraft/12961/snap/hooks/configure", line 7, in <module> from snapcraft.snap_config import SnapConfig File "/snap/snapcraft/current/lib/python3.10/site-packages/snapcraft/__init__.py", line 23, in <module> import snapcraft.sources # noqa: F401 File "/snap/snapcraft/current/lib/python3.10/site-packages/snapcraft/sources.py", line 22, in <module> from snapcraft_legacy.sources import get File "/snap/snapcraft/current/lib/python3.10/site-packages/snapcraft_legacy/__init__.py", line 340, in <module> from snapcraft_legacy.internal import repo # noqa File "/snap/snapcraft/current/lib/python3.10/site-packages/snapcraft_legacy/internal/repo/__init__.py", line 27, in <module> from ._deb import Ubuntu # noqa File "/snap/snapcraft/current/lib/python3.10/site-packages/snapcraft_legacy/internal/repo/_deb.py", line 39, in <module> from .apt_cache import AptCache File "/snap/snapcraft/current/lib/python3.10/site-packages/snapcraft_legacy/internal/repo/apt_cache.py", line 25, in <module> import apt File "/snap/snapcraft/current/lib/python3.10/site-packages/apt/__init__.py", line 23, in <module> import apt_pkg ImportError: /snap/core22/current/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by /lib/x86_64-linux-gnu/libapt-pkg.so.6.0) -----) ``` ``` ### Additional context Original bug report in core-base: https://github.com/canonical/core-base/issues/283

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 55
Quick Win: 24.75
Staleness: 45
Complexity: 55
Confidence: 60
Support Request: 10
keep open Snapcraft's configure hook failed to install because importing snapcraft transitively imported apt (via snapcraft_legacy), requiring libapt from the base snap. Maintainers confirmed libapt will be removed in core26; the legacy apt-importing code path has since been removed from the codebase.
qwen/qwen3.8-27b
Impact: 60
Quick Win: 36.0
Staleness: 25
Complexity: 40
Confidence: 70
Support Request: 10
keep open Snapcraft's configure hook imports snapcraft, which pulled in snapcraft_legacy and apt/libapt, breaking installation on bases without libapt (core22/24/26). Maintainers confirmed libapt will be removed in core26; snapcraft_legacy has since been removed from the codebase, likely resolving the import chain.
qwen/qwen3.6-35b-a3b
Staleness: 65
Complexity: 75
Confidence: 85
Support Request: 0
keep open Tracks snapcraft's failure to install due to importing libapt during its configure hook, which conflicts with base snaps removing the library. Maintainers are aware and tracking the dependency conflict against core26 plans.
qwen3.6-35b-a3b-mtp-q6
Staleness: 50
Complexity: 65
Confidence: 85
Support Request: 10
keep open Snapcraft configure hook fails due to top-level apt imports, which are being removed from Ubuntu base snaps. Currently under developer discussion with confirmed plans to remove libapt in core26, awaiting a code fix.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 50
Confidence: 85
Support Request: 10
keep open Snapcraft configure hook fails due to top-level libapt imports, breaking installation on base snaps without it. Core26 will permanently remove libapt. Issue needs information and awaits a fix to defer imports for snap-only compatibility.

Update history

No update history recorded yet.

Related issues

No related issues found above the similarity threshold.