← Back to issue list

charmcraft exiting with 120 exit status and no stdout/stderr

View original Github issue

Metadata

Project
charmcraft
Number
#608
Type
issue
State
closed
Author
knkski
Labels
—
Created
Updated
Closed

Current evaluation

Reporter saw charmcraft exit 120 with no output when run inside a classic snap. Maintainer facundobatista traced it to snapd bug #1849753 (classic snap invoking another classic snap) and closed the issue as not charmcraft-related.

Resolution: closed not a bug

Reason: facundobatista closed the issue on 2021-12-02 stating the failure comes from snapd bug https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1849753, where a classic snap executing another classic snap is unlikely to work, so it is not a charmcraft defect. The reporter also confirmed pip-installed charmcraft worked fine.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I have a JavaScript file that looks like this, in the context of wanting to run some `charmcraft` commands in [this action](https://github.com/canonical/charmhub-upload-action): ```javascript const core = require('@actions/core'); const exec = require('@actions/exec'); (async () => { const result = await exec.getExecOutput( "/usr/bin/bash", ["-c", "/snap/bin/charmcraft --help"], {ignoreReturnCode: true} ); core.error(`exit status: ${result.exitCode}`); core.error(`stdout: ${result.stdout}`); core.error(`stderr: ${result.stderr}`); })(); ``` It's wrapped in a bash call to ensure that I'm not accidentally trying to call a binary that doesn't exist or anything like that. Running that script produces this output: ``` node dist/index.js [command]/usr/bin/bash -c /snap/bin/charmcraft --help ::error::exit status: 120 ::error::stdout: ::error::stderr: ``` It doesn't seem to be an issue with the JavaScript libraries that I'm using, as changing `"/snap/bin/charmcraft --help"` to `"yes --help"` produces this output, as expected: ``` [command]/usr/bin/bash -c yes --help Usage: yes [STRING]... or: yes OPTION Repeatedly output a line with all specified STRING(s), or 'y'. --help display this help and exit --version output version information and exit GNU coreutils online help: <https://www.gnu.org/software/coreutils/> Full documentation <https://www.gnu.org/software/coreutils/yes> or available locally via: info '(coreutils) yes invocation' ::error::exit status: 0 ::error::stdout: Usage: yes [STRING]...%0A or: yes OPTION%0ARepeatedly output a line with all specified STRING(s), or 'y'.%0A%0A --help display this help and exit%0A --version output version information and exit%0A%0AGNU coreutils online help: <https://www.gnu.org/software/coreutils/>%0AFull documentation <https://www.gnu.org/software/coreutils/yes>%0Aor available locally via: info '(coreutils) yes invocation'%0A ::error::stderr: ``` The documentation here suggests that it's a problem with the Python interpreter for charmcraft: https://docs.python.org/3/library/sys.html#sys.exit > Changed in version 3.6: If an error occurs in the cleanup after the Python interpreter has caught SystemExit (such as an error flushing buffered data in the standard streams), the exit status is changed to 120. That meshes with me trying to run other charmcraft commands in the same way, which will result in new log files being generated under `~/snap/charmcraft/common/cache/charmcraft/log/` with the expected output, so the command appears to be doing at least some actual work.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Reporter saw charmcraft exit 120 with no output when run inside a classic snap. Maintainer facundobatista traced it to snapd bug #1849753 (classic snap invoking another classic snap) and closed the issue as not charmcraft-related.
stealth/space-bunny-alpha — closed not a bug Exit 120 was attributed to snapd bug #1849753, which prevents classic snaps from reliably executing other classic snaps. Charmcraft maintainers closed the issue as unrelated.
qwen3.6-35b-a3b-mtp-q6 — — Closed as an external snapd bug. Classic snaps cannot reliably execute other classic snaps, causing the exit code 120 and suppressed output. Workaround: install charmcraft via pip instead of snap.
qwen/qwen3.6-35b-a3b — — Closed as not charmcraft-related. The exit code 120 and missing output result from a snapd bug blocking classic snaps from executing other classic snaps. Installing charmcraft via pip resolves the issue.
qwen3.6-35b-a3b-mtp-q6 — — Closed as not charmcraft related. The exit code 120 stems from a snapd bug preventing classic snaps from executing other classic snaps. Installing charmcraft via pip resolves the issue.

Update history

No update history recorded yet.

Related work

  • Related To: snapd#1849753 (confidence 60%)

    The maintainer's comment cites the Launchpad snapd bug 1849753 about classic snaps executing other classic snaps as the root cause; no snapd code change was made in charmcraft.

Related issues

Issue Project State Summary Similarity
#184 Charmcraft crash when snap is used in /tmp directory charmcraft closed Fixed the /tmp PermissionError by switching the Charmcraft snap from strict to classic confinement in merged PR #288 (d49e85e3, 0d76670a).
72%
#388 Charmcraft pack cannot run in a CI? charmcraft closed charmcraft's strictly-confined snap blocked CI builds (pip deps install failing). Fixed by switching the snap to classic confinement (PR #288, commit d49e85e3); reporter confirmed the edge classic snap resolved their CI.
70%