chksysconfig: merge missing settings instead of overwriting user config#2372
chksysconfig: merge missing settings instead of overwriting user config#2372aenertia wants to merge 1 commit intoROCKNIX:nextfrom
Conversation
|
wondering if a simple copy wouldn't be enough... but doing a full rsync is probably too much indeed. |
|
Yeah simple copy would be ok ; but it does introduce the potential for loosing expected state more often than not; maybe just looking for a subset of 'safe' keys as part of the merge? .More generally I think we need to flag more aggressively to the user that the machine is in degraded state i.e a 'Recovery mode' style banner or similar in ES. |
--- Just as a follow up thought to this ; since the hostname falls through to a hard-default provided by ES in this mode (which currently confusingly is a Batocera string). We can probably change that in ES to ROCKNIX-RECOVERY or something and use that ? |
…onfig After a hard crash (thermal shutdown, power loss), system.cfg can be truncated to only the most recently written settings. The existing verify function detects this via a missing system.hostname check, but responds by rsyncing the entire reference config tree over the user's config — destroying WiFi credentials, SSH settings, and per-game emulator preferences. Replace the destructive rsync with a targeted restore of only the settings required for basic system functionality: ssh.enabled root.password wifi.enabled boot system.language system.timezone audio.volume audio.device system.hostname The remaining 200+ emulator defaults (integerscale, ratio, autosave) are managed internally by EmulationStation and do not need to be present in system.cfg for the system to function. The hostname is set to <DEVICE>-RECOVERED (e.g. RK3566-RECOVERED) to signal to the user that recovery occurred. This is visible in ES system info, the network hostname, and SSH banner without requiring any EmulationStation code changes. A boot console message and journal log entry are also emitted. TODO: Add ES startup dialog triggered by a flag file check in emulationstation-next for a more visible recovery notification. Observed on RGB30 (RK3566) during DMC devfreq thermal testing and Retroid Pocket 5 during stress testing.
77df91c to
b8c8076
Compare
|
Updated to reflect discussion. |
The verify function checks for a missing system.hostname to detect a corrupt or truncated system.cfg. I believe the intent is to restore defaults so the system boots correctly. However, the current implementation runs
rsync -a /usr/config/ /storage/.configwhich overwrites the entire user config tree — WiFi credentials, SSH settings, emulator preferences and per-game overrides are all replaced with factory defaults.This creates a cycle: the full rsync restores system.hostname, but EmulationStation's save logic strips settings that match its internal defaults (including system.hostname). On the next hard crash, the hostname is missing again, triggering another full overwrite.
Replace the destructive rsync with a merge that adds keys present in the reference config but missing from the user config. Existing user settings are preserved. Retroarch config restoration is separated to only run when those specific files are actually missing.
Observed on RK3566 (RGB30/353P) during thermal shutdown and on Retroid Pocket 5 previous during hard crashes from stress testing.