Changing the port of the www service says it is configured elsewhere

Hi,

I use a semi-automated configuration script to set up new routers (blank config).
I just updated our processes to use ROS 7.19.1.

We host a container on the router itself that uses port 80 so before deploying said container, the script changes the port of the www service to 81.

However, today I configured new routers and I have a strange issue.
Sometimes executing the command

/ip/service/set www port=81

returns

failure: this is configured elsewhere

I slightly modified the script to add a print before changing the port:

[admin@BCLRTR146] > /ip/service/print
Flags: D - DYNAMIC; X - DISABLED, I - INVALID; c - CONNECTION
Columns: NAME, PORT, PROTO, CERTIFICATE, VRF, MAX-SESSIONS, LOCAL, REMOTE
 #     NAME                   PORT  PROTO  CERTIFICATE  VRF   MAX-SESSIONS  LOCAL           REMOTE             
 0     ftp                      21  tcp                 main            20                                     
 1     ssh                      22  tcp                 main            20                                     
 2     telnet                   23  tcp                 main            20                                     
 3 D   resolver                 53  tcp                                                                        
 4 D   resolver                 53  udp                                                                        
 5 D   dhcp                     67  udp                                                                        
 6 D   dhcpclient               68  udp                                                                        
 7     www                      80  tcp                 main            20                                     
 8 D c www                      80  tcp                                     192.168.25.254  192.168.25.75:52891
 9 D c www                      80  tcp                                     192.168.25.254  192.168.25.75:52892
10 D c www                      80  tcp                                     192.168.25.254  192.168.25.75:52893
11 D c www                      80  tcp                                     192.168.25.254  192.168.25.75:52894
12 D c www                      80  tcp                                     192.168.25.254  192.168.25.75:52895
13 D c www                      80  tcp                                     192.168.25.254  192.168.25.75:52896
14 D   ntp                     123  udp                                                                        
15 D   snmp                    161  udp                                                                        
16  X  www-ssl                 443  tcp    none         main            20                                     
17 D   btest                  2000  tcp                                                                        
18 D   discover               5678  udp                                                                        
19     winbox                 8291  tcp                 main            20                                     
20 D c winbox                 8291  tcp                                     192.168.25.254  192.168.25.75:61855
21     api                    8728  tcp                 main            20                                     
22     api-ssl                8729  tcp    none         main            20                                     
23 D   wireguard-wireguard1  47680  udp

This wasn’t an issue before (I jumped from 7.16 to 7.19.1 directly, so I don’t know exactly when it started happening).
I reduced the amount of time this happens by adding some delay commands, but it still pops from time to time.
Once the copy-paste has finished executing, if there was an issue I can simply re-type the command and it works fine.

Any idea where this could come from?
Thanks,
Samuel.

/ip/service
set [find dynamic =no and name =ssh] port=2222 disabled=no

I did notice that it displayed way more things in services.
It appears that this was changed in 7.19:

*) ip-service - show all TCP/UDP connections on the system;
*) ip-service - show all TCP/UDP ports on system, including ports in containers;
*) ip-service - show error message when service enable fails;

I don’t have enought equipment to test it, but I think that filtering dynamic entries should do it!

Thanks!

This script does not work with older version. Here is something that is backwards compatible;

:do {:local s [/ip service find where name="ssh"]; :if ([:len $s] > 0) do={/ip service set $s port=65022 disabled=no}} on-error={}
:do {:local w [/ip service find where name="winbox"]; :if ([:len $w] > 0) do={/ip service set $w port=65091}} on-error={}