[SOLVED] J-Link Linux installer fails for Docker containers ("Error: Failed to update udevadm rules")

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] J-Link Linux installer fails for Docker containers ("Error: Failed to update udevadm rules")

    Recently, I switched my container's Dockerfile from manual installation to the package manager installation as suggested [1]. However, after doing so, I noticed that packages of new J-Link software pack versions cannot be installed successfully. It works for me up to version 7.82a and stops working from version 7.82b with this error message:

    Source Code

    1. > [4/8] RUN apt-get update -y && apt-get install -y --no-install-recommends [...] /tmp/JLink_Linux_V786b_x86_64.deb [...]
    2. [...]
    3. #7 142.7 Setting up jlink (7.862) ...
    4. #7 142.7 Updating udev rules via udevadm...
    5. #7 142.7 Failed to reload udevadm rules, retrying...
    6. #7 142.7 /var/lib/dpkg/info/jlink.postinst: 18: udevadm: not found
    7. #7 142.7 Error: Failed to update udevadm rules.
    8. #7 142.7 dpkg: error processing package jlink (--configure):
    9. #7 142.7 installed jlink package post-installation script subprocess returned error exit status 1
    10. [...]
    11. #7 144.6 Errors were encountered while processing:
    12. #7 144.6 jlink
    13. #7 144.7 E: Sub-process /usr/bin/dpkg returned an error code (1)
    14. ------
    15. executor failed running [/bin/sh -c apt-get update -y && apt-get install -y --no-install-recommends [...]]: exit code: 100
    Display All

    Searching the net, it looks like I'm not the only one experiencing this issue [2]. However, I do not want to follow the advice to "simply don't execute the post inst actions". [3]


    Could you please make the Linux package install scripts WSL2 and Docker compatible?

    Thanks.

    [1] [SOLVED] "No debuggers were discovered" error coming while flashing using nrfjprog util
    [2] stackoverflow.com/questions/75…comment133382729_75602427
    [3] forums.docker.com/t/udevadm-monitor-in-docker-file/125723/2

    The post was edited 1 time, last by mrf ().

  • Hi,

    For my understanding:
    Are you trying to build a docker image or run an existing docker image?
    So far, the thread you referenced in [2] more or less clearly says it:
    "A Docker container doesn't have access to host devices and isn't running system daemons,[...]"

    The J-Link DEB installer uses udevadm to reload the rules files because a rules file was just copied as part of the installer.
    This is needed to make sure that J-Links are accessible with normal user rights later on.

    You might want to start the udevadm daemon as a step prior to running the DEB installer, as indicated in the last answer here:
    forums.docker.com/t/udevadm-monitor-in-docker-file/125723/2
    Note that the start of the daemon should be part of the same RUN that executes the DEB installer.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • SEGGER - Alex wrote:

    For my understanding:
    Are you trying to build a docker image or run an existing docker image?
    Sorry for being imprecise. The reported issue occurs when trying to build a docker image, cf. my initial sentence:

    mrf wrote:

    Recently, I switched my container's Dockerfile from manual installation to the package manager installation...

    Unfortunately, all your explanations and suggestions are copied from the links I added to my initial post. So, I'm still struggeling to find an appropriate solution.

    Does that mean, I should be going back to install jlink manually when building the Docker container?

    SEGGER - Alex wrote:

    The J-Link DEB installer uses udevadm to reload the rules files because a rules file was just copied as part of the installer.

    Why are packages prior to version 7.82b working fine? Didn't they contain the rules file you are referring to?

    Thanks.
  • If you check the release notes, you will notice a fix for installing the DEB package under WSL2.

    segger.com/downloads/jlink/ReleaseNotes_JLink.html

    This probably has some kind of bad side effect onto installation to docker images.
    Do not know yet. We will have a look but I cannot exactly say when, as schedules are quite full.
    I am confident that there is a solution to make both work, WSL2 installations and installations inside docker containers.
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.
  • The issue is that udev is not installed in docker (and even if it was, service will not work in the container - tried that).

    In order to make it work right now, either remove the postinstall script

    Shell-Script

    1. RUN [...]
    2. && dpkg --unpack JLink_Linux_x86_64.deb \
    3. && rm -f /var/lib/dpkg/info/jlink.postinst \
    4. && dpkg --configure jlink \
    5. && apt install -yf
    or create a dummy `udevadm`, so the postinstall will effectively do nothing

    Shell-Script

    1. RUN echo '#!/bin/bash\necho not running udevadm "$@"' > /usr/bin/udevadm && chmod +x /usr/bin/udevadm \
    2. && [...] && dpkg -i JLink_Linux_x86_64.deb

    Tested with v7.92a.

    The post was edited 2 times, last by radrogow ().