Upgraded Live USBs keep a writable library (#835)
Some checks are pending
Backend Tests / api-tests (core) (push) Waiting to run
Backend Tests / api-tests (files) (push) Waiting to run
Backend Tests / api-tests (media) (push) Waiting to run
Backend Tests / api-tests (rest) (push) Waiting to run
Backend Tests / api-contract-tests (push) Waiting to run
Backend Tests / api-migrations-and-start (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Cypress Tests / cypress-component-tests (push) Waiting to run
Cypress Tests / cypress-e2e-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

ISOs before wrolpi became a system account wrote the Live USB's library on
the persistence partition as UID 1000.  Upgrading such a USB with a newer
ISO (wrolpi-usb.sh upgrade) keeps the persistence partition, so the library
would belong to the live session's "user" and the services could not write
to it.  Bootstrap now re-owns the library once when its owner is not this
image's wrolpi.  Live USBs only: installed systems' drives are left alone.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
lrnselfreliance 2026-10-14 18:23:53 -06:00 • committed by GitHub
parent f644a80c9a
commit baa86b4ad1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -176,6 +176,14 @@ if [ "$MODE" = "direct" ]; then
mkdir -p /mnt/persistence
mountpoint -q /mnt/persistence || mount "$PERSIST_PART" /mnt/persistence
mkdir -p /mnt/persistence/wrolpi
# The library must be owned by this image's wrolpi. ISOs before wrolpi
# became a system account wrote it as UID 1000, which a USB upgraded with a
# newer ISO would leave unwritable; re-own it once.
if [ "$(stat -c %u /mnt/persistence/wrolpi)" != "$(id -u wrolpi)" ]; then
progress "Updating library ownership for this WROLPi version..."
chown -R wrolpi:wrolpi /mnt/persistence/wrolpi
note_action "Updated the library's ownership for this WROLPi version"
fi
chown wrolpi:wrolpi /mnt/persistence/wrolpi
# persistence.conf: live-boot reads this on boot and applies the bind