kernel: If 'kernel-with-firmware: false', don't assume /lib/firmware is present

Bug #1733564 reported by Paolo Pisati on 2017-11-21
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Paolo Pisati

Bug Description

In case of 'kernel-with-firmware: false', don't assume /lib/firmware is present, and avoid referencing it later on.

kernel-with-firmware: false

Traceback (most recent call last):
  File "/usr/lib/python3.5/", 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

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>
  File "/usr/lib/python3/dist-packages/click/", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/", line 1037, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/home/flag/canonical/snapcraft/snapcraft/cli/", line 124, in run
  File "/usr/lib/python3/dist-packages/click/", line 552, in forward
    return self.invoke(cmd, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 534, in invoke
    return callback(*args, **kwargs)
  File "/home/flag/canonical/snapcraft/snapcraft/cli/", line 140, in snap
    project_options, directory=directory, output=output)
  File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/", line 45, in snap
    execute('prime', project_options)
  File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/", line 80, in execute
    _Executor(config, project_options).run(step, part_names)
  File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/", line 175, in run
    self._run_step(step, part, part_names)
  File "/home/flag/canonical/snapcraft/snapcraft/internal/lifecycle/", line 212, in _run_step
    getattr(part, step)()
  File "/home/flag/canonical/snapcraft/snapcraft/internal/pluginhandler/", line 330, in build
  File "/home/flag/canonical/snapcraft/snapcraft/plugins/", line 258, in build
  File "/home/flag/canonical/snapcraft/snapcraft/plugins/", line 479, in do_install
    os.path.join(self.installdir, 'lib', 'firmware'), self.installdir)
  File "/usr/lib/python3.5/", line 552, in move
    copy_function(src, real_dst)
  File "/usr/lib/python3.5/", line 251, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/lib/python3.5/", 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'

Kyle Fazzari (kyrofa) wrote :

Hey Paolo, thanks for the bug. For the sake of those of us who aren't kernel pros, would you mind explaining exactly what the issue is, here? What is /lib/firmware, why would one have a kernel without it, and why is this only surfacing now?

Changed in snapcraft:
status: New → Incomplete
Paolo Pisati (p-pisati) wrote :

During the 4.14+ cycle, the 'make firmare_install' target was completely removed from upstream, and any invokation of that target result in an error now:

The kernel plugin, by default, invoked that step unless 'kernel-with-firmware: false' was specified, but even in that case, later on, it would blindly dereference /lib/firmware (where by default 'make firmare_install' installed the firmware binaries) resulting in the above error.

Why it surfaces only now? Because no one has used that feature in a while, but now we need it - IOW, without this feature, every recent kernel snap build is impossible.

Kyle Fazzari (kyrofa) wrote :

Exactly the info I wanted, thank you!

Changed in snapcraft:
status: Incomplete → In Progress
importance: Undecided → High
assignee: nobody → Paolo Pisati (p-pisati)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers