Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snap: Snapcraft currently relies on libapt during configure #5146

Open
Meulengracht opened this issue Nov 18, 2024 · 6 comments
Open

Snap: Snapcraft currently relies on libapt during configure #5146

Meulengracht opened this issue Nov 18, 2024 · 6 comments
Assignees

Comments

@Meulengracht
Copy link
Member

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

N/A

Relevant log output

$ 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
@tigarmo
Copy link
Contributor

tigarmo commented Nov 18, 2024

The fact that libapt is no longer provided by the base is kind of a big deal (for us) - I expect that this configure error is just the first of the issues. Do you have a reference (issue, PR, etc) for this removal?

@alfonsosanchezbeato
Copy link
Member

We have reverted to put back libapt, but ftr it won't be there in core26, it was actually only due to a mistake that it was present in core20 and onwards.

@alfonsosanchezbeato
Copy link
Member

Also, possibly you want to use libapt from the system in which you are handling packages, which might not match snpacraft's base.

@tigarmo
Copy link
Contributor

tigarmo commented Nov 18, 2024

We have reverted to put back libapt, but ftr it won't be there in core26, it was actually only due to a mistake that it was present in core20 and onwards.

Thanks for the heads-up!

I think the configure error is a symptom of top-level importing; maybe we can address that specifically.

@lengau
Copy link
Contributor

lengau commented Nov 18, 2024

@Meulengracht and @alfonsosanchezbeato - do you have revision numbers of the core22 and core24 snaps (for amd64) that don't have libapt for us to experiment with?

@alfonsosanchezbeato
Copy link
Member

@Meulengracht and @alfonsosanchezbeato - do you have revision numbers of the core22 and core24 snaps (for amd64) that don't have libapt for us to experiment with?

Try revision 1690, it is not released now but you should be able to download and install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants