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

Snapcraft-rocks fails when executing craftctl #33

Open
cmatsuoka opened this issue Apr 8, 2024 · 1 comment
Open

Snapcraft-rocks fails when executing craftctl #33

cmatsuoka opened this issue Apr 8, 2024 · 1 comment
Assignees
Labels
bug Something isn't working triaged

Comments

@cmatsuoka
Copy link
Contributor

An attempt to build https://github.com/cmatsuoka/mpg123-snap using Snapcraft-rocks 8_core22 failed with the following output:

$ docker run -it -v $(pwd):/project ghcr.io/canonical/snapcraft:8_core22 pack
2024-04-08T15:50:44.716Z [pebble] Started daemon.
2024-04-08T15:50:44.745Z [pebble] POST /v1/services 3.122726ms 202
2024-04-08T15:50:44.746Z [pebble] Started default services with change 1.
2024-04-08T15:50:44.748Z [pebble] Service "snapcraft" starting: /bin/run-snapcraft.sh [ pack ]
2024-04-08T15:50:45.259Z [snapcraft] 
2024-04-08T15:50:45.260Z [snapcraft] WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
2024-04-08T15:50:45.261Z [snapcraft] 
2024-04-08T15:50:45.737Z [snapcraft] Get:1 http://archive.ubuntu.com/ubuntu jammy InRelease [270 kB]
2024-04-08T15:50:45.898Z [snapcraft] Get:2 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
2024-04-08T15:50:46.416Z [snapcraft] Get:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease [119 kB]
2024-04-08T15:50:46.577Z [snapcraft] Get:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease [109 kB]
2024-04-08T15:50:46.736Z [snapcraft] Get:5 http://archive.ubuntu.com/ubuntu jammy/restricted amd64 Packages [164 kB]
2024-04-08T15:50:46.770Z [snapcraft] Get:6 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [1641 kB]
2024-04-08T15:50:46.811Z [snapcraft] Get:7 http://archive.ubuntu.com/ubuntu jammy/main amd64 Packages [1792 kB]
2024-04-08T15:50:47.140Z [snapcraft] Get:8 http://archive.ubuntu.com/ubuntu jammy/multiverse amd64 Packages [266 kB]
2024-04-08T15:50:47.147Z [snapcraft] Get:9 http://archive.ubuntu.com/ubuntu jammy/universe amd64 Packages [17.5 MB]
2024-04-08T15:50:47.410Z [snapcraft] Get:10 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [44.6 kB]
2024-04-08T15:50:47.412Z [snapcraft] Get:11 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [2067 kB]
2024-04-08T15:50:47.566Z [snapcraft] Get:12 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [1081 kB]
2024-04-08T15:50:47.982Z [snapcraft] Get:13 http://archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 Packages [61.2 kB]
2024-04-08T15:50:47.983Z [snapcraft] Get:14 http://archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [1966 kB]
2024-04-08T15:50:48.046Z [snapcraft] Get:15 http://archive.ubuntu.com/ubuntu jammy-updates/restricted amd64 Packages [2161 kB]
2024-04-08T15:50:48.148Z [snapcraft] Get:16 http://archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [1357 kB]
2024-04-08T15:50:48.212Z [snapcraft] Get:17 http://archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [33.3 kB]
2024-04-08T15:50:48.213Z [snapcraft] Get:18 http://archive.ubuntu.com/ubuntu jammy-backports/main amd64 Packages [80.9 kB]
2024-04-08T15:50:48.728Z [snapcraft] Fetched 30.8 MB in 3s (9380 kB/s)
2024-04-08T15:50:48.728Z [snapcraft] Reading package lists...
2024-04-08T15:50:49.545Z [snapcraft] Building dependency tree...
2024-04-08T15:50:49.695Z [snapcraft] Reading state information...
2024-04-08T15:50:49.714Z [snapcraft] 12 packages can be upgraded. Run 'apt list --upgradable' to see them.
2024-04-08T15:50:55.841Z [snapcraft] Starting Snapcraft 8.0.5
2024-04-08T15:50:55.841Z [snapcraft] Logging execution to '/root/.local/state/snapcraft/log/snapcraft-20240408-155055.839046.log'
2024-04-08T15:50:55.866Z [snapcraft] Running on amd64 for amd64
2024-04-08T15:50:55.866Z [snapcraft] Initializing parts lifecycle
2024-04-08T15:50:55.896Z [snapcraft] Installing build-packages
2024-04-08T15:54:26.511Z [snapcraft] The following snaps are required but not installed as the application is running inside docker or podman container: core22.
2024-04-08T15:54:26.511Z [snapcraft] Please ensure the environment is properly setup before continuing.
2024-04-08T15:54:26.511Z [snapcraft] Ignore this message if the appropriate measures have already been taken.
2024-04-08T15:54:26.513Z [snapcraft] Pulling mpg123
2024-04-08T15:54:26.526Z [snapcraft] Fetching stage-packages
2024-04-08T15:54:37.508Z [snapcraft] :: + craftctl default
2024-04-08T15:54:37.534Z [snapcraft] :: Traceback (most recent call last):
2024-04-08T15:54:37.534Z [snapcraft] ::   File "/usr/libexec/snapcraft/craftctl", line 5, in <module>
2024-04-08T15:54:37.535Z [snapcraft] ::     from craft_parts.ctl import main
2024-04-08T15:54:37.535Z [snapcraft] :: ModuleNotFoundError: No module named 'craft_parts'
2024-04-08T15:54:37.709Z [snapcraft] 'override-pull' in part 'mpg123' failed with code 1.
2024-04-08T15:54:37.709Z [snapcraft] Review the scriptlet and make sure it's correct.
2024-04-08T15:54:37.741Z [snapcraft] Full execution log: '/root/.local/state/snapcraft/log/snapcraft-20240408-155055.839046.log'
2024-04-08T15:54:37.936Z [pebble] Service "snapcraft" stopped unexpectedly with code 1
2024-04-08T15:54:37.936Z [pebble] Service "snapcraft" on-failure action is "shutdown", triggering failure shutdown
2024-04-08T15:54:37.936Z [pebble] Server exiting!
@cmatsuoka cmatsuoka added the bug Something isn't working label Apr 8, 2024
tigarmo added a commit that referenced this issue May 9, 2024
This fixes an issue where calling "craftctl" in a scriptlet would fail with a
ModuleNotFoundError for craft_parts. This happened when the snapcraft project
included build-packages that pulled in libpython3.10-minimal.

