Skip to main content
ST Migration account
ST Community Manager
August 22, 2026
Solved

[ERROR - Linux] Stm32CubeMX2 - unable to find a random port on any host

  • August 22, 2026
  • 8 replies
  • 47 views

This account only shares restored community content posted by members between May 22 and June 9, 2026, who did not register for the new community.


Hello,

 

I am currently facing a strange error when trying to create a project with any MCU/Board on Linux.

As shown on the screenshots, an error appears on dependencies download :

 

Unable to find a random port on any host GetPortError:

Unable to find a random port on any ...

 

And it spin indefinitly. 

This error seems to be related to Electron rather than the soft itself, but I can hardly follow the execution path of stm32CubeMX2 to know where I could maybe enforce another port.

 

Did anyone already encountered this bug ? 

Thanks.

Best answer by ST Migration account

Hello Oussama,

I have tried both removing and commenting this line (127.0.0.1 localhost), but it didn't change anything.

However, thanks to your suggestion about /etc/hosts and this issue nuxt issue 19068, I figured out that my $HOST variable was set to :
HOST=MyPrecious

Thus, it tried to find a port for MyPrecious, which is not a valid host !

Thus adding it to /etc/hosts with a given IP:

127.0.0.1 localhost 127.0.2.1 MyPrecious

 

Solved the problem !!! Thus, you should make sure that if $HOST is defined, it HAS TO BE GIVEN an IP in /etc/hosts.

Thus, my problem is solved.

I hope that it will help others !

 

Thank you Oussama for your time,

Laurent.

8 replies

Oussama_TROUDI
ST Technical Moderator
August 22, 2026

Hi  and welcome to ST Community,

Thank you for reporting this issue.

Could you please try launching STM32CubeMX2 from the command line in debug mode with the following command:

cube mx start --log-level debug 

After that, please share the relevant log files with us so we can investigate further. You can find them under:

/home//.local/share/stm32cube/logs 

Press Ctrl + H to toggle hidden files and folders, such as .local.

Best regards,
Oussama.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
ST Migration account
ST Community Manager
August 22, 2026

Hi oussama,

You can find attached my log file.
The important lines are:
2026-05-26T09:14:42.209Z [Debug] [ProjectSetupWidget#handleValidation] Creating application project from Board
2026-05-26T09:14:42.211Z [Debug] [ProjectCreationComponent#getProjectCreationForm] Render get project creation form
2026-05-26T09:14:42.328Z [Error] Uncaught Exception: GetPortError: Unable to find a random port on any host
2026-05-26T09:14:42.328Z [Error] GetPortError: Unable to find a random port on any host
at S (/scratch/softs/STM32CubeMX2/resources/stm32cubemx-application/1.0.1/dist/resources/app/lib/backend/main.js:2903:8475)
at async /scratch/softs/STM32CubeMX2/resources/stm32cubemx-application/1.0.1/dist/resources/app/lib/backend/main.js:356:222566
at async r (/scratch/softs/STM32CubeMX2/resources/stm32cubemx-application/1.0.1/dist/resources/app/lib/backend/main.js:431:285270)
at async b.dynamicValue (/scratch/softs/STM32CubeMX2/resources/stm32cubemx-application/1.0.1/dist/resources/app/lib/backend/main.js:431:285528)

 

Thanks for your interest.

Laurent.

This account only shares restored community content posted by members between May 22 and June 9, 2026, who did not register for the new community.
Oussama_TROUDI
ST Technical Moderator
August 22, 2026

Hi  
Could you please provide more details about the environment (OS, version of OS ...)?

Best regards,
Oussama.

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
ST Migration account
ST Community Manager
August 22, 2026

Hi,

I am working on Ubuntu 24.04.4 LTS.
I already have STM32CubeMX installed (6.17.0; /home/lcadet/STM32CubeMX). I also have STM32CubeMX2 installed.

>>> cube --version
cube wrapper version: 0.10.2
cube wrapper running on: x86_64-unknown-linux
cube wrapper installed at '/home/lcadet/.local/stm32cube/bin/cube'

PATH= /home/lcadet/.local/stm32cube/bin: ....

 

when calling STM32CubeMX2 from application serach (SUPER+{search}), it runs :
/scratch/softs/STM32CubeMX2/resources/stm32cubemx-application/1.0.1/dist/stm32cubemx2

ps -fp {PID} return:
UID PID PPID C STIME TTY TIME CMD
lcadet 98920 98468 5 16:41 ? 00:00:15 /proc/self/exe --type=renderer --enable-crash-reporter=1bdb2ea0-e207-4d14-b9db-9b3efbd939e3,no_channel --user-data-dir=/home/lcadet/.config/STM32CubeMX2 --app-path=/scratch/softs/STM32CubeMX2/resources/stm32cubemx-application/1.0.1/dist/resources/app --no-sandbox --no-zygote --no-sandbox --lang=en-US --num-raster-threads=4 --enable-main-frame-before-activation --renderer-client-id=4 --time-ticks-at-unix-epoch=-1780303482624865 --launch-time-ticks=21400680857 --shared-files=v8_context_snapshot_data:100 --field-trial-handle=3,i,9117161096884650414,15039438768759429813,262144 --enable-features=PdfUseShowSaveFilePicker --disable-features=ScreenAIOCREnabled,SpareRendererForSitePerProcess --variations-seed-version

Do you need more info ?

 

Laurent.

 

This account only shares restored community content posted by members between May 22 and June 9, 2026, who did not register for the new community.
Oussama_TROUDI
ST Technical Moderator
August 22, 2026

Hello  

Please try the following workaround by adding the host name to /etc/hosts.

  1. Open a terminal.
  2. Edit the file with root privileges:   sudo nano /etc/hosts
  3. dd or update this line:  127.0.0.1 localhost
  4. Save the file and exit.

Please let me know whether this works for you.

Regards
Oussama

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Oussama_TROUDI
ST Technical Moderator
August 22, 2026

Thanks for sharing the logs  

I'm currently working on this issue; I'll get back to you ASAP.

Internal ticket number: CDM0063073, (This is an internal tracking number and is not accessible or usable by customers).

Regards,
Oussama

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Oussama_TROUDI
ST Technical Moderator
August 22, 2026

Hello  

Thank you for the update. Im glad to hear that the issue is resolved.

Best regards,
Oussama

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
ST Migration account
ST Migration accountAuthorBest answer
ST Community Manager
August 22, 2026

Hello Oussama,

I have tried both removing and commenting this line (127.0.0.1 localhost), but it didn't change anything.

However, thanks to your suggestion about /etc/hosts and this issue nuxt issue 19068, I figured out that my $HOST variable was set to :
HOST=MyPrecious

Thus, it tried to find a port for MyPrecious, which is not a valid host !

Thus adding it to /etc/hosts with a given IP:

127.0.0.1 localhost 127.0.2.1 MyPrecious

 

Solved the problem !!! Thus, you should make sure that if $HOST is defined, it HAS TO BE GIVEN an IP in /etc/hosts.

Thus, my problem is solved.

I hope that it will help others !

 

Thank you Oussama for your time,

Laurent.

This account only shares restored community content posted by members between May 22 and June 9, 2026, who did not register for the new community.