← Back to issue list

`charmcraft pack` doesn't include all error output

View original Github issue

Metadata

Project
charmcraft
Number
#701
Type
issue
State
closed
Author
mthaddon
Labels
—
Created
Updated
Closed

Current evaluation

Missing charmcraft pack error output was fixed in Charmcraft 1.5 through improved managed-instance log retrieval; the reporter was using 1.4.0, so the issue was closed.

Resolution: closed resolved

Reason: Maintainer facundobatista closed the report after the author confirmed Charmcraft 1.4.0, stating that 1.5 already improved instance-internal log retrieval. Commit cc7d9ee0 contains the related fix for reliably retrieving instance logs.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I'm trying to make some small changes to the postgresql-k8s charm, but it hasn't been touched since before charmcraft.yaml was a requirement (last updated in May 2021). This is what my requirements.txt and charmcraft.yaml look like: ``` mthaddon@tenaya:~/repos/k8s-charms/charm-k8s-postgresql/charm-k8s-postgresql$ cat requirements.txt # [REDACTED comments for brevity] git+git://github.com/canonical/operator@f521841#egg=ops charmhelpers kubernetes oci-image pgconnstr psycopg2 pyyaml tenacity mthaddon@tenaya:~/repos/k8s-charms/charm-k8s-postgresql/charm-k8s-postgresql$ cat charmcraft.yaml type: charm bases: - build-on: - name: "ubuntu" channel: "20.04" run-on: - name: "ubuntu" channel: "20.04" parts: charm: build-packages: - git - libpq-dev ``` When I run `charmcraft pack` I see the following in the logs: ``` 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.671 :: Collecting Jinja2 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.674 :: Using cached Jinja2-3.0.3.tar.gz (269 kB) 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.910 :: ERROR: Command errored out with exit status 1: 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.910 :: command: /root/parts/charm/build/staging-venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-zqtn4m0n/Jinja2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-zqtn4m0n/Jinja2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-zqtn4m0n/Jinja2/pip-egg-info 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.911 :: cwd: /tmp/pip-install-zqtn4m0n/Jinja2/ 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.911 :: Complete output (35 lines): 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.911 :: Traceback (most recent call last): 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.911 :: File "<string>", line 1, in <module> 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.911 :: File "/tmp/pip-install-zqtn4m0n/Jinja2/setup.py", line 4, in <module> 2022-03-06 13:54:36.658 :: 2022-03-06 12:54:35.911 :: setup( 2022-03-06 13:54:36.659 Executing on host: lxc --project charmcraft config device show local:charmcraft-postgresql-k8s-9553140-0-0-amd64 2022-03-06 13:54:36.766 Executing on host: lxc --project charmcraft config device remove local:charmcraft-postgresql-k8s-9553140-0-0-amd64 disk-/root/project 2022-03-06 13:54:36.943 Executing on host: lxc --project charmcraft stop local:charmcraft-postgresql-k8s-9553140-0-0-amd64 2022-03-06 13:54:38.431 Failed to build charm for bases index '0'. 2022-03-06 13:54:38.433 Traceback (most recent call last): 2022-03-06 13:54:38.433 File "/snap/charmcraft/761/lib/charmcraft/commands/build.py", line 467, in pack_charm_in_instance 2022-03-06 13:54:38.433 instance.execute_run( 2022-03-06 13:54:38.433 File "/snap/charmcraft/761/lib/craft_providers/lxd/lxd_instance.py", line 221, in execute_run 2022-03-06 13:54:38.433 return self.lxc.exec( 2022-03-06 13:54:38.433 File "/snap/charmcraft/761/lib/craft_providers/lxd/lxc.py", line 307, in exec 2022-03-06 13:54:38.433 return runner(final_cmd, **kwargs) # pylint: disable=subprocess-run-check 2022-03-06 13:54:38.433 File "/snap/charmcraft/761/usr/lib/python3.8/subprocess.py", line 516, in run 2022-03-06 13:54:38.433 raise CalledProcessError(retcode, process.args, 2022-03-06 13:54:38.433 subprocess.CalledProcessError: Command '['lxc', '--project', 'charmcraft', 'exec', 'local:charmcraft-postgresql-k8s-9553140-0-0-amd64', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'CHARMCRAFT_MANAGED_MODE=1', 'charmcraft', 'pack', '--bases-index', '0']' returned non-zero exit status 1. ``` However, if I start the LXC, exec in and run the same commands charmcraft is doing (e.g. `python3 -m venv /root/parts/charm/build/staging-venv && /root/parts/charm/build/staging-venv/bin/pip3 install --upgrade --no-binary :all: --requirement=requirements.txt`) I see the following output: ``` Collecting Jinja2 Using cached Jinja2-3.0.3.tar.gz (269 kB) ERROR: Command errored out with exit status 1: command: /root/parts/charm/build/staging-venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-lvssyfhi/Jinja2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-lvssyfhi/Jinja2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-lvssyfhi/Jinja2/pip-egg-info cwd: /tmp/pip-install-lvssyfhi/Jinja2/ Complete output (35 lines): Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-lvssyfhi/Jinja2/setup.py", line 4, in <module> setup( File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/__init__.py", line 145, in setup return distutils.core.setup(**attrs) File "/usr/lib/python3.8/distutils/core.py", line 121, in setup dist.parse_config_files() File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/dist.py", line 701, in parse_config_files parse_configuration(self, self.command_options, File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 121, in parse_configuration meta.parse() File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 426, in parse section_parser_method(section_options) File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 399, in parse_section self[name] = value File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 184, in __setitem__ value = parser(value) File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 515, in _parse_version version = self._parse_attr(value, self.package_dir) File "/root/parts/charm/build/staging-venv/lib/python3.8/site-packages/setuptools/config.py", line 349, in _parse_attr module = import_module(module_name) File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 671, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 848, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/tmp/pip-install-lvssyfhi/Jinja2/src/jinja2/__init__.py", line 8, in <module> from .environment import Environment as Environment File "/tmp/pip-install-lvssyfhi/Jinja2/src/jinja2/environment.py", line 15, in <module> from markupsafe import Markup ModuleNotFoundError: No module named 'markupsafe' ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ``` It would be helpful if the charmcraft log included this information so I didn't have to dig for it manually.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Missing charmcraft pack error output was fixed in Charmcraft 1.5 through improved managed-instance log retrieval; the reporter was using 1.4.0, so the issue was closed.
stealth/space-bunny-alpha — closed resolved Charmcraft 1.5’s improved instance-internal log retrieval was reported to fix missing pack errors; the reporter was using 1.4.0, so the maintainer closed the report.
qwen3.6-35b-a3b-mtp-q6 — — Fixed in Charmcraft 1.5 via improved instance-internal log retrieval, ensuring full build error output is captured. Closed by maintainer pending user verification on the updated version.
qwen/qwen3.6-35b-a3b — — Resolved in Charmcraft 1.5 by enhancing instance-internal log retrieval to capture complete pip and build error traces. The issue was closed as fixed, with the maintainer recommending an upgrade to v1.5 and reopening if the truncation persists.
qwen3.6-35b-a3b-mtp-q6 — — Resolved in Charmcraft 1.5 by improving instance-internal log retrieval to capture full build error output. Issue closed as fixed.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#420 (confidence 85%)

    PR #420 added managed-instance log fetching on pack errors; the 1.5 work improved its retrieval reliability.

