Hi there!
After a couple of years updating my OpenWRT powered routers by hand (i.e. sysupgrade, reinstall packages and fix things in case something broke), I want to finally set up a process which is more streamlined and reliable. I want to build a self-contained image (incl. all packages I need plus configuration) for each new release and flash it on my router, and in case something is not working right I want to simply flash the old image over again (while working with the new image on a separate device to get things going). Doing a little research, I found Image Builder and thought this is perfect for what I'm aiming for.
I got started and built custom images with packages and my config files which worked great, but then stumbled upon the note in the "Custom files" section that recommends using uci-defaults for setting config settings. I extracted the config settings I had in my /etc/config
files and put them into a uci-defaults script, rebuilt and flashed the image but my router did not want to come up. I had to boot into recovery mode and flash with the stock image to get it to work again.
I'm pretty sure the problem is caused by my custom uci-defaults script, but I do not have an idea where to get started to debug this issue. Do you have any tips for me?
Here a (stripped down) version of my custom uci-defaults script:
#!/bin/sh
uci -q batch << EOI
dhcp.@dnsmasq[0].server='**********'
dhcp.lan.dhcp_option='6,**********'
dhcp.wan.ignore='1'
dhcp.wan.ra_flags='none'
dhcp.@host[0]=host
dhcp.@host[0].name='**********'
dhcp.@host[0].mac='**********'
dhcp.@host[0].ip='**********'
dhcp.@host[0].dns='1'
dhcp.@host[1]=host
dhcp.@host[1].name='**********'
dhcp.@host[1].mac='**********'
dhcp.@host[1].ip='**********'
dhcp.@host[1].dns='1'
commit dhcp
EOI
uci -q batch << EOI
dropbear.@dropbear[0].Interface='lan'
commit dropbear
EOI
uci -q batch << EOI
fstab.@global[0].anon_mount='1'
fstab.@mount[0]=mount
fstab.@mount[0].target='/mnt/sda1'
fstab.@mount[0].uuid='5c9c01e2-21f5-4d3f-a883-f2ea39596192'
fstab.@mount[0].enabled='1'
commit fstab
EOI
uci -q batch << EOI
luci_statistics.collectd_rrdtool.DataDir='/mnt/sda1/rrd'
luci_statistics.collectd_rrdtool.CacheTimeout='300'
luci_statistics.collectd_rrdtool.CacheFlush='1500'
luci_statistics.collectd_disk.enable='1'
luci_statistics.collectd_disk.Disks='sda1'
luci_statistics.collectd_interface.enable='1'
luci_statistics.collectd_interface.Interfaces='eth0' 'eth1' 'eth1.1'
luci_statistics.collectd_interface.IgnoreSelected='1'
luci_statistics.collectd_ping.enable='1'
luci_statistics.collectd_ping.Hosts='**********' '**********'
luci_statistics.collectd_ping.AddressFamily='any'
luci_statistics.collectd_thermal.enable='1'
luci_statistics.collectd_thermal.Device='cooling_device0' 'cooling_device1' 'cooling_device2' 'cooling_device3'
luci_statistics.collectd_thermal.IgnoreSelected='1'
commit luci_statistics
EOI
uci -q batch << EOI
network.globals.ula_prefix='**********'
network.wan.peerdns='0'
commit network
EOI
uci -q batch << EOI
system.@system[0].hostname='**********'
system.@system[0].log_proto='udp'
system.@system[0].conloglevel='8'
system.@system[0].cronloglevel='5'
system.@system[0].zonename='Europe/Vienna'
system.@system[0].timezone='CET-1CEST,M3.5.0,M10.5.0/3'
commit system
EOI
uci -q batch << EOI
delete wireless.default_radio0
delete wireless.default_radio1
wireless.radio0=wifi-device
wireless.radio0.type='mac80211'
wireless.radio0.path='soc/1b500000.pci/pci0000:00/0000:00:00.0/0000:01:00.0'
wireless.radio0.channel='36'
wireless.radio0.band='5g'
wireless.radio0.htmode='VHT80'
wireless.radio0.cell_density='0'
wireless.radio1=wifi-device
wireless.radio1.type='mac80211'
wireless.radio1.path='soc/1b700000.pci/pci0001:00/0001:00:00.0/0001:01:00.0'
wireless.radio1.channel='1'
wireless.radio1.band='2g'
wireless.radio1.htmode='HT20'
wireless.radio1.cell_density='0'
wireless.wifinet2=wifi-iface
wireless.wifinet2.device='radio0'
wireless.wifinet2.mode='ap'
wireless.wifinet2.ssid='**********'
wireless.wifinet2.encryption='sae-mixed'
wireless.wifinet2.key='**********'
wireless.wifinet2.network='lan'
wireless.wifinet2.ifname='wlan0-0'
wireless.wifinet1=wifi-iface
wireless.wifinet1.device='radio0'
wireless.wifinet1.mode='ap'
wireless.wifinet1.ssid='**********'
wireless.wifinet1.encryption='sae-mixed'
wireless.wifinet1.key='**********'
wireless.wifinet1.network='lan'
wireless.wifinet1.ifname='wlan0-1'
wireless.wifinet3=wifi-iface
wireless.wifinet3.device='radio1'
wireless.wifinet3.mode='ap'
wireless.wifinet3.ssid='**********'
wireless.wifinet3.encryption='sae-mixed'
wireless.wifinet3.hidden='1'
wireless.wifinet3.key='**********'
wireless.wifinet3.network='lan'
wireless.wifinet3.ifname='wlan1-0'
wireless.wifinet4=wifi-iface
wireless.wifinet4.device='radio1'
wireless.wifinet4.mode='ap'
wireless.wifinet4.ssid='**********'
wireless.wifinet4.encryption='sae-mixed'
wireless.wifinet4.key='**********'
wireless.wifinet4.network='lan'
wireless.wifinet4.ifname='wlan1-1'
wireless.wifinet5=wifi-iface
wireless.wifinet5.device='radio1'
wireless.wifinet5.mode='ap'
wireless.wifinet5.ssid='**********'
wireless.wifinet5.encryption='psk-mixed'
wireless.wifinet5.key='**********'
wireless.wifinet5.network='lan'
wireless.wifinet5.ifname='wlan1-2'
delete wireless.radio0.disabled
delete wireless.radio1.disabled
commit wireless
EOI
Thanks in advance for any hints and tips!
Cheers,
Chris