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
The verify function checks for a missing system.hostname to detect a corrupt or truncated system.cfg. The intent is to restore defaults so the system boots correctly. However, the current implementation runs `rsync -a /usr/config/ /storage/.config` which 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) during thermal shutdown and on Retroid Pocket 5 during hard crashes from stress testing.
|
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 ? |
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.