kernel plugin: don't assume /lib/firmware is present if !kernel-with-firmware
Metadata
Current evaluation
PR #1748 (kernel plugin /lib/firmware hotfix, LP #1733564) was closed as superseded by canonical/snapcraft#1750, merged as commit 2d16ac3c0 to skip /lib/firmware handling when kernel-with-firmware is false.
Resolution: closed superseded
Reason: The change landed via superseding PR #1750, merged as commit 2d16ac3c0 ("kernel plugin: respect the kernel-with-firmware property"), so #1748 was closed in its favour. The same fix prevents the FileNotFoundError on install/lib/firmware.
Evaluated by: mr-cal-bot
No scores available.
Issue body
This is an hot-fix candidate: in case of 'kernel-with-firmware: false', don't assume /lib/firmware is present, and avoid referencing it later on.
snapcraft.yaml:
...
kernel-with-firmware: false
Traceback (most recent call last):
File "/usr/lib/python3.5/shutil.py", line 538, in move
os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '/home/flag/canonical/linux/snap/parts/kernel/install/lib/firmware' -> '/home/flag/canonical/lin
ux/snap/parts/kernel/install/firmware'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): [4/9271]
File "/home/flag/canonical/snapcraft/bin/snapcraft", line 36, in <module>
obj=dict(project=snapcraft.ProjectOptions()))
File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1037, in invoke
return Command.invoke(self, ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/flag/canonical/snapcraft/snapcraft/cli/__init__.py", line 124, in run
ctx.forward(lifecyclecli.commands['snap'])
File "/usr/lib/python3/dist-packages/click/core.py", line 552, in forward
return self.invoke(cmd, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "/home/flag/canonical/snapcraft/snapcraft/cli/lifecycle.py", line 140, in snap
project_options, directory=directory, output=output)
File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/_packer.py", line 45, in snap
execute('prime', project_options)
File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/_runner.py", line 80, in execute
_Executor(config, project_options).run(step, part_names)
File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/_runner.py", line 175, in run
self._run_step(step, part, part_names)
File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/_runner.py", line 212, in _run_step
getattr(part, step)()
File "/home/flag/canonical/snapcraft/snapcraft/internal/pluginhandler/__init__.py", line 330, in build
self.plugin.build()
File "/home/flag/canonical/snapcraft/snapcraft/plugins/kbuild.py", line 258, in build
self.do_install()
File "/home/flag/canonical/snapcraft/snapcraft/plugins/kernel.py", line 479, in do_install
os.path.join(self.installdir, 'lib', 'firmware'), self.installdir)
File "/usr/lib/python3.5/shutil.py", line 552, in move
copy_function(src, real_dst)
File "/usr/lib/python3.5/shutil.py", line 251, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.5/shutil.py", line 114, in copyfile
with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/home/flag/canonical/linux/snap/parts/kernel/install/lib/firmware'
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
https://bugs.launchpad.net/snapcraft/+bug/1733564
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed superseded | PR #1748 (kernel plugin /lib/firmware hotfix, LP #1733564) was closed as superseded by canonical/snapcraft#1750, merged as commit 2d16ac3c0 to skip /lib/firmware handling when kernel-with-firmware is false. | |
| stealth/space-bunny-alpha | — | closed superseded | Closed as superseded by canonical/snapcraft#1750, merged as 2d16ac3c0 to skip /lib/firmware operations when kernel-with-firmware is false. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed after fixing a FileNotFoundError in the kernel plugin. The change adds a check to skip moving the /lib/firmware directory when kernel-with-firmware is disabled. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a hot-fix resolving a FileNotFoundError in the kernel plugin when kernel-with-firmware is disabled. The change adds a conditional check to skip referencing /lib/firmware, preventing build failures. |
Update history
No update history recorded yet.
Related work
-
Superseded By:
canonical/snapcraft#1750
(confidence 97%)
Merged PR with the same title that produced commit 2d16ac3c0
-
Likely Fixed By:
canonical/snapcraft#1750
(confidence 90%)
Commit 2d16ac3c0 in the kernel plugin history implements the guard for kernel-with-firmware
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1750 kernel plugin: don't assume /lib/firmware is present if !kernel-with-firmware | snapcraft | merged | Merged PR #1750 (commit 2d16ac3c0), skipping /lib/firmware handling when kernel-with-firmware is false and fixing LP #1733564. | |
| #1733564 kernel: If 'kernel-with-firmware: false', don't assume /lib/firmware is present | snapcraft (launchpad) | closed | Kernel plugin crashed with FileNotFoundError when kernel-with-firmware was false; fixed by snapcore/snapcraft PR #1750 (commit 2d16ac3c0) which made the plugin skip /lib/firmware handling when firmware is disabled. | |
| #1655008 Kernel plugin: Avoid redownloading os.snap on a local Git repo | snapcraft (launchpad) | closed | Closed as won't fix: the legacy core16/core18 kernel plugin behavior only affects Snapcraft 4.x, which receives fixes only for critical bugs. | |
| #1149 kernel plugin: if kernel's target == NULL, use per-arch default target | snapcraft | closed | Closed unmerged: superseded by snapcraft PR #1209, merged as commit 2b6aee1e9, which adds per-arch kernel build targets (bzImage/zImage/Image.gz) plus unit tests for LP #1665659. |