Parts/usbutils/insrtall is empty, prime fails

I’m trying to build a snap of usbutils based on this repo (My repo, which adds an install hook and refactors a few things, is here).

The primary difference is how it builds. It seems like the old repo is incomplete, so I copied the build instructions from usbutils.

So here’s my snapcraft.yaml:

name: usbutils
version: None
summary: USB utilities for Linux, including lsusb
description: |
  USB utilities for Linux, including lsusb. Make sure you connect the
  raw-usb and network-control interfaces with

  snap connect usbutils:network-control :network-control
  snap connect usbutils:raw-usb :raw-usb

  Though that should now be done for you ;)
grade: stable
confinement: strict

    command: bin/lsusb
    plugs: [network-control, raw-usb]
    command: bin/usb-devices
    plugs: [raw-usb]
  # XXX only works in devmode; permission error with
  # `sudo usbutils.usbhid-dump`, but this should be granted by raw-usb?!
  # libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/00m/00n: O
peration not permitted
    command: bin/usbhid-dump
    plugs: [network-control, raw-usb]

    plugin: autotools
      usr/bin: bin
    build-packages: [libudev-dev, libusb-1.0-0-dev, pkg-config]
    override-build: |
      git submodule init
      git submodule update
      autoreconf --install --symlink
      make install

The issue, is that this gives me errors:

Sorry, an error occurred in Snapcraft:
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==2.43.1+18.4', 'console_scripts', 'snapcraft')()
  File "/usr/lib/python3/dist-packages/click/", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/", line 1043, in invoke
    return Command.invoke(self, ctx)
  File "/usr/lib/python3/dist-packages/click/", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/", line 535, 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 "/usr/lib/python3/dist-packages/snapcraft/cli/", line 93, in run
  File "/usr/lib/python3/dist-packages/click/", line 553, in forward
    return self.invoke(cmd, **kwargs)
  File "/usr/lib/python3/dist-packages/click/", line 535, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/", line 136, in snap
    project = _execute(steps.PRIME, parts=[], **kwargs)
  File "/usr/lib/python3/dist-packages/snapcraft/cli/", line 35, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/", line 90, in execute, part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/", line 196, in run
    self._create_meta(step, processed_part_names)
  File "/usr/lib/python3/dist-packages/snapcraft/internal/lifecycle/", line 359, in _create_meta
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 109, in create_snap_packaging
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 312, in write_snap_yaml
    snap_yaml = self._compose_snap_yaml()
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 468, in _compose_snap_yaml
    snap_yaml["apps"] = self._wrap_apps(self._config_data["apps"])
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 567, in _wrap_apps
    self._wrap_app(app, apps[app])
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 575, in _wrap_app
    app[k] = self._wrap_exe(app[k], "{}-{}".format(k, name))
  File "/usr/lib/python3/dist-packages/snapcraft/internal/meta/", line 546, in _wrap_exe
    with open(exepath, "rb") as exefile:
FileNotFoundError: [Errno 2] No such file or directory: '/home/wnilges/Documents/telig-ubuntu-core-updates/usbutils-snap/prime/bin/lsusb'
We would appreciate it if you created a bug report at with the above text included.

f7u12! But I found this thread which suggests that I just need to organize:

But, parts/usbutils/install is empty. That’s because usbutils seems to drop its builds into the base repo, which is in parts/usbutils/build.

$ ls
aclocal.m4      config.status  desc-dump.h  lsusb.c           missing            usb-devices       usbmisc.h      configure      install-sh   lsusb-desc-defs.o      names.c            usb-devices.1     usbreset
autom4te.cache   LICENSES     lsusb-desc-dump.o  lsusb-t.c        names.h    usbreset.c
compile         depcomp        list.h       lsusb.h            lsusb-usbmisc.o  NEWS               usbhid-dump       usbreset.o
config.h        desc-defs.c    lsusb        lsusb-lsusb.o      Makefile          usbhid-dump.8     usb-spec.h     desc-defs.h    lsusb.8      lsusb-lsusb-t.o      stamp-h1   usbutils.spdx
config.log      desc-dump.c   lsusb-names.o  usbmisc.c

Any ideas? What do I do about this? How can I get snapcraft to see the binaries?

have you checked prime/bin and prime/usr/bin … (or simply tried to call find prime/ -name '*lsusb*') ?
(my guess would be that the organize statement does not what you expect)

1 Like

You have an override-build. I suspect you need to correctly set the DESTDIR for make install to get it to install to the correct location.

Something like DESTDIR=$SNAPCRAFT_PART_INSTALL make install should do the trick.

1 Like

It definitely doesn’t :sweat_smile:

the only thing in prime is meta.

Just to confirm, DESTDIR=$SNAPCRAFT_PART_INSTALL make install worked for you? I gave it a test with that and base: core18 added - which did the trick.

Apologies, seems I forgot to reply!

Yes, I got it to build! Unfortunately, I can’t go into the office and test it this week because I’m still quarantined, but it does build!

Here’s the updated snapcraft.yaml