Showing results for 
Search instead for 
Did you mean: 

libusb on ctrlX CORE

libusb on ctrlX CORE

Established Member


is it somehow possible to install the libusb library on the ctrlX CORE? (Or any other library)

Since apt is not available on the core and it is not enough to stage this library within a snap (as far as I know), I tried to manually copy the files to '/lib' and '/usr/lib' through ssh with a root user. But that doesn't work either (cp: cannot create regular file '/lib/aarch64-linux-gnu/': Read-only file system).

Any other workarounds?

Thanks for your help!


Community Moderator
Community Moderator

In general there are some snaps available on GitHub that uses this lib.

You need the library as stage package and use the plug [raw-usb]. It should be auto connected but as you have root access you could also do it by hand.

I tried exactly that but it is not working. I made the same snap for an Ubuntu-VM (amd64) and the ctrlX CORE (arm64), it works fine on the Ubuntu-VM but not on the CORE. The only difference between the two systems is, that the libusb library is already installed on the Ubuntu-VM.

Annotation 2022-02-21 091633.jpg

Annotation 2022-02-21 091706.jpg

Annotation 2022-02-21 091608.jpg

Annotation 2022-02-21 091839.jpg

Could you please try to set "LD_LIBRARY_PATH=$SNAP/lib...." so the path to the library is known in the snap.

Further it would be good to have some debug information. Please, do a 'set PYUSB_DEBUG=debug' on the command line to define the PYUSB_DEBUG environment variable and post the output. (See snapcraft bug)

Annotation 2022-02-21 105653.jpg

Still not working. I also tried to set the environment variable directly on the command line (export LD_LIBRARY_PATH=/snap/mouse-example/current/lib/aarch64-linux-gnu/) but without any success.

Also, 'set PYUSB_DEBUG=debug' doesn't change the output.

Annotation 2022-02-21 110531.jpg

I have already tried the suggestions from github and but none of them worked. That's why I thought, this could be an issue specific to the ctrlX CORE (or Ubuntu Core). Both of them don't have the libusb library directly on the system.

I really appreciate your help, do you have any other suggestions?

Something I noticed during the build process of the snap:

Annotation 2022-02-21 121636.jpg

- "Unable to determine library dependencies for ...", this is something I have seen in other cross-builds as well, but the snaps worked fine.

- "not a dynamic executable", this could be an issue, since I have never seen this in other builds.

Established Member

I had a quick look into the topic. It seems like pyusb is "hardcoding" where to find the libusb, but you can provide it by code:

backend = usb.backend.libusb1.get_backend(find_library=lambda x: "/snap/my-snap-name/current/lib/x86_64-linux-gnu/")

 Does this work for you?

Actually, I have tried this solution ( before and it didn't work. But for some odd reason, it works now. 

Annotation 2022-02-21 143632.jpg

Nevertheless, thank you for your help!

If you don't mind, there is an other issue where I need help.

Even though the specified usb-mouse with the correct vendor- and product-id is connected to the ctrlX CORE, somehow it is not recognized within the snap.

Annotation 2022-02-21 143558.jpg

(Again, this problem doesn't occur with the mouse connected to the Ubuntu-VM.)

Can you provide the output of dmesg? Is there any hint with regard to "denied"?



You were right, there are logs with 'DENIED'. 

Do you know how to solve this?


Established Member

I was able to solve the problem with an additional plug in snapcraft.yaml

Annotation 2022-02-21 155715.jpg

But I don't know why the 'hardware-observe'-plug is only necessary on the ctrlX CORE and not on the Ubuntu-VM.

Thanks everybody!