[OpenWrt-Devel] How to keep disabled services disabled after sysupgrade

Hannu Nyman hannu.nyman at iki.fi
Thu Jun 18 07:44:23 EDT 2015


I first looked into this 4 years ago and finally figured it out 2 years ago ;-)
https://forum.openwrt.org/viewtopic.php?pid=189700#p189700

There is no built-in way to keep those services installed but disabled.
But there is a go-around that is used e.g. by luci-app-miniupnpd for miniupnpd:
https://github.com/openwrt/luci/blob/master/applications/luci-app-upnp/root/etc/uci-defaults/luci-upnp

Create an uci-defaults script in /etc/uci-defaults and disable the unwanted 
services there.
Include that script as a custom file in the firmware flash, in 
<buildroot>/files/etc/uci-defaults

uci-defaults scripts are run early in the first boot after flash, so the 
script will disable the services early.
Normally uci-defaults scripts are deleted after a succesful run, but by 
setting a non-zero return value you can preserve the scripts even for further 
boots to maintain the disabling behaviour even if the user enables the 
service and reboots.

uci-defaults scripts are difficult to see in a live system as the directory 
/etc/uci-defaults is empty, but you can find the scripts in 
/rom/etc/uci-defaults:
root at OpenWrt:~# ls /etc/uci-defaults/
root at OpenWrt:~# ls /rom/etc/uci-defaults/
00_uhttpd_ubus                10-fstab luci-ddns
01_leds                       10_migrate-shadow luci-sqm
...

Docs at: http://wiki.openwrt.org/doc/uci#defaults



On 18.6.2015 14:28, Stefan Tomanek wrote:
> Can anyone supply any different ideas or provide some feedback?
>
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list