Docker support - reloading udev rules

Post your Linux discussions here
Post Reply
mikolajr
Newbie
Posts: 0
Joined: Fri Sep 11, 2020 3:11 pm

Docker support - reloading udev rules

Post by mikolajr »

Hi,

devices library/driver installations in Docker Linux container gives an error code:

Code: Select all

# apt-get install -y libusbdrdaq
...
E: Sub-process /usr/bin/dpkg returned an error code (1)
This seems to be because of reloading of the udev rules:

Code: Select all

# sh -x /var/lib/dpkg/info/libusbdrdaq.postinst configure 2.0.40-1r2131
+ set -e
+ echo ATTRS{idVendor}=="0ce9", MODE="0666"
...
+ udevadm control --reload-rules
It might actually suffice to just run

Code: Select all

udevadm control --reload-rules && udevadm trigger 
which indeed does not exit the Docker container from: https://unix.stackexchange.com/question ... out-reboot

Could you possibly please add a Docker container support?

daw
Newbie
Posts: 0
Joined: Tue Nov 10, 2020 7:35 pm

Re: Docker support - reloading udev rules

Post by daw »

I have same issue here, I can install the package in the default operating system but not in a docker image.
Anybody who have solved this?

mgartman
Newbie
Posts: 0
Joined: Wed Nov 25, 2020 2:25 pm

Re: Docker support - reloading udev rules

Post by mgartman »

Hi daw!

I stumbled over this problem as well when I wanted to install the driver package for my USB DrDaq board as part of a Dockerfile.

I did some troubleshooting directly inside the docker container:

As mikolajr mentioned, the problem seems to be caused by this line in the post installation script:

Code: Select all

cat /var/lib/dpkg/info/libusbdrdaq.postinst
> # ...
> udevadm control --reload-rules && udevadm trigger --attr-match=idVendor='0ce9'
All the other parts of this script seem to work, since the expected content was written to the files "/etc/ld.so.conf.d/picoscope.conf" and "/etc/udev/rules.d/95-pico.rules".

Nevertheless, when I ran the PicoTech https://github.com/picotech/picosdk-pyt ... on-Wrapper examples, i received the following error:

Code: Select all

picosdk.errors.CannotFindPicoSDKError: PicoSDK (usbdrdaq) not found, check LD_LIBRARY_PATH
I then ran

Code: Select all

udevadm control --reload-rules && udevadm trigger 
manually and, to my surprise, the PicoSDK could be found and the example python scripts worked like a charm.

Therefore, I modified my Dockerfile to look like this:

Code: Select all

FROM node:12.19.0 AS base

RUN apt-get update
RUN apt-get install -y apt-transport-https apt-utils
RUN bash -c 'echo "deb https://labs.picotech.com/debian/ picoscope main" >/etc/apt/sources.list.d/picoscope.list'
RUN wget -O - https://labs.picotech.com/debian/dists/picoscope/Release.gpg.key | apt-key add -

# install DrDaq drivers
# This installation will fail in its post-installation script.
# The demanded drivers are being installed nevertheless.
# So to continue the build of this Dockerfile, status 0 is returned manually.
RUN apt-get install libusbdrdaq -y; exit 0
# manual reload of udev rules
RUN udevadm control --reload-rules && udevadm trigger

# ...
This workaround suits my needs for now, but I hope this flaw gets fixed soon.
Hope this helps anyone with a similiar problem.

Ps.: I also ran

Code: Select all

sudo apt-get install libusbdrdaq 

in my WSL2 Ubuntu 18.04 and got the exact same error. Seems as if the problem occurs not only in docker containers but in other virtual environments as well...

Post Reply