Fix the problem: “apt upgrade disappears after reboot” on OverlayFS systems.
Fully automated, reboot-safe maintenance framework for read-only Raspberry Pi environments.
Designed for long-term unattended systems — stable, safe, and hands-free.
⭐ If this project helps you, consider giving it a star!
- Raspberry Pi running in read-only (OverlayFS) mode
- Devices deployed in the field (IoT / edge / remote systems)
- Systems that must run unattended for months
- Anyone tired of manual update + reboot workflows
On OverlayFS systems:
apt upgradechanges disappear after reboot- Writable layer can fill up over time
- Manual maintenance becomes fragile and risky
This project introduces a reboot-based maintenance workflow:
- Switch to writable mode
- Apply updates safely
- Reboot automatically
- Restore clean read-only OverlayFS
✔ No manual steps ✔ No broken updates ✔ No overlay corruption
- Automatic OverlayFS ON/OFF switching
- systemd timer-based execution
- Zero manual intervention
- Reboot-based safe update design
- Lock mechanism (prevents duplicate runs)
- Cooldown protection (avoids excessive writes)
- Resume support after interruption
- Self-healing state recovery (fallback to safe state)
- YAML-based task definitions
- Custom scripts supported
- JSON logging for automation
- Dry-run mode (no reboot / safe testing)
- GitHub Actions CI (shellcheck + syntax validation)
Install and enable automatic maintenance in one step:
curl -fsSL https://raw.githubusercontent.com/Tetsuya1126/raspi_overlay-auto-update/main/install/curl_installer.sh | sudo bashgit clone --branch main --depth 1 https://github.com/Tetsuya1126/raspi_overlay-auto-update.git
cd raspi_overlay-auto-update
sudo ./install/install.sh
⚠️ Always install from the official GitHub repository to ensure safety.
Timer Start
↓
maintenance.sh
↓
Lock Check
↓
State Detection
↓
OverlayFS Mode Check
↓
Reboot if Needed
↓
Run Tasks (apt, custom scripts)
↓
Restore OverlayFS (read-only)
↓
Wait for next scheduled run
cd /usr/local/bin/auto-maintenance/
sudo ./maintenance.sh --dry- No reboot
- No OverlayFS changes
- Logs only
Edit:
sudo nano /etc/maintenance_tasks.yamlExample:
tasks:
- name: apt_update
cmd: /usr/local/lib/auto-maintenance/maintenance_funcs/apt_update.sh
- name: custom_script
cmd: bash /usr/local/bin/myscript.sh| Overlay | State | Action |
|---|---|---|
| ON | 2 | NEED_OVERLAY_OFF / COOL_DOWN |
| ON | 1 | RESUME_TO_OVERLAY_OFF |
| ON | 0 | NEED_OVERLAY_OFF (initial) |
| OFF | 2 | DO_MAINTENANCE / COOL_DOWN |
| OFF | 1 | MAINTENANCE_CONTINUE |
| OFF | 0 | IDLE |
The system relies on a persistent state file.
- Missing or corrupted state will reset to a safe default (
STATE=0) - Maintenance will restart automatically from a clean state
- Designed to recover from interruptions without manual intervention
/var/log/maintenance/maintenance.log
/var/log/maintenance/task_status.jsonOfficial releases are only published in this repository.
We do NOT distribute:
- ZIP archives
- EXE files
- Third-party mirrors
If you find this project elsewhere, treat it as untrusted.
- Raspberry Pi 2 / 3 / Zero
- Raspberry Pi OS / Debian
- QEMU / VirtualBox
✔ Real-world tested for months
- Retry logic for Overlay switching
- Automatic recovery from failed states
See the Wiki for detailed usage and configuration. (Keep on update): https://github.com/Tetsuya1126/raspi_overlay-auto-update/wiki
Issues and Pull Requests are welcome.
MIT License
v2.0.0 — Final release for real-world usage
This is the original upstream repository.
Actively maintained and used in real-world deployments.
Reliable updates for read-only Raspberry Pi systems.
Keywords: Raspberry Pi OverlayFS auto update safe upgrade systemd.