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

Cannot stage packages with charmcraft #1990

Open
yanksyoon opened this issue Nov 14, 2024 · 2 comments
Open

Cannot stage packages with charmcraft #1990

yanksyoon opened this issue Nov 14, 2024 · 2 comments
Labels
Bug Something isn't working

Comments

@yanksyoon
Copy link

Bug Description

A simple charmcraft yaml w/ stage packages breaks with error: Unknown error: E:The method driver /snap/charmcraft/4914/usr/lib/apt/methods/http could not be found..

name: test
type: charm
title: test charm
summary: test summary
description: test description
base: [email protected]
parts:
  charm:
    plugin: nil
    stage-packages:
    - wget
platforms:
  amd64:

To Reproduce

use the charmcraft.yaml above and run charmcraft pack

Environment

$ charmcraft --version
charmcraft 3.2.1

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy

charmcraft.yaml

name: test
type: charm
title: test charm
summary: test summary
description: test description
base: [email protected]
parts:
  charm:
    plugin: nil
    stage-packages:
    - wget
platforms:
  amd64:

Relevant log output

Unknown error: E:The method driver /snap/charmcraft/4914/usr/lib/apt/methods/http could not be found.                                                                                                                     
Failed to execute charmcraft in instance.                                                                                                                                                                                 
@yanksyoon yanksyoon added the Bug Something isn't working label Nov 14, 2024
@lengau
Copy link
Collaborator

lengau commented Nov 14, 2024

Hi - this is blocked by #1839 and #1844, where we'd need to do the work to make stage packages work.

However, given what you're trying to stage, it's likely not going to do what you intend it to do. Rather than installing wget on the target machine, using stage-packages would include the contents of the wget package in the charm itself, in a way that may not actually make the wget executable included there usable.

If what you expect is for the package to be installed on the machine where the charm is installed, you may want to look at the charm libraries provided under the operator-libs-linux charm, specifically the apt library.

You can use that library to install wget (or any other packages you need) on the system during the install event, which would make it available both for the charm to run using subprocess.run and for other processes on the system to use.

@yanksyoon
Copy link
Author

Hi! Thanks for the explanation:) the wget is just for demonstration purposes.
I am already using the apt lib but there is an issue where it is not compatible with noble (ppa).
Hence I have resorted to this as a fallback which I found wasn't quite working at the moment too.
I think I will need to fall back to sub process runs for the time being to unblock myself.
Thanks!

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

No branches or pull requests

2 participants