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...

cristi_hydrax
Newbie
Posts: 0
Joined: Fri Oct 15, 2021 11:50 am

Re: Docker support - reloading udev rules

Post by cristi_hydrax »

I am facing the same issue, trying to make this run in Docker.
Why do I try running this in docker? The libraries from pico are not available in Arch linux repo, so I got the from the debian repo, converted them with `debtap` and installed them, but that didn't work. So next was to make this work in Ubuntu, which is supposed to be supported.

My docker file is the following and same error returns upon installing picoscope. I am not sure where to start investigating this though.

Code: Select all

ROM ubuntu:18.04

LABEL org.opencontainer.image.authors="X"

ADD pico /root/pico

RUN apt-get update && apt-get upgrade -y && apt-get install -y vim wget apt-utils ca-certificates gnupg udev usbutils

RUN  bash -c "echo 'deb https://labs.picotech.com/debian/ picoscope main' >/etc/apt/sources.list.d/picoscope.list"

RUN wget https://labs.picotech.com/debian/dists/picoscope/Release.gpg.key && apt-key add Release.gpg.key && apt-get update

RUN apt-get install -y -q picoscope

fantognazza
Newbie
Posts: 0
Joined: Thu Nov 09, 2023 4:41 pm

Re: Docker support - reloading udev rules

Post by fantognazza »

Containers usually do not mount `/dev/` path, thus there is no use of udevadm.
Just create a link to /bin/true during the installation, and remove it afterwards:

Code: Select all

RUN curl -fsSL https://labs.picotech.com/Release.gpg.key | gpg --dearmor > /usr/share/keyrings/picotech-archive-keyring.gpg \
    && echo "deb [signed-by=/usr/share/keyrings/picotech-archive-keyring.gpg] https://labs.picotech.com/picoscope7/debian/ picoscope main" > /etc/apt/sources.list.d/picoscope7.list \
    && ln /bin/true /usr/bin/udevadm \
    && mkdir -p /etc/udev/rules.d/ \
    && apt-get update \
    && apt-get install --no-install-recommends -y \
        libps5000 \
        libps5000a \
    && rm /usr/bin/udevadm \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

Post Reply