Repository navigation
Fix LivePatch remount failures and incomplete installs (#477) - #491
isaacwisdom wants to merge 2 commits into
Conversation
…HMG#477) Bypass read-only LivePatch farms while writing, with a plain-remount fallback for older NEMESIS. Check system destinations before runtime files go in and let package/USB uninstall recover an install without installed.txt. Keep existing NEMESIS compatibility policy and regression coverage.
AwsomeFox
left a comment
There was a problem hiding this comment.
I checked this against NEMESIS's source (1.17.3) and ran the tests here on macOS. It fixes #477 as described, and I found nothing that puts a unit at risk. Not checked on a car, as the PR says.
Checked:
--bypass-livepatchexists from NEMESIS 1.17.1. Before that,cmd_remountstops with a usage error on any second word, so the fallback to a plain remount runs, as the PR says.- Any
remount roputs the farms back, rebuilt from the real folders, so alibhmgapi_hook.sowritten while they're down is in/system/libafterwards. NEMESIS puts them back before its own remount, so that happens even whenremount rofails because /system is busy.fail()remounts ro onceREMOUNTEDis set. - The flag works inside a NEMESIS hook too. HMG-API's package descriptor is
version=1.1, so on 1.17.3 a plain remount in its hooks already steps the farms aside (NEMESIS_LEGACY_HOOK). So this PR is what fixes 1.17.1 and 1.17.2, and the USB stick and adb routes on every 1.17.1 or later. - NEMESIS keeps the package on any nonzero preuninstall exit, for an uninstall and for an update (
pkg.c,uninstall_treeandcmd_install), so the newexit 1does what the comment says. - Here on macOS:
install/common/install-test.sh: 325 ok.install/nemesis/sync-test.sh: 62 ok.install/common/test.sh: 37 ok.tools/check-scripts.sh: ok.install/usb/test.sh: 71 ok, 1 failure ("a pre-release's package-version comes before its release"). That check is already on release/1.1 and fails there the same way (acaseinside$(...)under macOS's bash 3.2), so it isn't from this PR.
- I also tried the other way out of #477: this payload installed over the partial install, with the farm up. The install completes: the wrapper goes into
app_process.real, LivePatch's script stays atapp_process, and the farm is read-only again afterwards. Uninstall then gives the stock.realback. That's what installing the fixed NEMESIS package over the stuck rc.10 entry does, since the old package's preuninstall exits 0 on an update.
Suggestions:
- Say that installing again also recovers. The README and changelog only offer UNINSTALL. The reporter most likely wants HMG-API installed, and installing the fixed package over the stuck entry (or from the stick) does that in one step. A check for it in
install-test.shwould keep it working: the partial install frompartial_install, theninstall.shwith the farm stub. - The stick and the package now use their own uninstaller even for a complete install. That's needed while the on-unit uninstaller is 1.1.0's, which has no bypass. But a stick or package older than what's installed would then uninstall with an older
uninstall.sh, whose file list (uninstall.sh:186) andstock.txtare that version's. You can keep both: use the payload's uninstaller only when it's at least the installed version (theversionline ininstalled.txtagainst the payload'sVERSION), or when the on-unit one is missing. Low risk today, but worth deciding. - Two mode changes look unintended.
install/usb/test.shandinstall/usb/troubleShootergo from 755 to 644. Nothing breaks:mkinstallers.shsets 0755 on the stick, and the tests run both withsh. But they're unrelated to the fix. - main and release/2.0 have the same plain remount (
install.sh:39,uninstall.sh:20). 2.0 still updates units that have NEMESIS, so it needs this too. There, the preuninstall and troubleShooter hunks will conflict with #478, #479 and #480.
Smaller: suppose remount rw --bypass-livepatch takes the farms down but NEMESIS's own remount then fails, and so does every fallback. REMOUNTED isn't set yet, so fail() doesn't run remount ro, and the farms stay down until the next restart. While they're down, the files LivePatch serves aren't visible (Enhanced Projection's, on the reporter's unit). This is rare and a restart fixes it, but a remount ro before fail in that one case would close it.
…stall Document and test completing partial installs by reinstalling. Prefer payload uninstall code only when equal/newer or when the on-unit script is missing. Restore LivePatch farms even if writable remount attempts fail, and retain the USB scripts' executable modes.
|
@AwsomeFox Thanks for the feedback. comments addressed in 895fcbc |
Fixes the incomplete installation described in #477: a plain remount leaves LivePatch's /system/lib farm read-only, so installation stops after writing hmgapid/lpatch but before installed.txt and the on-unit uninstaller exist. Package removal then skips those leftovers and NEMESIS updates remain blocked.
Based directly on release/1.1. Preserves the existing NEMESIS support policy and all prior installer regression tests.
Validation (off-car): 351 installer checks, 81 USB/package checks, 62 NEMESIS sync checks, 58 common checks, and 5 head-unit command checks passed. One host-dependent common check skipped. Includes a read-only-directory simulation of #477, bypass/fallback behavior, reinstall recovery, failed-remount cleanup, guarded partial-install cleanup, and older/equal/newer uninstaller selection. Version-selection tests also pass under macOS sh and dash. The test payload was repackaged with existing runtime binaries; no runtime binary changes. No on-car validation yet.
Refs #477; keep the issue open until the reporter confirms recovery. Replaces closed #490.