[SOLVED] Trouble connecting JLink USB in Linux dev container

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

  • [SOLVED] Trouble connecting JLink USB in Linux dev container

    My OS is Linux Mint 21.2, using Docker Desktop. I'm working with VS Code remote containers. My container has JLink installed with dependencies with notes from this thread UDEVADM JLink Container Solution.

    Using root user and a basic container to get things up before dialing down, I can't seem to access my USB JLink.

    Source Code

    1. root@ae1709e223cc:/# JLinkExe
    2. SEGGER J-Link Commander V7.92m (Compiled Oct 26 2023 16:20:35)
    3. DLL version V7.92m, compiled Oct 26 2023 16:20:12
    4. Connecting to J-Link via USB...FAILED: Cannot connect to J-Link.
    5. root@ae1709e223cc:/#

    This does work under my OS installed JLink outside of the container.

    I'm not sure what to try next. Is there a log somewhere?

    Has anyone had this issue?

    Maybe a permissions recommendation? The container is marked as privledged in VSCode ("privileged": true in devcon json).




    Support info:

    1. In my linux desktop I have a /dev/bus/usb/021 which is currently my JLink (no persistent name, but that's OK for now). In my Container I have no matching folder. I assume there may be differences in my Linux Mint (Ubuntu based) Desktop and Ubuntu 22.4 Container... But I think this is a big clue. I don't seem to have USB in the container... Looking for a solution because Segger's own container guide doesn't mention this at all.


    2. I noticed other JLink Utils will not start. I suspect this is because most of the pop up a GUI? These do work in my OS version.

    Source Code

    1. root@ae1709e223cc:/# JLinkGDBServerExe
    2. JLinkGDBServerExe: error while loading shared libraries: libXrandr.so.2: cannot open shared object file: No such file or directory
    3. root@ae1709e223cc:/#


    3. Somehow and from somewhere, a .reg file was created on my linux container's root folder. No idea what this is!


    Source Code

    1. -rw-r--r-- 1 root root 725 Oct 29 22:22 SEGGER_REG_HKEY_CURRENT_USER.xml
    2. <Registry>
    3. <Software>
    4. <SEGGER LogFileJLink="" LogFileJLink_SEGGERRegType="SYS_REG_TYPE_SZ">
    5. <J-Link StartMinimized="0x00000001" StartMinimized_SEGGERRegType="SYS_REG_TYPE_DWORD" StayOnTop="0x00000001" StayOnTop_SEGGERRegType="SYS_REG_TYPE_DWORD" LogIsHalted="0x00000001" LogIsHalted_SEGGERRegType="SYS_REG_TYPE_DWORD" LogInternal="0x00000001" LogInternal_SEGGERRegType="SYS_REG_TYPE_DWORD" OverrideConfigFile="0x00000000" OverrideConfigFile_SEGGERRegType="SYS_REG_TYPE_DWORD" OverrideLogFile="0x00000000" OverrideLogFile_SEGGERRegType="SYS_REG_TYPE_DWORD" ConfigFile="" ConfigFile_SEGGERRegType="SYS_REG_TYPE_SZ" LogFile="" LogFile_SEGGERRegType="SYS_REG_TYPE_SZ"/>
    6. </SEGGER>
    7. </Software>
    8. </Registry>
    Display All

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

  • Solved.

    The very short answer is that Docker Desktop for Linux is not ready, don't use it. At a very minimum it does not seem to pipe USB or /dev through even when specifically requested.

    Uninstalled it. Installed the engine and utils instead. Had to edit .docker/config.json to remove "credsStore", but now it works perfectly in VS Code. USB pipes through with no special work in the Dockerfile or devcontainer config.