| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision |
| docs:guide-user:base-system:uci [2022/05/12 11:19] – [Configuration files] stokito | docs:guide-user:base-system:uci [2023/10/06 04:24] – [Configuration files] update vgaetera |
|---|
| |
| Upon changing a UCI configuration file, whether through a text editor or the command line, the services or executables that are affected must be (re)started (or, in some cases, simply reloaded) by an [[docs:techref:initscripts|init.d call]], such that the updated UCI configuration is applied to them. | Upon changing a UCI configuration file, whether through a text editor or the command line, the services or executables that are affected must be (re)started (or, in some cases, simply reloaded) by an [[docs:techref:initscripts|init.d call]], such that the updated UCI configuration is applied to them. |
| Many programs are made compatible with UCI in this way by making their init.d script write their standard software specific configuration files. | Many programs are made compatible with UCI by simply making their init.d script first update their standard program-specific configuration files, based on the updated UCI configuration in ''/etc/config'', and then restarting the executable. |
| The init.d script first properly writes such a configuration file to the software's expected location and it is read in again by restarting the executable. | This implies that solely (re)starting the executable directly, without calling the appropriate init.d script, would not behave as expected as it would not yet result in the incorporation of configuration updates into the program's standard [[http://en.wikipedia.org/wiki/Configuration_file|configuration file(s)]]. |
| Note that just (re)starting the executable directly, without init.d calls, will not result in an UCI update to relegate UCI config to the program's expected [[http://en.wikipedia.org/wiki/Configuration_file|configuration file]]. | |
| Changes in files in ''/etc/config/'' then take no effect. | |
| |
| As an example of modifying the UCI configuration, suppose you want to change the device's IP address from the default ''192.168.1.1'' to ''192.168.2.1''. | As an example of modifying the UCI configuration, suppose you want to change the device's IP address from the default ''192.168.1.1'' to ''192.168.2.1''. |
| |
| ===== Configuration files ===== | ===== Configuration files ===== |
| ^ File ^ Description ^ | ^ File ^ Description ^ |
| ^ Basic ^^ | ^ Basic || |
| | [[docs:guide-user:base-system:dhcp|/etc/config/dhcp]] | [[docs:guide-user:base-system:dhcp.dnsmasq|Dnsmasq]] and [[docs:techref:odhcpd|odhcpd]] settings: DNS, DHCP, DHCPv6 | | | [[docs:guide-user:base-system:dhcp|/etc/config/dhcp]] | [[docs:guide-user:base-system:dhcp.dnsmasq|Dnsmasq]] and [[docs:techref:odhcpd|odhcpd]] settings: DNS, DHCP, DHCPv6 | |
| | [[docs:guide-user:base-system:dropbear|/etc/config/dropbear]] | SSH server options | | | [[docs:guide-user:base-system:dropbear|/etc/config/dropbear]] | SSH server options | |
| | [[docs:guide-user:firewall:firewall_configuration|/etc/config/firewall]] | NAT, packet filter, port forwarding, etc. | | | [[docs:guide-user:firewall:firewall_configuration|/etc/config/firewall]] | NAT, packet filter, port forwarding, etc. | |
| | [[docs:guide-user:network:ucicheatsheet|/etc/config/network]] | Switch, interface and route configuration:\\ [[docs:guide-user:base-system:basic-networking|Basics]], [[docs:guide-user:network:ipv4:configuration|IPv4]], [[docs:guide-user:network:ipv6:configuration|IPv6]], [[docs:guide-user:network:routing:routes_configuration|Routes]], [[docs:guide-user:network:routing:ip_rules|Rules]], [[docs:guide-user:network:wan:wan_interface_protocols|WAN]], [[docs:guide-user:network:network_interface_alias|Aliases]], [[docs:guide-user:base-system:basic-networking|Switches]], [[docs:guide-user:network:vlan:switch_configuration|VLAN]], [[docs:guide-user:network:ipv6_ipv4_transitioning|IPv4/IPv6 transitioning]], [[docs:guide-user:network:tunneling_interface_protocols|Tunneling]] | | | [[docs:guide-user:network:ucicheatsheet|/etc/config/network]] | Switch, interface and route configuration:\\ [[docs:guide-user:network:network_configuration|General]], [[docs:guide-user:network:ipv4:configuration|IPv4]], [[docs:guide-user:network:ipv6:configuration|IPv6]], [[docs:guide-user:network:routing:routes_configuration|Routes]], [[docs:guide-user:network:routing:ip_rules|Rules]], [[docs:guide-user:network:wan:wan_interface_protocols|WAN]], [[docs:guide-user:network:network_interface_alias|Aliases]], [[docs:guide-user:network:network_configuration|Switches]], [[docs:guide-user:network:vlan:switch_configuration|VLAN]], [[docs:guide-user:network:ipv6_ipv4_transitioning|IPv4/IPv6 transitioning]], [[docs:guide-user:network:tunneling_interface_protocols|Tunneling]] | |
| | [[docs:guide-user:base-system:system_configuration|/etc/config/system]] | Misc. system settings, [[docs:guide-user:advanced:ntp_configuration|NTP]], [[docs:guide-user:services:rng|RNG]], [[docs:guide-user:advanced:watchcat|Watchcat]] | | | [[docs:guide-user:base-system:system_configuration|/etc/config/system]] | Misc. system settings, [[docs:guide-user:advanced:ntp_configuration|NTP]], [[docs:guide-user:services:rng|RNG]], [[docs:guide-user:advanced:watchcat|Watchcat]] | |
| | [[docs:guide-user:network:wifi:basic|/etc/config/wireless]] | Wireless settings and wifi network definition | | | [[docs:guide-user:network:wifi:basic|/etc/config/wireless]] | Wireless settings and wifi network definition | |
| ^ IPv6 ^^ | ^ IPv6 || |
| | [[doc:uci:ahcpd|/etc/config/ahcpd]] | Ad-Hoc Configuration Protocol (AHCP) server and forwarder configuration | | | [[doc:uci:ahcpd|/etc/config/ahcpd]] | Ad-Hoc Configuration Protocol (AHCP) server and forwarder configuration | |
| | [[docs:guide-user:network:ipv6:dhcp6c|/etc/config/dhcp6c]] | WIDE-DHCPv6 client | | | [[docs:guide-user:network:ipv6:dhcp6c|/etc/config/dhcp6c]] | WIDE-DHCPv6 client | |
| | [[doc:uci:dhcp6s|/etc/config/dhcp6s]] | WIDE-DHCPv6 server | | | [[doc:uci:dhcp6s|/etc/config/dhcp6s]] | WIDE-DHCPv6 server | |
| | [[doc:uci:gw6c|/etc/config/gw6c]] | GW6c client configuration | | | [[doc:uci:gw6c|/etc/config/gw6c]] | GW6c client configuration | |
| ^ Other ^^ | ^ Other || |
| | [[docs:guide-user:services:babeld|/etc/config/babeld]] | babeld configuration | | | [[docs:guide-user:services:babeld|/etc/config/babeld]] | babeld configuration | |
| | [[docs:guide-user:services:bbstored|/etc/config/bbstored]] | BoxBackup server configuration | | | [[docs:guide-user:services:bbstored|/etc/config/bbstored]] | BoxBackup server configuration | |
| | [[docs:guide-user:base-system:ddns|/etc/config/ddns]] | Dynamic DNS configuration (ddns-scripts) | | | [[docs:guide-user:base-system:ddns|/etc/config/ddns]] | Dynamic DNS configuration (ddns-scripts) | |
| | [[docs:guide-user:services:dns:dnscrypt-proxy|/etc/config/dnscrypt-proxy]] | DNSCrypt proxy | | | [[docs:guide-user:services:dns:dnscrypt-proxy|/etc/config/dnscrypt-proxy]] | DNSCrypt proxy | |
| | [[docs:guide-user:services:email:emailrelay|/etc/config/emailrelay]] | E-MailRelay: simple SMTP server and proxy with POP support. Package [[:packages:pkgdata:emailrelay]] | | | [[docs:guide-user:virtualization:docker_host|/etc/config/dockerd]] | The Docker CE Engine Daemon | |
| | [[docs:guide-user:services:w_o_l:etherwake|/etc/config/etherwake]] | Wake-on-Lan: etherwake | | | [[docs:guide-user:services:email:emailrelay|/etc/config/emailrelay]] | E-MailRelay: simple SMTP server and proxy with POP support. Package [[:packages:pkgdata:emailrelay]] | |
| | [[docs:guide-user:firewall:freifunk_p2pblock|/etc/config/freifunk_p2pblock]] | Uses iptables layer7-, ipp2p- and recent-modules to block p2p/filesharing traffic | | | [[docs:guide-user:services:w_o_l:etherwake|/etc/config/etherwake]] | Wake-on-Lan: etherwake | |
| | [[docs:guide-user:storage:fstab|/etc/config/fstab]] | Mount points and swap | | | [[docs:guide-user:firewall:freifunk_p2pblock|/etc/config/freifunk_p2pblock]] | Uses iptables layer7-, ipp2p- and recent-modules to block p2p/filesharing traffic | |
| | [[docs:guide-user:storage:hd-idle|/etc/config/hd-idle]] | Another idle-daemon for attached hard drives | | | [[docs:guide-user:storage:fstab|/etc/config/fstab]] | Mount points and swap | |
| | [[docs:guide-user:base-system:httpd|/etc/config/httpd]] | Web server options (Busybox httpd, deprecated) | | | [[docs:guide-user:storage:hd-idle|/etc/config/hd-idle]] | Another idle-daemon for attached hard drives | |
| | [[docs:guide-user:services:dns:ipset-dns|/etc/config/ipset-dns]] | Configure [[https://git.zx2c4.com/ipset-dns/about/|ipset-dns]] | | | [[docs:guide-user:base-system:httpd|/etc/config/httpd]] | Web server options (Busybox httpd, deprecated) | |
| | [[doc:uci:luci|/etc/config/luci]] | Base LuCI config | | | [[docs:guide-user:services:dns:ipset-dns|/etc/config/ipset-dns]] | Configure [[https://git.zx2c4.com/ipset-dns/about/|ipset-dns]] | |
| | [[doc:uci:luci_statistics|/etc/config/luci_statistics]] | Configuration of Statistics packet| | | [[docs:guide-user:services:dns:kadnode|/etc/config/kadnode]] | KadNode p2p DNS | |
| | [[docs:guide-user:services:snmp:mini_snmpd|/etc/config/mini_snmpd]] | mini_snmpd settings | | | [[doc:uci:luci|/etc/config/luci]] | Base LuCI config | |
| | [[docs:guide-user:services:media_server:minidlna|/etc/config/minidlna]] | MiniDLNA settings | | | [[doc:uci:luci_statistics|/etc/config/luci_statistics]] | Configuration of Statistics packet | |
| | [[doc:uci:mjpg-streamer|/etc/config/mjpg-streamer]] | Streaming application for Linux-UVC compatible webcams | | | [[docs:guide-user:services:snmp:mini_snmpd|/etc/config/mini_snmpd]] | mini_snmpd settings | |
| | [[docs:guide-user:storage:mountd|/etc/config/mountd]] | OpenWrt automount daemon | | | [[docs:guide-user:services:media_server:minidlna|/etc/config/minidlna]] | MiniDLNA settings | |
| | [[doc:uci:mroute|/etc/config/mroute]] | Configuration files for multiple WAN routes | | | [[doc:uci:mjpg-streamer|/etc/config/mjpg-streamer]] | Streaming application for Linux-UVC compatible webcams | |
| | [[docs:guide-user:network:wan:multiwan:multiwan_package|/etc/config/multiwan]] | Simple multi WAN configuration | | | [[docs:guide-user:storage:mountd|/etc/config/mountd]] | OpenWrt automount daemon | |
| | [[docs:guide-user:network:wan:multiwan:mwan3|/etc/config/mwan3]] | Multi-WAN config with load balancing and failover | | | [[doc:uci:mroute|/etc/config/mroute]] | Configuration files for multiple WAN routes | |
| | [[docs:guide-user:services:captive-portal:nodogsplash|/etc/config/nodogsplash]] | nodogsplash configuration | | | [[docs:guide-user:network:wan:multiwan:multiwan_package|/etc/config/multiwan]] | Simple multi WAN configuration | |
| | [[docs:guide-user:services:ntp:client|/etc/config/ntpclient]] | Getting the correct time | | | [[docs:guide-user:network:wan:multiwan:mwan3|/etc/config/mwan3]] | Multi-WAN config with load balancing and failover | |
| | [[docs:guide-user:services:ups:software.nut|/etc/config/nut_server]] | Controlling a UPS (Uninterruptible Power Supply) and/or sharing with other hosts | | | [[docs:guide-user:services:captive-portal:nodogsplash|/etc/config/nodogsplash]] | nodogsplash configuration | |
| | [[docs:guide-user:services:ups:software.nut|/etc/config/nut_monitor]] | Monitoring a UPS (Uninterruptible Power Supply) from a remote host or local nut-server | | | [[docs:guide-user:services:ntp:client|/etc/config/ntpclient]] | Getting the correct time | |
| | [[docs:guide-user:services:ups:software.nut|/etc/config/nut_cgi]] | Web UI for NUT (viewing only in UCI) | | | [[docs:guide-user:services:ups:software.nut|/etc/config/nut_server]] | Controlling a UPS (Uninterruptible Power Supply) and/or sharing with other hosts | |
| | [[docs:guide-user:services:print_server:p910nd|/etc/config/p910nd]] | config for non-spooling Printer daemon [[docs:guide-user:services:print_server:p910nd.server]] | | | [[docs:guide-user:services:ups:software.nut|/etc/config/nut_monitor]] | Monitoring a UPS (Uninterruptible Power Supply) from a remote host or local nut-server | |
| | [[docs:guide-user:services:nas:pure-ftpd|/etc/config/pure-ftpd]] | Pure-FTPd server config | | | [[docs:guide-user:services:ups:software.nut|/etc/config/nut_cgi]] | Web UI for NUT (viewing only in UCI) | |
| | [[docs:guide-user:network:traffic-shaping:traffic_shaping|/etc/config/qos]] | Implementing Quality of Service for the //upload// | | | [[docs:guide-user:services:print_server:p910nd|/etc/config/p910nd]] | config for non-spooling Printer daemon [[docs:guide-user:services:print_server:p910nd.server]] | |
| | [[docs:guide-user:services:vpn:ipsec:racoon:basic|/etc/config/racoon]] | racoon IPsec daemon | | | [[docs:guide-user:services:nas:pure-ftpd|/etc/config/pure-ftpd]] | Pure-FTPd server config | |
| | [[docs:guide-user:services:nas:samba|/etc/config/samba]] | settings for the Microsoft file and print services daemon | | | [[docs:guide-user:network:traffic-shaping:traffic_shaping|/etc/config/qos]] | Implementing Quality of Service for the //upload// | |
| | [[docs:guide-user:services:snmp:snmpd|/etc/config/snmpd]] | SNMPd settings | | | [[docs:guide-user:services:vpn:ipsec:racoon:basic|/etc/config/racoon]] | racoon IPsec daemon | |
| | [[docs:guide-user:network:traffic-shaping:sqm_configuration|/etc/config/sqm]] | SQM settings | | | [[docs:guide-user:services:nas:samba|/etc/config/samba]] | settings for the Microsoft file and print services daemon | |
| | [[docs:guide-user:services:ssh:sshtunnel|/etc/config/sshtunnel]] | Settings for the package ''sshtunnel'' | | | [[docs:guide-user:services:snmp:snmpd|/etc/config/snmpd]] | SNMPd settings | |
| | [[docs:guide-user:services:voip:stund|/etc/config/stund]] | STUN server configuration | | | [[docs:guide-user:network:traffic-shaping:sqm_configuration|/etc/config/sqm]] | SQM settings | |
| | [[doc:uci:tinc|/etc/config/tinc]] | [[docs:guide-user:services:vpn:tinc|tinc]] package configuration | | | [[docs:guide-user:services:ssh:sshtunnel|/etc/config/sshtunnel]] | Settings for the package ''sshtunnel'' | |
| | [[docs:guide-user:services:downloading_and_filesharing:transmission|/etc/config/transmission]] | BitTorrent configuration | | | [[docs:guide-user:services:voip:stund|/etc/config/stund]] | STUN server configuration | |
| | [[docs:guide-user:services:webserver:uhttpd|/etc/config/uhttpd]] | Web server options (uHTTPd) | | | [[doc:uci:tinc|/etc/config/tinc]] | [[docs:guide-user:services:vpn:tinc|tinc]] package configuration | |
| | [[docs:guide-user:firewall:upnp:miniupnpd|/etc/config/upnpd]] | miniupnpd UPnP server settings | | | [[docs:guide-user:services:tor:client|/etc/config/tor]] | Tor configuration | |
| | [[docs:guide-user:base-system:users|/etc/config/users]] | user database for different services | | | [[docs:guide-user:services:tor:hs|/etc/config/tor-hs]] | Tor hidden services configuration | |
| | [[docs:guide-user:services:media_server:ushare|/etc/config/ushare]] | uShare UPnP server settings | | | [[docs:guide-user:services:downloading_and_filesharing:transmission|/etc/config/transmission]] | BitTorrent configuration | |
| | [[docs:guide-user:services:vblade|/etc/config/vblade]] | vblade userspace AOE target | | | [[docs:guide-user:services:webserver:uhttpd|/etc/config/uhttpd]] | Web server options (uHTTPd) | |
| | [[docs:guide-user:services:network_monitoring:vnstat|/etc/config/vnstat]] | vnstat downloader settings | | | [[docs:guide-user:firewall:upnp:miniupnpd|/etc/config/upnpd]] | miniupnpd UPnP server settings | |
| | [[docs:guide-user:network:wifi:wifi_toggle|/etc/config/wifitoggle]] | Toggle WiFi with a button | | | [[docs:guide-user:base-system:users|/etc/config/users]] | user database for different services | |
| | [[docs:guide-user:services:w_o_l:wol|/etc/config/wol]] | Wake-on-Lan: wol | | | [[docs:guide-user:services:media_server:ushare|/etc/config/ushare]] | uShare UPnP server settings | |
| | [[docs:guide-user:services:proxy:znc|/etc/config/znc]] | ZNC bouncer configuration | | | [[docs:guide-user:services:vblade|/etc/config/vblade]] | vblade userspace AOE target | |
| | | [[docs:guide-user:services:network_monitoring:vnstat|/etc/config/vnstat]] | vnstat downloader settings | |
| | | [[docs:guide-user:network:wifi:wifi_toggle|/etc/config/wifitoggle]] | Toggle WiFi with a button | |
| | | [[docs:guide-user:services:w_o_l:wol|/etc/config/wol]] | Wake-on-Lan: wol | |
| | | [[docs:guide-user:services:proxy:znc|/etc/config/znc]] | ZNC bouncer configuration | |
| |
| ===== File syntax ===== | ===== File syntax ===== |
| </WRAP> | </WRAP> |
| |
| When there are multiple rules next to each other, UCI supports array-like references for them. | When there are multiple sections of the same type in a config, UCI supports array-like references for them. |
| If there are 8 NTP servers defined in ''/etc/config/system'', UCI will let you reference their sections as ''system.@timeserver[0]'' for the first or ''system.@timeserver[7]'' for the last one. | If there are 8 NTP servers defined in ''/etc/config/system'', UCI will let you reference their sections as ''system.@timeserver[0]'' for the first or ''system.@timeserver[7]'' for the last one. |
| You can also use negative indexes, such as ''system.@timeserver[-1]''. | You can also use negative indexes, such as ''system.@timeserver[-1]''. |
| A section can be //named// or //unnamed//. | A section can be //named// or //unnamed//. |
| Unnamed sections will get an **autogenerated ID/CFGID** (like "cfg073777") and be presented with an **anonymous-name** (like "@switch[0]") | Unnamed sections will get an **autogenerated ID/CFGID** (like "cfg073777") and be presented with an **anonymous-name** (like "@switch[0]") |
| | |
| | Section names may only contain alphanum and "_" (for shell compatibility). Hyphen '-' is not allowed. |
| |
| Example of **anonymous-name**: | Example of **anonymous-name**: |
| |
| ===== Corrupted configs ===== | ===== Corrupted configs ===== |
| If you manually edited the configs in ''/etc/config/'', it is possible that some of them are corrupted due to typos. | See also: |
| | [[docs:guide-user:advanced:uci_extras|UCI extras]] |
| | |
| | If you manually edited the configs in ''/etc/config'', it is possible that some of them are corrupted due to typos. |
| |
| <code bash> | <code bash> |
| # uci show fstab | # uci show fstab |
| uci: Parse error (invalid command) at line 20, byte 0 | uci: Parse error (invalid command) at line 20, byte 0 |
| </code> | |
| |
| Set up [[docs:guide-user:advanced:uci_extras|UCI extras]] and run the following command to find corrupted configs. | |
| |
| <code bash> | |
| uci validate | |
| </code> | </code> |
| |