Automatically updating OpenWrt is generally not recommended for most users, especially on production or critical systems. Here's why, along with some safer alternatives and tools if you still want to automate parts of the process.
❗ Why Automatic Updates Are Not Recommended
- Risk of Bricking: OpenWrt updates involve flashing firmware. If something goes wrong (e.g., power loss, incompatible packages), your device could become unbootable.
- Custom Configurations: Many users customize OpenWrt with specific packages, firewall rules, or network settings. Automatic updates may overwrite or break these.
- Package Compatibility: Not all packages are guaranteed to be compatible across OpenWrt versions. An update might break functionality.
- Manual Intervention Often Needed: Some updates require manual steps, such as migrating configuration files or re-installing packages.
✅ What You Can Automate Safely
Instead of full firmware auto-updates, consider automating package updates and backups:
1. Automate Package Updates (with caution)
You can use a cron job to periodically update packages:
opkg update && opkg list-upgradable | cut -f 1 -d ' ' | xargs opkg upgrade
⚠️ Warning: opkg upgrade is not officially recommended by OpenWrt developers, as it can break dependencies or system stability. Use with caution.
2. Use attendedsysupgrade (semi-automated)
OpenWrt has a package called attendedsysupgrade that helps you upgrade to the latest firmware version while preserving your installed packages and settings.
This is semi-automated and safer than full auto-updates.
3. Automate Backups
Before any update, always back up your configuration:
sysupgrade -b /tmp/backup-$(date +%F).tar.gz
You can schedule this with a cron job.
🔄 If You Still Want Full Auto-Updates
If you're managing many devices or want full automation (e.g., for testing), consider:
- Using
auc in a script with scheduled cron jobs.
- Custom scripts that:
- Check for new versions
- Download and verify firmware
- Backup config
- Flash new firmware
- Reboot
But again, this is not recommended unless you fully understand the risks and have recovery options (e.g., serial console, TFTP recovery).
✅ Best Practice Summary
| Task | Recommended? | Notes |
|---|
| Full automatic firmware updates | ❌ No | Risky, can brick device |
Semi-automated updates with attendedsysupgrade | ✅ Yes | Safer, preserves settings |
| Automatic package updates | ⚠️ With caution | Can break dependencies |
| Automatic backups | ✅ Yes | Always a good idea |
🔧 Tools to Consider
luci-app-attendedsysupgrade – Web UI for safe upgrades
auc – CLI tool for attended sysupgrade
sysupgrade – Core tool for firmware flashing
opkg – Package manager
cron – For scheduling tasks
If you need help setting up a safe update workflow, feel free to ask!