[SOLVED] Unable to install Segger JLink on Linux (udev rules error; possible conflict with STM32CubeIDE)

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

  • [SOLVED] Unable to install Segger JLink on Linux (udev rules error; possible conflict with STM32CubeIDE)

    In trying to install the latest JLink software package with Axel, the local Segger rep:

    I got this error:

    Shell-Script

    1. gabriel ~/Downloads/Install_Files/Segger_J-Link $ sudo dpkg -i JLink_Linux_V646d_x86_64.deb
    2. (Reading database ... 663226 files and directories currently installed.)
    3. Preparing to unpack JLink_Linux_V646d_x86_64.deb ...
    4. Removing /opt/SEGGER/JLink ...
    5. /opt/SEGGER/JLink not found (OK)
    6. Unpacking jlink (6.464) ...
    7. dpkg: error processing archive JLink_Linux_V646d_x86_64.deb (--install):
    8. trying to overwrite '/etc/udev/rules.d/99-jlink.rules', which is also in package segger-jlink-udev-rules 6.44c-3
    9. dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
    10. Errors were encountered while processing:
    11. JLink_Linux_V646d_x86_64.deb
    Display All



    So, I backed up my "/etc/udev/rules.d" directory, removed these 2 rules (command below), and rebooted. It did not fix it, so I restored those 2 files I removed.

    Source Code

    1. sudo rm /etc/udev/rules.d/99-jlink.rules
    2. sudo rm /etc/udev/rules.d/99-jlink.rules.dpkg-dist
    I am unable to install JLink or use JLink Commander. Ozone still works, however, including uploading code to the STM32 from within Ozone.

    I think this may be a conflict with STM32CubeIDE (st.com/en/development-tools/stm32cubeide.html), but don't know for certain. Can anyone confirm they see this error when trying to install JLink as well, with STM32CubeIDE installed?

    Update: It looks like according to this ST thread the only way to install STM32CubeIDE is to remove jlink:

    community.st.com/s/question/0D…4-with-a-dependency-error

    So, you get one or the other. Unfortunately, I really need both. Is there a work-around?

    I just posted this on ST's site too: community.st.com/s/question/0D…ue-to-udev-rules-conflict

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

  • For anyone tracking this, it looks like the STM32CubeIDE installs the Segger JLink tools, so a temporary workaround while Segger and ST work on a proper fix is simply to use the JLink executables provided by the STM32CubeIDE install.

    Here's how I did it:

    First, I needed to know where the CubeIDE was located. Since it shows up in my "Start menu" in Ubuntu, I knew its desktop file was located in "/usr/share/applications/". A quick grep helped me find its desktop file. I can see it is "/usr/share/applications/st-stm32cubeide-1.0.0.desktop":

    Shell-Script

    1. gabriel /opt/st/stm32cubeide_1.0.0 $ ls /usr/share/applications | grep -i cube
    2. STM32CubeMX.desktop
    3. st-stm32cubeide-1.0.0.desktop




    I viewed its contents with:

    Source Code

    1. cat /usr/share/applications/st-stm32cubeide-1.0.0.desktop
    to discover the path to the executable is "/opt/st/stm32cubeide_1.0.0/".


    I then grepped filenames in that directory with this command, in order to look for jlink files:

    Source Code

    1. find /opt/st/stm32cubeide_1.0.0 | grep -ni jlink
    This helped me see that the JLink executables were located here: "/opt/st/stm32cubeide_1.0.0/plugins/com.st.stm32cube.ide.mcu.externaltools.jlink.linux64_1.0.0.201904160814/tools/bin".

    To add this bin folder to my PATH variable so that I can get access to all of the JLink executables, I did the following:

    Edit my "~/.profile" file to add this line to the very bottom:

    Source Code

    1. export PATH="$PATH:/opt/st/stm32cubeide_1.0.0/plugins/com.st.stm32cube.ide.mcu.externaltools.jlink.linux64_1.0.0.201904160814/tools/bin"
    Here's my old "~/.profile" file:


    Source Code

    1. # ~/.profile: executed by the command interpreter for login shells.
    2. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
    3. # exists.
    4. # see /usr/share/doc/bash/examples/startup-files for examples.
    5. # the files are located in the bash-doc package.
    6. # the default umask is set in /etc/profile; for setting the umask
    7. # for ssh logins, install and configure the libpam-umask package.
    8. #umask 022
    9. # if running bash
    10. if [ -n "$BASH_VERSION" ]; then
    11. # include .bashrc if it exists
    12. if [ -f "$HOME/.bashrc" ]; then
    13. . "$HOME/.bashrc"
    14. fi
    15. fi
    16. # set PATH so it includes user's private bin if it exists
    17. if [ -d "$HOME/bin" ] ; then
    18. PATH="$HOME/bin:$PATH"
    19. fi
    Display All
    And now my new "~/.profile" file with the path edited at the bottom to add the JLink executables installed by STM32CubeIDE:


    Source Code

    1. # ~/.profile: executed by the command interpreter for login shells.
    2. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
    3. # exists.
    4. # see /usr/share/doc/bash/examples/startup-files for examples.
    5. # the files are located in the bash-doc package.
    6. # the default umask is set in /etc/profile; for setting the umask
    7. # for ssh logins, install and configure the libpam-umask package.
    8. #umask 022
    9. # if running bash
    10. if [ -n "$BASH_VERSION" ]; then
    11. # include .bashrc if it exists
    12. if [ -f "$HOME/.bashrc" ]; then
    13. . "$HOME/.bashrc"
    14. fi
    15. fi
    16. # set PATH so it includes user's private bin if it exists
    17. if [ -d "$HOME/bin" ] ; then
    18. PATH="$HOME/bin:$PATH"
    19. fi
    20. export PATH="$PATH:/opt/st/stm32cubeide_1.0.0/plugins/com.st.stm32cube.ide.mcu.externaltools.jlink.linux64_1.0.0.201904160814/tools/bin"
    Display All
    Finally, reload this "~/.profile" file in any terminals you have open with this command:


    Source Code

    1. source ~/.profile
    You may have to continue doing this in every new terminal you open, however, so just reboot to be safe.


    You now have access to all of the JLink binary files in the "/opt/st/stm32cubeide_1.0.0/plugins/com.st.stm32cube.ide.mcu.externaltools.jlink.linux64_1.0.0.201904160814/tools/bin" directory, including the following:

    Source Code

    1. gabriel $ ls /opt/st/stm32cubeide_1.0.0/plugins/com.st.stm32cube.ide.mcu.externaltools.jlink.linux64_1.0.0.201904160814/tools/bin
    2. 99-jlink.rules JLinkLicenseManager JLinkSTM32 libQtCore.so.4
    3. Devices JLinkLicenseManagerExe JLinkSTM32Exe libQtCore.so.4.8
    4. Doc JLinkRegistration JLinkSWOViewer libQtCore.so.4.8.7
    5. GDBServer JLinkRegistrationExe JLinkSWOViewerCLExe libQtGui.so
    6. JFlashLiteExe JLinkRemoteServer JTAGLoadExe libQtGui.so.4
    7. JFlashSPI_CL JLinkRemoteServerCLExe libjlinkarm.so libQtGui.so.4.8
    8. JFlashSPICLExe JLinkRemoteServerExe libjlinkarm.so.6 libQtGui.so.4.8.7
    9. JLinkDevices.xml JLinkRTTClient libjlinkarm.so.6.44.3 README.txt
    10. JLinkExe JLinkRTTClientExe libjlinkarm_x86.so Samples
    11. JLinkGDBServer JLinkRTTLogger libjlinkarm_x86.so.6 ThirdParty
    12. JLinkGDBServerCLExe JLinkRTTLoggerExe libjlinkarm_x86.so.6.44.3 x86
    13. JLinkGDBServerExe JLinkRTTViewerExe libQtCore.so
    Display All
  • Heres how I fix.
    The bundle install script.. st-stm32cubeide_1.0.1_3139_20190612_1256_amd64.deb_bundle.sh ..
    creates a temp folder with the same name as the bundle script + .root at the end, and located in the same folder as the install script. Here the install script extracts the bundled deb packages including segger-jlink-udev-rules-6.44c-3-linux-all.deb.

    Folder content
    segger-jlink-udev-rules-6.44c-3-linux-all.deb
    setup.sh
    st-stlink-server-1.2.0-3-linux-amd64.deb
    st-stlink-udev-rules-1.0.0-linux-all.deb
    st-stm32cubeide_1.0.1_3139_20190612_1256_amd64.deb
    -------

    The script setup.sh runs the deb packages using command
    dpkg --refuse-downgrade -i *.deb


    By changing this command in the script before it is running by adding --force-all , the script will succeed installing the rules.
    dpkg --refuse-downgrade -i --force-all *.deb


    One problem though, this folder with script and deb packages are auto generated and removed right after execution.
    You need to halt installation process before this happens, but after the unpacking of the bundle

    This may be done simply by adding --confirm as an option when running the install script

    $ sudo ./st-stm32cubeide_1.0.1_3139_20190612_1256_amd64.deb_bundle.sh --confirm


    The script will then ask when it is about to run the setup.sh script for your confirmation to extract the bundle

    > About to extract 648940 KB in st-stm32cubeide_1.0.1_3139_20190612_1256_amd64.deb_bundle.sh.root ... Proceed ? [Y/n]

    Hit Y to proceed.The bundle is extracted. Then the script asks for permission to execute.:

    > OK to execute: ./setup.sh ? [Y/n]

    When it does, WAIT and do NOT continue, but leave it alone for a while and use your favorite text editor and enter the folder named st-stm32cubeide_1.0.1_3139_20190612_1256_amd64.deb_bundle.sh.root

    It will be in the same folder as where your install script is located

    ...And then open setup.sh as root (!) and edit the dpkg command and save

    $ cd st-stm32cubeide_1.0.1_3139_20190612_1256_amd64.deb_bundle.sh.root
    $ sudo vi setup.sh

    edit --> dpkg --refuse-downgrade -i --force-all *.deb

    Now go back to the install window and continue.
    You will get some warnings, but the rules will install fine