← Back to issue list

Increase verbosity of `snapcraft`'s missing files error

View original Github issue

Metadata

Project
snapcraft
Number
#4923
Type
issue
State
closed
Author
farshidtz
Labels
—
Created
Updated
Closed

Current evaluation

Closed as a duplicate of #4499; suppressed `snap pack` errors were fixed by merged PR #5188 (commit a9fc44093), which surfaced snapd's stderr.

Resolution: closed superseded

Reason: A maintainer closed the report as a duplicate of #4499, where the underlying problem was already tracked. PR #5188 later fixed it in commit a9fc44093 after snapd 2.66 added the necessary stderr support.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### What needs to get done The `snapcraft` command doesn't prints much of the errors to standard output, to an extent that most of our developments rely on the verbose mode and built with `snapcraft -v`. The full logs go to a file, but looking at those makes development iterations very tedious. The request here is to print the packaging errors when files are missing, at least in the verbose mode. ### Why it needs to get done An example is when an app refers to a missing file in its command, in verbose mode: ``` $ snapcraft -v ... Creating snap package... Command '['snap', 'pack', '--filename', 'envtester_demo_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1. Failed to execute snapcraft in instance. Full execution log: '/home/farshid/.local/state/snapcraft/log/snapcraft-20240717-114827.780437.log' ``` which isn't very helpful considering this is the verbose mode. Increasing the verbosity `trace` will include the error: ``` $ snapcraft --verbosity=trace ... 2024-07-17 11:47:46.816 :: 2024-07-17 11:47:46.241 Creating snap package... 2024-07-17 11:47:46.816 :: 2024-07-17 11:47:46.242 Pack command: ['snap', 'pack', '--filename', 'envtester_demo_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')] 2024-07-17 11:47:46.816 :: 2024-07-17 11:47:46.254 Command '['snap', 'pack', '--filename', 'envtester_demo_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1. 2024-07-17 11:47:46.816 :: 2024-07-17 11:47:46.254 Detailed information: 2024/07/17 11:47:46.253064 container.go:393: in snap "envtester": path "bin/myapp2.sh2" does not exist 2024-07-17 11:47:46.817 :: error: cannot pack "/root/prime": snap is unusable due to missing files 2024-07-17 11:47:46.817 :: 2024-07-17 11:47:46.255 Traceback (most recent call last): 2024-07-17 11:47:46.817 :: 2024-07-17 11:47:46.255 File "/snap/snapcraft/x2/lib/python3.10/site-packages/snapcraft/pack.py", line 121, in _pack 2024-07-17 11:47:46.817 :: 2024-07-17 11:47:46.255 proc = subprocess.run( 2024-07-17 11:47:46.817 :: 2024-07-17 11:47:46.255 File "/snap/snapcraft/x2/usr/lib/python3.10/subprocess.py", line 526, in run 2024-07-17 11:47:46.817 :: 2024-07-17 11:47:46.255 raise CalledProcessError(retcode, process.args, 2024-07-17 11:47:46.817 :: 2024-07-17 11:47:46.255 subprocess.CalledProcessError: Command '['snap', 'pack', '--filename', 'envtester_demo_amd64.snap', '--compression', 'xz', PosixPath('/root/prime'), PosixPath('/root/project')]' returned non-zero exit status 1. 2024-07-17 11:47:46.817 Executing on host: lxc --project snapcraft config device show local:snapcraft-envtester-on-amd64-for-amd64-2753129 2024-07-17 11:47:46.921 Executing on host: lxc --project snapcraft config device remove local:snapcraft-envtester-on-amd64-for-amd64-2753129 disk-/root/project 2024-07-17 11:47:47.060 Executing on host: lxc --project snapcraft stop local:snapcraft-envtester-on-amd64-for-amd64-2753129 2024-07-17 11:47:51.424 Failed to execute snapcraft in instance. 2024-07-17 11:47:51.425 Traceback (most recent call last): 2024-07-17 11:47:51.425 File "/snap/snapcraft/x2/lib/python3.10/site-packages/craft_application/application.py", line 364, in run_managed 2024-07-17 11:47:51.425 instance.execute_run( # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType] 2024-07-17 11:47:51.425 File "/snap/snapcraft/x2/lib/python3.10/site-packages/craft_providers/lxd/lxd_instance.py", line 293, in execute_run 2024-07-17 11:47:51.425 return self.lxc.exec( 2024-07-17 11:47:51.425 File "/snap/snapcraft/x2/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 387, in exec 2024-07-17 11:47:51.425 return runner(final_cmd, timeout=timeout, check=check, **kwargs) 2024-07-17 11:47:51.425 File "/snap/snapcraft/x2/usr/lib/python3.10/subprocess.py", line 526, in run 2024-07-17 11:47:51.425 raise CalledProcessError(retcode, process.args, 2024-07-17 11:47:51.426 subprocess.CalledProcessError: Command '['lxc', '--project', 'snapcraft', 'exec', 'local:snapcraft-envtester-on-amd64-for-amd64-2753129', '--cwd', '/root/project', '--', 'env', 'CRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'CRAFT_PLATFORM=amd64', 'CRAFT_VERBOSITY_LEVEL=TRACE', 'snapcraft', '--verbosity=trace']' returned non-zero exit status 1. 2024-07-17 11:47:51.426 2024-07-17 11:47:51.426 The above exception was the direct cause of the following exception: 2024-07-17 11:47:51.426 Traceback (most recent call last): 2024-07-17 11:47:51.426 File "/snap/snapcraft/x2/lib/python3.10/site-packages/craft_application/application.py", line 529, in run 2024-07-17 11:47:51.426 self.run_managed(platform, build_for) 2024-07-17 11:47:51.426 File "/snap/snapcraft/x2/lib/python3.10/site-packages/craft_application/application.py", line 371, in run_managed 2024-07-17 11:47:51.426 raise craft_providers.ProviderError( 2024-07-17 11:47:51.426 craft_providers.errors.ProviderError: Failed to execute snapcraft in instance. 2024-07-17 11:47:51.426 Full execution log: '/home/farshid/.local/state/snapcraft/log/snapcraft-20240717-114736.965335.log' ``` which is okay except that the Python exception trace makes it very hard to find the actual error. This behavior is different for command-chain, where a missing file is logged in non-verbose mode: ``` Failed to generate snap metadata: The command-chain item 'bin/myqpp2' defined in app 'myapp1' does not exist or is not executable. Recommended resolution: Ensure that 'bin/myqpp2' is relative to the prime directory. ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed superseded Closed as a duplicate of #4499; suppressed `snap pack` errors were fixed by merged PR #5188 (commit a9fc44093), which surfaced snapd's stderr.
stealth/space-bunny-alpha — closed superseded Closed as a duplicate of #4499; that missing-file reporting problem was later fixed by merged PR #5188 (commit a9fc44093), which surfaces snapd's pack error line.
stealth/space-bunny-alpha — closed superseded Closed as a duplicate of #4499; pack errors were improved by merged PR #5188 (a9fc44093), with related validation merged in #5164.
qwen/qwen3.6-35b-a3b — — Closed as a duplicate. Improving missing file error verbosity is tracked in issue #4499, which will address clearer packaging error output in verbose mode.
qwen/qwen3.6-35b-a3b — — Closed as a duplicate. The request to improve missing file error verbosity is tracked in issue #4499.
qwen/qwen3.6-35b-a3b — — Closed as a duplicate. The request to improve missing file error verbosity in snapcraft is superseded by issue #4499, which tracks the same enhancement. Users are redirected there for resolution.
qwen3.6-35b-a3b-mtp-q6 — — Closed as a duplicate. The missing file error verbosity enhancement is superseded by issue #4499, which tracks the implementation. Follow that issue for the fix.

