Skip to content

Raspbian trixie#1106

Draft
SteveMicroNova wants to merge 32 commits into
mainfrom
RaspbianTrixie
Draft

Raspbian trixie#1106
SteveMicroNova wants to merge 32 commits into
mainfrom
RaspbianTrixie

Conversation

@SteveMicroNova

Copy link
Copy Markdown
Contributor

What does this change intend to accomplish?

This is a reworking of AmpliPi to function in a 64 bit raspbian trixie A:B tryboot setup with the goal of having a more robust system overall and a cleaner update flow with full image updates

Checklist

  • Have you tested your changes and ensured they work?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • If applicable, have you updated the documentation/manual?
  • If applicable, have you updated the CHANGELOG?
  • Does your submission pass linting & tests? You can test on localhost using ./scripts/test
  • Have you written new tests for your core features/changes, as applicable?
  • If this is a UI change, have you tested it across multiple browser platforms on both desktop and mobile?

…ure.py to better handle installs from point 0 as well as better handle updates with this new OS
Update check_pass to explicitly use python 3.8 instead of python 3.13
add with_alsa flag to configure.py to optionally forcefully override
Add "dep filter" repeatable flag for the deploy script for rapid iteration while working on specific dependency install steps
Update NEW_RELEASE.md with a personal reminder
Update check_pass to explicitly use python 3.8 instead of python 3.13
add with_alsa flag to configure.py to optionally forcefully override
Fix alsa option in deploy script
…py with optional verbose logging during the debian upgrade portion
Fix asgi.py image consumption endpoint to only modify boot when needed as well as patch the fstab and journal entries for bootability
Move all services from `--user pi` to root to allow for reasonable ownership management between multiple OS instances

Add postflash service that validates that apt packages are properly installed

Fix small bug with LMS album art
@SteveMicroNova

SteveMicroNova commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

This is a WIP that will take a while to finish

This will change the baseline partition scheme of amplipi from basic boot+root to a 7 partition schema:

  • p1: Autoboot (raspberry pi A:B boot necessity), mounted as /boot/firmware
  • p2: Boot partition A
  • p3: Boot partition B
  • p4: Extended partition containing partitions 5, 6, and 7
  • p5: Root partition A
  • p6: Root partition B
  • p7: Persistent data storage for things that need to remain during flash, such as the user's config. Mounted at /data

Currently, I have the ability to update from images via the updater/asgi.py /update/flash endpoint that takes an update package: a folder containing a root image, an optional boot image, and a manifest.json file that describes the update package with a bytesize and sha256 checksum of the images.
This endpoint uses that update package to first verify the checksum of the image(s) before flashing, and then flashes the inactive directory. After flashing is complete, it also writes an "update-pending" file to p1 that signals to the update finalization service that things are freshly flashed and need to be checked on reboot.
Once that's all done, it also runs sudo reboot "0 tryboot" to move to the other slot

Once in the other boot+root slot, the update verification service checks to see if that /boot/firmware/update-pending file exists and if yes, runs a preflight check before allowing amplipi to start up - verifying if all the apt and python packages are properly in place. Once that's done and amplipi runs, it also edits /boot/firmware/autoboot.txt to change the newly flashed boot slot to be the new default slot so that the user doesn't revert to the previous slot on next reboot

@@ -1,4 +1,4 @@
#!/usr/bin/env python3

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version of python we run has to be installed via UV on Trixie, so I had to move the invocation paths on a few files

Comment thread amplipi/display/common.py
the stored default AmpliPi password."""

# Password config location
PASS_DIR = os.path.join(os.path.expanduser('~'), '.config', 'amplipi')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole .config folder and a few services got moved to /data to ensure they persist post-update, many lines like this had to be changed as a result

Comment thread config/autoboot.txt
Comment on lines +1 to +13
[all]
tryboot_a_b=1
boot_partition=2

[tryboot]
boot_partition=3

if exist mmc 0:1 /boot_partition.txt then
load mmc 0:1 ${loadaddr} /boot_partition.txt
env import -t ${loadaddr} ${filesize}
fi

boot mmc 0:${boot_partition}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default autoboot.txt, which is what the update verification service edits when an update is successful. Specifically what is changed is swapping the [all] boot_partition value with the [tryboot] boot_partition value, that's all it takes to swap the default boot slot

Comment thread docs/imaging_etcher.md
* A micro USB cable
* Your AmpliPi

## Optional Step: Preserve your config

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file likely needs more reworking as realistically you shouldn't need to flash ever again, though also I'd say that makes more sense to leave until this code is in the hands of users and has a few support cases under its belt to verify if that's necessary

Comment on lines +33 to +41
# Run device-specific customization scripts from p7.
# These survive OTA updates and are re-applied on each new slot's first boot.
if [ -d "${SCRIPTS_DIR}" ]; then
for script in "${SCRIPTS_DIR}"/*.sh; do
[ -f "${script}" ] || continue
log "Running ${script}..."
bash "${script}" || log "Warning: ${script} exited non-zero"
done
fi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some users have specific setups on their devices that we don't want to destroy on a full-image update, so I've given them a directory that they can fill with bash scripts to set up their services automatically post-update

I need to test what happens if a user provides scripts that fail for those cases

Comment thread scripts/bootstrap_pi
--hostname NAME: The hostname to set on the pi, so once this script
successfully completes connect via {hostname}.local.
Default is amplipi
--cli-only: Use the lite version of Raspberry Pi OS which does not have

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point, CLI only became a default case for our units. I decided to flip the default case in this script to reflect that

Comment thread scripts/bootstrap_pi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file either needs full reworking or deletion. The new 7 partition setup is complex enough that updating this is a bit of a lift when we hardly need it and can also just distribute a full 7 partition image for those who need that sort of thing

Comment thread scripts/configure.py

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unlike bootstrap.py, I'd say configure.py is still very useful despite not being our update path anymore. manual deploys with the deploy+configure script are likely to be the primary ways we configure the root partitions that later get snapshotted into an image we distribute as an update

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.

1 participant