feat: kernel|initrd plugins: extend and improve behavior
Metadata
Current evaluation
Superseded by #6110; cleaned-up kernel/initrd work landed through #6116 and was merged into main by #6284 (ceace05f3).
Resolution: closed superseded
Reason: After #6102 was closed unmerged, the author linked #6110 as the cleanup continuation. The revised work was merged through #6116 and reached main in #6284 at commit ceace05f3.
Evaluated by: mr-cal-bot
No scores available.
Issue body
These changes update the feature branch kernel and initrd plugins in some key ways.
The initrd plugin changes are largely isolated to migrating some of the root tarball fetch logic into the plugin more properly via a `@get_pull_commands`. For the legacy plugin, the prior behavior has been left in tact. The logic in the build script and some general formatting and refactoring have occurred to accommodate these changes. Additionally, a "bug" (behavioral glitch, more like) was resolved by adding an `--allow-downgrades` flag to an `apt install` command. Otherwise, the behavior is largely the same. The spread tests have been updated to leverage some new kernel plugin options, gaining some tests of new kernel options for free.
The kernel plugin changes are a bit more substantive. Firstly, like the initrd plugin, the kernel source fetching logic has moved, in part, to the plugin itself (with analogous updates to the build script logic as a result).
Furthermore, some options from the ubuntu-kernel plugin have been integrated into this plugin. Specifically, the ability to build a snap from a deb, to specify the Ubuntu release of a kernel tree to build from, as well as the ability to build several kernel tools (instead of just perf).
Enabling ZFS support was removed, for what I think are good reasons. Those reasons being...
DKMS support "exists" in the ubuntu-kernel plugin insofar as the plugin builds a deb and leverages the existing kernel build system to build DKMS packages. Attempts were made at emulating this logic within the kernel plugin, but interacting with DKMS felt far too cumbersome (not to mention incredibly fragile) in this setting; DKMS requires a lot of facts to be true of the build environment, and it proved onerous to make the logic work in a consistent fashion.
DKMS is not intended to be used in this fashion anyways; DKMS is intended to be run on runtime targets after a kernel has been updated. If you are building the module at kernel build time (ostensibly what the kernel plugin purports to do), then you can merely build the module in the relevant fashion alongside the kernel in the traditional way; no need to bother with DKMS.
The enable-zfs kernel plugin option demonstrated this fact -- enabling this option effectively ran the compilation commands the DKMS tooling would run, albeit in a far more opinionated fashion than DKMS would.
In lieu of this support, documentation has been created (along with some examples) for how to perform something like an out-of-tree kernel module build within a snapcraft.yaml for kernel snaps. If DKMS is desired, its usage can be spoofed by adding some relevant part and creating the correct file hierarchies within the build environment.
As such, building a kernel snap with ZFS support has been removed; it was too opinionated and prescriptive for what the true intention of the flag was, and to make it more flexible would force the kernel plugin to lose its identity.
The ability to build additional kernel tools (bpftool, perf, cpupower) have been added.
Most critically, the legacy implementations of the plugins have been removed due to the addition of a different kernel plugin (one which many of us are used to) being merged at some point; the implementation in this PR would probably break many existing users of this new plugin, and as such it has been reverted :)
Things to resolve before merging:
- [ ] cross building when using certain options (`kernel-use-binary-package` for sure) fails in some cases due to RISC-V kernel debs having *dumb names*. The logic in the script could be improved to resolve this issue, or we can simply make the build fail with an error (checked by the plugin rather than the script).
- [ ] Builds haven't been tested on actual hardware. This is my next move.
- [ ] commits need to be cleaned up to resolve some merge issues
ETA: docs-related tests failing are probably because of something unrelated? The docs tests ran fine (locally) for me previously, I suspect something has happened to e.g. Frame docs because of the RTD move/reorg.
cc @stewarthore @kubiko @laurenbrock @jicheu
---
- [x] I've followed the [contribution guidelines](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md).
- [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/).
- [x] I've successfully run `make lint && make test`.
- [x] I've added or updated any relevant documentation.
- [ ] I've updated the relevant release notes.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed superseded | Superseded by #6110; cleaned-up kernel/initrd work landed through #6116 and was merged into main by #6284 (ceace05f3). | |
| stealth/space-bunny-alpha | — | closed superseded | Closed as superseded after reverting legacy kernel/initrd plugin changes. The author linked #6110 as the continuation; the revised feature branch was later merged into main via #6284. | |
| qwen/qwen3.6-35b-a3b | — | — | Superseded by PR #6110. The changes were reverted to prevent conflicts with a newly merged kernel plugin that would break existing users. The author closed this PR and redirected development to the replacement. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Superseded by pull request #6110. Changes were reverted to avoid breaking existing users, as a different kernel plugin implementation was merged instead. The author linked the replacement PR in the final comment. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/snapcraft#6284
(confidence 100%)
Merged the feature branch into main as commit ceace05f3.
-
Superseded By:
canonical/snapcraft#6116
(confidence 98%)
Revised PR carrying the kernel and initrd plugin feature changes was merged.
-
Superseded By:
canonical/snapcraft#6110
(confidence 95%)
The author linked this cleanup and branch-synchronization work as the continuation of #6102.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #6116 feat: kernel|initrd plugins: extend and improve behavior | snapcraft | merged | Merged via #6255 (6598b614e), expanding kernel/initrd plugin behavior and options; the feature branch then reached main through #6284 (ceace05f3). | |
| #6284 feat: merge feature/kernel initrd plugin into main | snapcraft | merged | Merged into main as ceace05f3, adding kernel and initrd plugins for base core22 and higher. | |
| #6254 feat(kernel,initrd): extend plugins with new options, stabilize | snapcraft | merged | PR #6254 merged as commit 518476fc1, adding kernel/initrd plugin options, stability fixes, docs and a new kernel-deb spread test; later landed on main via #6284 (ceace05f3). | |
| #6106 feat: add ubuntu core initrd plugin | snapcraft | closed | Closed unmerged as duplicate work; the parallel kernel/initrd implementation landed via #6284 (commit ceace05f3). | |
| #6255 Feature/kernel initrd plugin merge | snapcraft | merged | Merged as commit 6598b614e: a main-into-feature-branch sync for the kernel/initrd plugin branch (after conflict cleanup), picking up #6254 (518476fc1). The branch later landed on main via #6284 (ceace05f3). | |
| #5814 feat(plugins): add kernel and initrd plugins | snapcraft | merged | Merged #5814 in 8f56d299d, adding a reworked post-core18 kernel plugin and a new initrd/UKI plugin; it supersedes #4302. | |
| #5437 Adding initrd plugin supporting UC20+ | snapcraft | closed | kubiko's initrd plugin PR (kernel .ko staging, firmware, EFI kernel images) sat unreviewed for ~1yr with failing tests/lint and was closed unmerged as superseded by canonical/snapcraft#5814, merged as 8f56d299d. | |
| #4302 plugins: kernel: split kernel plugin into kernel and initrd plugins | snapcraft | closed | PR #4302 (split kernel plugin into kernel + initrd plugins) was closed unmerged on 2025-10-14 by author kubiko as superseded by canonical/snapcraft#5814, merged in commit 8f56d299d. |