The reason that this failed is because in Rockcraft the `python` plugin (used
to build the `snapcraft` part) works by adding a custom "sitecustomize.py" in
`/usr/lib/python3.10/` to add the part's Python libraries to the Python path.
This is fine unless the `libpython3.10-minimal` package is explicitly installed
later on a container created from the rock, because that package has its own
sitecustomize.py file which overwrites Rockcraft's.

The solution is to make apt and dpkg aware that all of these Python-related
packages are already installed in the rock, by adding the dependency explicitly
as an `overlay-package`. This also has the extra beneficial side-effect of
improving installation of build-packages because dpkg/apt are aware of the
installed packages and don't have to download and re-install them unnecessarily.

Fixes #33.
tigarmo added a commit that referenced this issue May 9, 2024
This fixes an issue where calling "craftctl" in a scriptlet would fail with a
ModuleNotFoundError for craft_parts. This happened when the snapcraft project
included build-packages that pulled in libpython3.10-minimal.

The reason that this failed is because in Rockcraft the `python` plugin (used
to build the `snapcraft` part) works by adding a custom "sitecustomize.py" in
`/usr/lib/python3.10/` to add the part's Python libraries to the Python path.
This is fine unless the `libpython3.10-minimal` package is explicitly installed
later on a container created from the rock, because that package has its own
sitecustomize.py file which overwrites Rockcraft's.

The solution is to make apt and dpkg aware that all of these Python-related
packages are already installed in the rock, by adding the dependency explicitly
as an `overlay-package`. This also has the extra beneficial side-effect of
improving installation of build-packages because dpkg/apt are aware of the
installed packages and don't have to download and re-install them unnecessarily.

Fixes #33.
tigarmo added a commit that referenced this issue May 9, 2024
This fixes an issue where calling "craftctl" in a scriptlet would fail with a
ModuleNotFoundError for craft_parts. This happened when the snapcraft project
included build-packages that pulled in libpython3.10-minimal.

The reason that this failed is because in Rockcraft the `python` plugin (used
to build the `snapcraft` part) works by adding a custom "sitecustomize.py" in
`/usr/lib/python3.10/` to add the part's Python libraries to the Python path.
This is fine unless the `libpython3.10-minimal` package is explicitly installed
later on a container created from the rock, because that package has its own
sitecustomize.py file which overwrites Rockcraft's.

The solution is to make apt and dpkg aware that all of these Python-related
packages are already installed in the rock, by adding the dependency explicitly
as an `overlay-package`. This also has the extra beneficial side-effect of
improving installation of build-packages because dpkg/apt are aware of the
installed packages and don't have to download and re-install them unnecessarily.

Fixes #33.
tigarmo added a commit that referenced this issue May 14, 2024
This fixes an issue where calling "craftctl" in a scriptlet would fail with a
ModuleNotFoundError for craft_parts. This happened when the snapcraft project
included build-packages that pulled in libpython3.10-minimal.

The reason that this failed is because in Rockcraft the `python` plugin (used
to build the `snapcraft` part) works by adding a custom "sitecustomize.py" in
`/usr/lib/python3.10/` to add the part's Python libraries to the Python path.
This is fine unless the `libpython3.10-minimal` package is explicitly installed
later on a container created from the rock, because that package has its own
sitecustomize.py file which overwrites Rockcraft's.

The solution is to make apt and dpkg aware that all of these Python-related
packages are already installed in the rock, by adding the dependency explicitly
as an `overlay-package`. This also has the extra beneficial side-effect of
improving installation of build-packages because dpkg/apt are aware of the
installed packages and don't have to download and re-install them unnecessarily.

Fixes #33.
tigarmo added a commit that referenced this issue May 14, 2024
This fixes an issue where calling "craftctl" in a scriptlet would fail with a
ModuleNotFoundError for craft_parts. This happened when the snapcraft project
included build-packages that pulled in libpython3.10-minimal.

The reason that this failed is because in Rockcraft the `python` plugin (used
to build the `snapcraft` part) works by adding a custom "sitecustomize.py" in
`/usr/lib/python3.10/` to add the part's Python libraries to the Python path.
This is fine unless the `libpython3.10-minimal` package is explicitly installed
later on a container created from the rock, because that package has its own
sitecustomize.py file which overwrites Rockcraft's.

The solution is to make apt and dpkg aware that all of these Python-related
packages are already installed in the rock, by adding the dependency explicitly
as an `overlay-package`. This also has the extra beneficial side-effect of
improving installation of build-packages because dpkg/apt are aware of the
installed packages and don't have to download and re-install them unnecessarily.

Fixes #33.
@om26er
Copy link

om26er commented Oct 2, 2024

Coming from canonical/snapcraft#5079 (comment) -- this affects me as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triaged
Projects
None yet
Development

No branches or pull requests

4 participants