STM32 ST LINK not working on Linux
These are my personal notes I wrote to myself a while back. See if they work for you too. Some of the filenames and versions may be slightly more up-to-date now, but I think this should be what you need. I look forward to hearing back from you to hear if this works for you.
STM32CubeProgrammer Linux install instructions:
Help manual: UM2237, here: https://www.st.com/en/development-tools/stm32cubeprog.html --&gt; download link at bottom; direct link.

Download &amp; install STM32CubeProgrammer: https://www.st.com/en/development-tools/stm32cubeprog.html#get-software --&gt; click &quot;Get Software&quot; download button.

Download STSW-LINK007 (ST-LINK, ST-LINK/V2, ST-LINK/V2-1 firmware upgrade) tool: https://www.st.com/en/development-tools/stsw-link007.html.

Extract the zip file, but do not install it. There is no need to install it, as this tool comes built-in to the STM32CubeProgrammer tool above too, and all we really need from this STSW-LINK007 zip file is the readme and some udev rules.

Reference the readme here: stsw-link007_2.32.22/readme.txt, or even better, the readme here: stsw-link007_2.32.22/AllPlatforms/StlinkRulesFilesForLinux/Readme.txt

Install the udev rules:
cd stsw-link007_2.32.22/AllPlatforms/StlinkRulesFilesForLinux
sudo cp *.* /etc/udev/rules.d




Referencing section 1.2.1 of UM2237 (download link above):
sudo apt-get install libusb-1.0.0-dev

Reload udev rules (source: https://unix.stackexchange.com/a/39371/114401):
sudo udevadm control --reload-rules &amp;&amp; udevadm trigger

Unplug and plug in the STLink programmer.

Open and Run STM32CubeProgrammer GUI to verify things.

Make a symbolic link to the programmer CLI executable so we can run it as STM32_Programmer_CLI:
mkdir -p ~/bin
sudo ln -s ~/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/STM32_Programmer_CLI \
~/bin/STM32_Programmer_CLI


If this is the first time ever creating and using your ~/bin directory, where we just placed the executable symbolic link above, log out and log back in to have Ubuntu automatically place this folder into your PATH.

Now flash your chip with the programmer. Example flash command:
(Refer to UM2237--link above--for more info on commands.)
# connect, erase all, write, and verify; Note: the `-e all` option
# to &quot;erase all&quot; is NOT necessary, as erasing the sectors to be 
# flashed is automatic when you do the write (`-w`) command!
# The `0x8000000` part specifies the starting address in the chip to
# start programming. Leave this off to use the chip's default
# programming start address, or, adjust this address to your specific
# needs for your chip.
STM32_Programmer_CLI -c port=SWD -w my_hex_file.hex 0x8000000 -v