Problem resetting configuration with no-defaults=no and run-after-reset

Hello. I have this simple file config.rsc:

:delay 30s
/system routerboard mode-button
reset enabled=yes on-event=/system/shutdown

and when I do

/system reset-configuration keep-users=yes no-defaults=no skip-backup=yes run-after-reset=config.rsc

I do not get IP from DHCP and neither manually configuring static IP and trying to access WebFig on http://192.168.88.1 works and I need to use the reset button procedure to restore defaults.

Doing

[admin@hAP] > import file-name=config.rsc 
Script file loaded and executed successfully

works completely ok though.

(Please help me get reset-configuration work WITH defaults AND run-after-reset. Telling me to use no-defaults=yes and dumping the would be defaults into my script would not be helpful. I REALLY want to start from RouterOS defaults and then edit them like /ip address set [find where comment="defconf"] address=192.168.4.1/24 network=192.168.4.0. This is my deliberate wish, not means to some end, however dumb you may find it.)

What could be the problem? I suppose that run-after-reset script is run after applying RouterOS defaults but the example script above should run without problem anyway. Thanks.

Check the logs after the run-after-reset is used. You could have a script error, as import is more forgiving than run-after-reset.

The other possibility is it's a race condition, where the script run before some driver is loaded (wifi/ethernet/etc). Often folk use some :delay 5s at top before using run-after-reset as clunky fix so script waits a bit before starting config. The other approach is to base the run-after-reset script on the style of /system/default-configuration/print.

After connecting via WinBox I've found that log suggests that default-configuration script does not run at all when run-after-resetis specified regardless of no-defauts value. Which seems to be a bug.

Anyway with /system default-configuration script you put me on a right path to a workaround. Currently I begin my run-after-reset script with:

:delay 10s
:local defaultScript [:parse [/system default-configuration script get script]]
$defaultScript action=apply
:delay 10s

and it works beautifully. Thanks.