Getting JLINK_HasError() when running nrfjprog commands to nrf52832 from inside a docker container with --device settings

Hi, Im trying to use nrfjprog from inside a docker container (ubuntu). I have started the container with --privileged and it seem to work but when i try to run the container with --device=/dev/serial/by-id/usb-SEGGER_XXX for example nrfjprog --deviceversion gives the following error message bellow. nrfjprog -i seem to work in both with --privileged and --device


ERROR: [ Client] - stderr: JLinkGUIServerExe: cannot connect to X server
ERROR: Unable to connect to a debugger.
ERROR: [SeggerBackend] - JLinkARM.dll Open returned error 'Cannot connect to J-Link.'
ERROR: [SeggerBackend] - JLinkARM.dll Open returned error 'Failed to open DLL'
ERROR: JLinkARM DLL reported an error. Try again. If error condition
ERROR: persists, run the same command again with argument --log, contact Nordic
ERROR: Semiconductor and provide the generated log.log file to them.

Is there anything more that needs to be configured to be able to fully use nrfjprog from withing a docker image with --device and not --privileged?

Parents
  • Hi,

    Do you have multiple debuggers or DKs connected to the computer? I ask because that is the only time I can think of where nrfjprog will use any GUI, and the problem here seems to be with X forwarding. To avoid GUI, it should be possible to instead list connected devices using "nrfjprog -i" and then specify which to use using "nrfjprog --snr <serial number>"

  • Hi, there is mutiple debuggers. Maybe the nrfjprog --deviceversion was a bad example since its not the main use case. For example this command is used (and not working with the device setting in the first post):
    nrfjprog -s xxx --readuicr --readcode xxx.hex

    it works in docker image with --device=/dev/bus/usb/001/xxx, (but that path can change).  --device-cgroup-rule='c 189:* rmw' also works combined with -v /dev:/dev but is not compatible with the rest of our environment.

    So is there any other settings that could be used for a docker container to have full access to the debugger with a "static" path to the cards?

    EDIT:

    I also tested to create a symlink to dev/bus/usb/001/xxx and then use --device=$(readlink symlink_path), and that worked. 
    but -device=$(readlink /dev/serial/by-id/usb-SEGGER..), did not work. Got "docker: ../../ttyACM1 is not an absolute path"

Reply
  • Hi, there is mutiple debuggers. Maybe the nrfjprog --deviceversion was a bad example since its not the main use case. For example this command is used (and not working with the device setting in the first post):
    nrfjprog -s xxx --readuicr --readcode xxx.hex

    it works in docker image with --device=/dev/bus/usb/001/xxx, (but that path can change).  --device-cgroup-rule='c 189:* rmw' also works combined with -v /dev:/dev but is not compatible with the rest of our environment.

    So is there any other settings that could be used for a docker container to have full access to the debugger with a "static" path to the cards?

    EDIT:

    I also tested to create a symlink to dev/bus/usb/001/xxx and then use --device=$(readlink symlink_path), and that worked. 
    but -device=$(readlink /dev/serial/by-id/usb-SEGGER..), did not work. Got "docker: ../../ttyACM1 is not an absolute path"

Children
Related