← Back to issue list

Compiled snap hooks not executed when packaging with Snapcraft 7

View original Launchpad issue

Metadata

Project
snapcraft (launchpad)
Number
#1980089
Type
issue
State
closed
Author
~farshidtz
Labels
craft-1159 hooks snapcraft
Created
Updated
Closed

Current evaluation

Compiled snap hooks are supported again by merged PR snapcore/snapcraft#3837 (commit c77e3a07a), which processes generated hooks and restores the expected meta/hooks entries.

Resolution: closed resolved

Reason: The proposed fix in snapcore/snapcraft#3837 was merged as commit c77e3a07a, titled “hooks: process generated hooks.” The reporter also confirmed that the tested branch resolved the missing-hook problem.

Evaluated by: mr-cal-bot

No scores available.

Issue body

I reported this on the call for testing snapcraft 7 (https://forum.snapcraft.io/t/call-for-testing-snapcraft-7/30201/43). Reporting it here again so that it is not forgotten. I have my configure and install hooks as binary executables placed under `$SNAPCRAFT_PART_INSTALL/snap/hooks/` during the part's build. When using snapcraft 7.0.3, the resulting snap doesn't run the install / configure hooks and `snap set` fails due to the lack of a configure hook. Source code: https://github.com/farshidtz/edgex-device-usb-camera/blob/4df80eefb8af4e7f598d31ac79e90a8636e25008/snap/snapcraft.yaml#L52-L60) Inside the package, the hooks are under `snap/hooks` as they used to be, but there are no longer any scripts calling them from `meta/hooks/configure` and `meta/hooks/configure` . Package built with snapcraft 7.0.3: ``` $ tree squashfs-root_7/snap/hooks/ squashfs-root_7/snap/hooks/ ├── configure └── install 0 directories, 2 files $ tree squashfs-root_7/meta/ squashfs-root_7/meta/ ├── gui │ └── icon.png └── snap.yaml 1 directory, 2 files ``` Package built with snapcraft 6: ``` $ tree squashfs-root_6/snap/hooks/ squashfs-root_6/snap/hooks/ ├── configure └── install 0 directories, 2 files $ tree squashfs-root_6/meta/ squashfs-root_6/meta/ ├── gui │ └── icon.png ├── hooks │ ├── configure │ └── install └── snap.yaml 2 directories, 4 files $ cat squashfs-root_6/meta/hooks/configure #!/bin/sh PATH="$SNAP/usr/sbin:$SNAP/usr/bin:$SNAP/sbin:$SNAP/bin${PATH:+:$PATH}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$SNAP/usr/lib:$SNAP/usr/lib/x86_64-linux-gnu" export LD_LIBRARY_PATH="$SNAP_LIBRARY_PATH${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" exec "$SNAP/snap/hooks/configure" "$@" ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Compiled snap hooks are supported again by merged PR snapcore/snapcraft#3837 (commit c77e3a07a), which processes generated hooks and restores the expected meta/hooks entries.
stealth/space-bunny-alpha — closed resolved Snapcraft 7 omitted meta/hooks wrappers for compiled hooks. Merged PR #3837 (c77e3a07a) restored them, and the reporter confirmed the fix.
stealth/space-bunny-alpha — closed resolved Compiled configure/install hooks stopped running because Snapcraft 7 omitted their meta/hooks wrappers. The regression was addressed by merged PR #3386 (bb9525144).
qwen/qwen3.6-35b-a3b — — Closed without resolution. Snapcraft 7 omitted the meta/hooks wrapper scripts, breaking execution of compiled configure and install hooks.
qwen/qwen3.6-35b-a3b — — Closed without resolution. Snapcraft 7.0.3 omitted meta/hooks wrapper scripts for compiled snap hooks, breaking execution. The issue appears abandoned.
qwen/qwen3.6-35b-a3b — — Closed without resolution or fix. The report detailed a Snapcraft 7 regression where compiled snap hooks failed to execute due to missing meta directory wrapper scripts. No comments or follow-up actions were recorded.
qwen3.6-35b-a3b-mtp-q6 — — Closed without resolution. Snapcraft 7 omitted meta/hooks wrappers, preventing compiled hook execution. No fix or superseding PR was merged. Issue abandoned after four years of inactivity.

Update history

Date Change
created

Related work

  • Likely Fixed By: snapcore/snapcraft#3837 (confidence 100%)

    Merged commit c77e3a07a implements processing for generated compiled hooks.

Related issues

Issue Project State Summary Similarity
#3837 fix: hooks: process generated hooks snapcraft merged Merged as commit c77e3a07a (CRAFT-1159): core22 now includes lifecycle-generated hooks in the snap via meta/hooks wrappers, with snap/hooks taking priority; adds spread tests for core18/20/22.
73%
#3659 meta: add support for hooks snapcraft merged Merged snapcraft#3659 via commit 00eed7dc9 (merge 795294fd5) into snapcraft/7.0, adding hooks support in snapcraft.yaml for CRAFT-808.
73%
#6433 Generated hooks are not included in the Snap snapcraft closed Generated part hooks now replace stubs correctly; commit 271462658 prevents premature stub creation and was targeted for Snapcraft 9.1.3.
72%
#1812003 hooks should be made executable instead of erroring out snapcraft (launchpad) closed Fixed by merged PR snapcore/snapcraft#2440 (commit c2f5a0dc0), which packages recognized hooks as executable instead of rejecting non-executable source files.
72%
#1586465 Add support for hooks snapcraft (launchpad) closed Hook support was added in snapcore/snapcraft#1026 via commit 01880ee8d, packaging hook files and snapcraft.yaml hook definitions.
72%