Related issues

Issue Project State Summary Similarity
#501 charmcraft pack fails trying to include a non-existing charm/src/.tox/ charmcraft closed The missing-file packing failure was fixed upstream in craft-parts; maintainer lengau closed charmcraft#501 on 2024-02-22 as resolved.
72%
#552 `charmcraft pack` runs indefinitely when using parts charmcraft closed The hang was caused by duplicated local-source ignore patterns in Charmcraft 1.2.1 and fixed in 1.3.0 via canonical/craft-parts#120 (commit 280e1592).
72%
#587 Charm packing error not logged charmcraft closed Missing pip errors were already logged by Charmcraft 1.3+90.g5e5efc7, so the report was closed as already resolved.
71%
#1160 `charmcraft pack` does not recognize updated `charmcraft.yaml` file charmcraft open Tracked upstream: charmcraft pack ignores build-snaps channel changes in charmcraft.yaml unless clean is run. Root cause is craft-parts#496 (build-snaps missing from properties_of_interest), still unfixed; charmcraft only needs a craft-parts bump once patched.
71%
#707 The logs from the instance's charmcraft run are only retrieved if pack crashed charmcraft closed Fixed in canonical/charmcraft#726 (cc7d9ee0, merged as 6a05a07a): instance logs are now retrieved after both successful and failed charmcraft pack runs.
70%