Update history

No update history recorded yet.

Related work

  • Duplicate Of: snapcraft#4499 (confidence 100%)

    The maintainer explicitly identified #4499 as the correct issue for resolution work.

  • Superseded By: snapcraft#5188 (confidence 98%)

    Merged PR #5188, commit a9fc44093, fixed #4499 by displaying snapd's error output when packing failed.

Related issues

Issue Project State Summary Similarity
#4870 snapcraft pack error obtuse on snapd errors snapcraft closed Closed as a duplicate of #4548, which was tracked by #4499; hidden snapd pack diagnostics were fixed by merged PR #5188 (a9fc44093).
79%
#4933 bug: snapcraft prints insufficient logging when using lxd snapcraft closed Closed as a duplicate of #4499, which was fixed by merged PR #5188 (commit a9fc44093) to surface snapd's snap pack stderr after snapd 2.66 added support.
77%
#4548 Make `snap pack ...` errors also return the problem instead of just the error code snapcraft closed Closed by mr-cal as a duplicate of #4499 (tracked as CRAFT-2559); that issue was fixed by merged PR #5188 (commit a9fc44093), which surfaces snapd's error output when `snap pack` fails.
77%
#5188 fix: improve error message from snapd pack snapcraft merged Merged PR #5188 in commit a9fc44093, improving snapd pack failures by surfacing snapd's error output and fixing snapcraft#4499.
74%
#4880 snapcraft indiscriminately removes *.snap files snapcraft closed Closed as an upstream snap pack issue, not a Snapcraft bug; the omission was reproduced with `snap pack` alone and the reporter was redirected to snapd.
72%