Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 13, 2025

The Ingenic T40N cameras were losing overlay configuration changes (password, timezone, etc.) when rebooted through the WebUI. This occurred because the WebUI reboot was bypassing the proper shutdown sequence that ensures overlay filesystem synchronization.

Root Cause

The issue stemmed from the WebUI calling reboot directly, which in busybox systems defaults to a forced reboot that skips the normal shutdown process. This prevented the overlay filesystem from being properly synchronized before the reboot, causing configuration changes stored in the overlay to be lost.

Solution

Added a reboot wrapper script at /general/overlay/usr/bin/reboot that:

  • Intercepts reboot calls from WebUI and other applications before they reach busybox
  • Ensures filesystem sync when not using the force flag (-f)
  • Gracefully stops services using the rcK shutdown script
  • Maintains full compatibility with all existing reboot command options
  • Preserves forced reboot behavior for system updates and other critical operations

Technical Implementation

The wrapper script:

  • Leverages OpenIPC's PATH order (/usr/bin before /sbin) to intercept reboot calls
  • Respects all busybox reboot flags: -f (force), -n (no sync), -d (delay)
  • Passes through help and version flags immediately without triggering sync
  • Performs filesystem sync before and after graceful service shutdown
  • Falls back gracefully to different busybox installation locations

Example Behavior

# Normal reboot (from WebUI) - now syncs properly
reboot
# Output: "Syncing overlay filesystem..."
#         "Stopping services gracefully..."

# Forced reboot (system updates) - unchanged behavior  
reboot -f
# Output: Immediate reboot without sync

# Help still works normally
reboot --help
# Output: Standard busybox help without sync

This ensures that configuration changes made through the WebUI are properly persisted across reboots while maintaining backward compatibility with existing scripts and system operations.

Fixes #1880.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copy link
Author

Copilot AI commented Sep 13, 2025

@flyrouter 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

@Copilot Copilot AI changed the title [WIP] Ingenic T40N won't keep overlay after reboot from WebUI Fix Ingenic T40N overlay sync issue during WebUI reboot Sep 13, 2025
@Copilot Copilot AI requested a review from flyrouter September 13, 2025 22:12
Copilot finished work on behalf of flyrouter September 13, 2025 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ingenic T40N won't keep overlay after reboot from WebUI
2 participants