canonical / grafana-agent-operator

https://charmhub.io/grafana-agent
Apache License 2.0
4 stars 11 forks source link

grafana-agent charm install hook fails on focal #5

Closed dashmage closed 1 year ago

dashmage commented 1 year ago

Bug Description

While deploying grafana-agent and relating with a focal unit, there's an install hook error.

To Reproduce

$ juju deploy ubuntu --base ubuntu@20.04 $ juju deploy grafana-agent --channel edge --base ubuntu@20.04 $ juju relate ubuntu grafana-agent

Environment

Relevant log output

$ juju status

Model              Controller        Cloud/Region             Version  SLA          Timestamp
grafana-agent-bug  serverstack-ctrl  serverstack/serverstack  3.1.5    unsupported  11:48:59Z

App            Version  Status  Scale  Charm          Channel  Rev  Exposed  Message
grafana-agent           error       1  grafana-agent  edge      18  no       hook failed: "install"
ubuntu         20.04    active      1  ubuntu         stable    24  no

Unit                Workload  Agent  Machine  Public address  Ports  Message
ubuntu/0*           active    idle   0        10.5.2.237
  grafana-agent/1*  error     idle            10.5.2.237             hook failed: "install"

Machine  State    Address     Inst id                               Base          AZ    Message
0        started  10.5.2.237  56c25251-fd92-459c-92ae-390d132ee2a0  ubuntu@20.04  nova  ACTIVE

$ juju debug-log

unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install Traceback (most recent call last):
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install   File "/var/lib/juju/agents/unit-grafana-agent-1/charm/lib/charms/observability_libs/v0/cert_handler.py", line 41, in <module>
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install     from charms.tls_certificates_interface.v2.tls_certificates import (  # type: ignore
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install   File "/var/lib/juju/agents/unit-grafana-agent-1/charm/lib/charms/tls_certificates_interface/v2/tls_certificates.py", line 285, in <module>
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install     from cryptography import x509
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install   File "/var/lib/juju/agents/unit-grafana-agent-1/charm/venv/cryptography/x509/__init__.py", line 7, in <module>
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install     from cryptography.x509 import certificate_transparency
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install   File "/var/lib/juju/agents/unit-grafana-agent-1/charm/venv/cryptography/x509/certificate_transparency.py", line 11, in <module>
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install     from cryptography.hazmat.bindings._rust import x509 as rust_x509
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install ImportError: libssl.so.3: cannot open shared object file: No such file or directory
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install During handling of the above exception, another exception occurred:
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install Traceback (most recent call last):
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install   File "./src/charm.py", line 20, in <module>
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install     from grafana_agent import METRICS_RULES_SRC_PATH, GrafanaAgentCharm
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install   File "/var/lib/juju/agents/unit-grafana-agent-1/charm/src/grafana_agent.py", line 31, in <module>
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install     from charms.observability_libs.v0.cert_handler import CertHandler
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install   File "/var/lib/juju/agents/unit-grafana-agent-1/charm/lib/charms/observability_libs/v0/cert_handler.py", line 51, in <module>
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install     raise ImportError(
unit-grafana-agent-1: 11:48:23 WARNING unit.grafana-agent/1.install ImportError: charms.tls_certificates_interface.v2.tls_certificates is missing; please get it through charmcraft fetch-lib
unit-grafana-agent-1: 11:48:23 ERROR juju.worker.uniter.operation hook "install" (via hook dispatching script: dispatch) failed: exit status 1
unit-grafana-agent-1: 11:48:23 INFO juju.worker.uniter awaiting error resolution for "install" hook

Additional context

This could be caused with the latest commit that bumps the operator_libs_linux library to v2.

This error is not present on jammy.

sed-i commented 1 year ago

We need to split the build-on/run-on. A 22.04 charm cannot run as-is on 20.04.

simskij commented 1 year ago

Works on 22.04, confirming @sed-i's statement.

Machine  State    Address        Inst id        Base          AZ  Message
0        started  10.227.50.80   juju-2b0924-0  ubuntu@20.04      Running
1        started  10.227.50.220  juju-2b0924-1  ubuntu@22.04      Running
ubuntu@juju:~$ juju status
Model      Controller  Cloud/Region         Version  SLA          Timestamp
issue-250  lxd         localhost/localhost  3.1.5    unsupported  14:38:57+02:00

App             Version  Status   Scale  Charm          Channel  Rev  Exposed  Message
grafana-agent            error        1  grafana-agent  edge      18  no       hook failed: "install"
grafana-agent2           blocked      1  grafana-agent  edge      18  no       logging-consumer: off, send-remote-write: off, grafana-cloud-config: off
ubuntu          20.04    active       1  ubuntu         stable    24  no       
ubuntu2         22.04    active       1  ubuntu         stable    24  no       

Unit                 Workload  Agent  Machine  Public address  Ports  Message
ubuntu2/0*           active    idle   1        10.227.50.220          
  grafana-agent2/0*  blocked   idle            10.227.50.220          logging-consumer: off, send-remote-write: off, grafana-cloud-config: off
ubuntu/0*            active    idle   0        10.227.50.80           
  grafana-agent/0*   error     idle            10.227.50.80           hook failed: "install"

Machine  State    Address        Inst id        Base          AZ  Message
0        started  10.227.50.80   juju-2b0924-0  ubuntu@20.04      Running
1        started  10.227.50.220  juju-2b0924-1  ubuntu@22.04      Running
sed-i commented 1 year ago

@simskij for some reason I can't transfer this issue to the machine charm repo. Are you able to?

sed-i commented 1 year ago

Partially blocked by https://github.com/canonical/charmcraft/issues/1263.

PietroPasotti commented 1 year ago

Should have been closed by #9, @dashmage please re-open if the issue persists.