Community discussions

MikroTik App
 
User avatar
TheStaticTurtle
just joined
Topic Author
Posts: 3
Joined: Thu Oct 05, 2023 6:04 pm
Contact:

Netinstall how to run custom setup script without default configuration

Thu Mar 13, 2025 4:42 pm

Hi,

I'm trying to improve our deployment process for new-in-box routers and decided to go the netinstall route.

I wrote a custom setup script which starts like this:
/system/identity/set name=****************

/user/set [ find name=admin ] password="*****************************"

/system/note/set show-at-login=no

/interface/list/add name=WAN
/interface/list/add name=LAN

My netinstall command is the following:
./netinstall-cli -v -s reset-conf-out.rsc -i eth0 routeros-7.16-arm64.npk wifi-qcom-7.16-arm64.npk container-7.16-arm64.npk

But after reboot the configuration is applied but fails almost immediately with:
system,error,critical error while running autorun.scr script: failure: already have interface list with such name

I was under the impression that if I specified a custom script, the default configuration wouldn't get applied, apparently I was wrong and both get applied.

Our install script is meant to run on an empty configuration.
Is there any way to skip the default configuration or to clear it in the setup script? (Using /system/reset-configuration would just boot-loop)

The best I can come up with is either:
  • Run netinstall-cli twice, once with -e and once with -s
  • Manually clear everything with the risk of missing something if the default config ever changes
Another question I had is if there would be any way to change the device-mode during install (without user-interaction or at least without rebooting)

I am aware that using /system/reset-configuration run-after-reset=myscript.rsc is a possibility, but that implies more steps just to get to a terminal

I am also aware of branding, but I can't get it to apply the default configuration

Thanks
 
User avatar
stewiem2000
just joined
Posts: 3
Joined: Tue Jun 18, 2019 1:13 pm

Re: Netinstall how to run custom setup script without default configuration

Thu Mar 20, 2025 7:19 pm

I've just run into this too whilst trying to recover a wAP ax² that ran out of space 😐

For me, I had to run netinstall-cli twice: once with -e to clear everything out, then again with -s.

It would definitely be handy if these two options weren't mutually exclusive!
 
User avatar
patrikg
Member
Member
Posts: 406
Joined: Thu Feb 07, 2013 6:38 pm
Location: Stockholm, Sweden

Re: Netinstall how to run custom setup script without default configuration  [SOLVED]

Thu Mar 20, 2025 8:04 pm

As you can see in the change log in the newest version, that function is now in netinstall-cli.
What's new in 7.19beta6 (2025-Mar-19 09:56):
*) netinstall-cli - clear old configuration before user script using "-s";
 
User avatar
infabo
Forum Guru
Forum Guru
Posts: 1656
Joined: Thu Nov 12, 2020 12:07 pm

Re: Netinstall how to run custom setup script without default configuration

Thu Mar 20, 2025 8:08 pm

"-s userscript Pre-configures the device with the provided configuration (text file in .RSC format), removing the existing configuration before applying the new one. This configuration also replaces the default configuration."
https://help.mikrotik.com/docs/spaces/R ... figuration.

This is what help docs say. But as usual: nobody knows for which exact version this doc applies.
 
User avatar
TheStaticTurtle
just joined
Topic Author
Posts: 3
Joined: Thu Oct 05, 2023 6:04 pm
Contact:

Re: Netinstall how to run custom setup script without default configuration

Mon Mar 24, 2025 11:40 am

Hi,

As you can see in the change log in the newest version, that function is now in netinstall-cli.

Ah, I missed that, I don't usually follow the changelog for beta version!

But I can confirm that this works with 7.19beta6, my script successfully provision most of the router configuration.

This is what help docs say. But as usual: nobody knows for which exact version this doc applies.

True, it would be nice if they versioned the docs with some resemblance to the mikrotik version

The last step that really hinders the setup is to enable containers, which, as far as I know, requires a manual reboot, but it would be awesome if it could be enabled using netinstall.
But I'm not sure if this is doable!

Thanks for your help!
 
User avatar
patrikg
Member
Member
Posts: 406
Joined: Thu Feb 07, 2013 6:38 pm
Location: Stockholm, Sweden

Re: Netinstall how to run custom setup script without default configuration

Mon Mar 24, 2025 12:08 pm

Thank you for confirming that this solution get to your target.
I think Mikrotik staff was reading your thread, and build a new version of netinstall-cli with your request. ;)

You should also take a look at the tr069 technology to provision router config.
 
User avatar
TheStaticTurtle
just joined
Topic Author
Posts: 3
Joined: Thu Oct 05, 2023 6:04 pm
Contact:

Re: Netinstall how to run custom setup script without default configuration

Mon Mar 24, 2025 12:49 pm

Hi,

Yeah, that was pretty good timing!

I did quickly look at tr069, but doesn't it require having a public IP on at least one side?
Our system doesn't really allow that, but we have very little to do remotely, so it isn't a big issue.

Thanks!
 
sette
just joined
Posts: 19
Joined: Mon Mar 12, 2012 11:53 am

Re: Netinstall how to run custom setup script without default configuration

Tue Mar 25, 2025 11:29 am

Hi, some days ago i had the same problem.
I'm using 6.49 version of netinstall and of routeros on rb750r2.

In the past already deployed hundreds of them specifying the script with -s namefile.rsc and it deletes the default configuration and apply only my script.

Last week new devices started acting like you described.
What i saw is that:
- sometimes it keeps the default and start applying the new configuration and fails. If i login to the router (after netinstall) and I did a RESET configuration to default it APPLIES correctly my script and everything is fine!
- sometimes configuration is applied but probably not completely (for example led is not blinking :) ), also in that case a RESET let it works correctly!

honestly i think that something changed on the routerboard itself, not on the software. I don't know if mikrotik have an answer to this :)

thanks!