Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read-only root with data partition #76

Merged
merged 14 commits into from
Apr 3, 2021
Merged

Read-only root with data partition #76

merged 14 commits into from
Apr 3, 2021

Conversation

zehnm
Copy link
Member

@zehnm zehnm commented Apr 3, 2021

This pull request changes the partition setup and introduces a compressed read-only root file system. A writable data partition holds overlay data to persist configuration settings.

Partition Size Format PARTUUID
Boot 32M vfat 53a3720d-07aa-4680-ab6d-f2ed0979c9ea
Recovery 384M ext4 (TBD) b9ea076c-315f-422b-85d7-887854415b1e
System A 512M SquashFS b831b597-efc4-4132-b88c-c50a2d4589cf
System B 512M SquashFS f2f82015-3087-485a-9241-914026bca453
Data 128M ext4 79055324-d7a8-4768-afc6-c7dbfc9a4612
  • Use SquashFS as root file system.
  • ext4 data partition to store individual bind-mounted configuration files in /etc
  • OverlayFS for /var and /opt/yio which are persisted on the data partition.
  • Temporary in-memory overlay for /etc to find all configuration settings which need to be bind-mounted to the data partition.
  • Overlay file systems are setup in a custom init script.
    This is mainly a quick fix to get everything working with systemd. Setting up all overlays and bind-mounts with systemd might be introduced later, to allow proper file system checks and auto-expansion of the data partition.

Further changes:

  • Hybrid GPT MBR partition setup to avoid dealing with extended partitions.
    • Partition UUIDs are used wherever possible to uniquely reference partitions, otherwise file system UUID.
    • Partition numbers are now only used in the U-Boot boot script to load the correct kernel.
      This changes the SWUpdate target handling: instead of using the hard coded partition number, the systems are referenced by A / B slots and their PARTUUID. If the partition layout changes, then only the U-Boot boot script needs to be changed.

Open issues:

  • Mongoose web server is running openly by default.
    Available options:
    • Configure authentication
    • Manually start / stop daemon or integrate in remote-software
    • Fully integrate into web-configurator
  • Partition layout and sizes:
    • both 512MB rootfs partitions are rather generous for SquashFS
    • data partition at the end is kept small to make it auto expandable, which is not yet implemented
    • decide about data partition: keep as is / split into an overlay partition for configuration data and an app partition for all YIO components.
  • systemd machine_id handling still throws an error during boot (but seems to work otherwise)
  • Find out which configuration settings in /etc need to be persisted.
    Known settings not persisted at the moment (in-memory overlay):
    • timezone: requires /etc/localtime symlink to /usr/share/zoneinfo/{region}/{town}
    • public ssh keys cannot be persisted due to read-only /root/.ssh
  • YIO app and plugin handling during system update
    • /opt/yio is an overlay and can still be updated with the old update scripts
    • A manually updated app or plugin is persisted during a system update and might become incompatible with a newly applied system update.
      There should be an option to wipe the overlay to have a clean update.
  • A recovery system partition is prepared, but not yet functional.
    This will be handled in another task. Also the file system might change to SquashFS.

This closes #16
This closes #29
Part of #49 for a read-only SD card setup.

zehnm added 13 commits April 3, 2021 11:01
- Use squashfs as rootfs
- ext4 data partition
- TODO OverlayFS for /var

Work in progress:
- convince systemd to work on a read-only rootfs.
- Most likely needs a custom pre-init script for OverlayFS to avoid initramfs
Update genimage 12 to 14 for proper hybrid partition table support.
MBR is required for RPi boot partition. GPT is used for everything else.
This makes partition handling much nicer whithout the primary partition limit of MBR.
Store user editable wpa_supplicant configuration file in /var/etc/wpa_supplicant
and avoid bindmount indirection from /etc/wpa_supplicant.
This service was used in the old access point functionality and might be used again in the future.
Instead of disabling it during first boot, remove the install section in the service file.
Instead of disabling it during first boot, remove the install section in the service file.
This allows to reference partitions by UUID
Included evtest to test alternative touchscreens.
@zehnm zehnm added the enhancement New feature or request label Apr 3, 2021
@zehnm zehnm added this to the Full System Update milestone Apr 3, 2021
@zehnm zehnm requested a review from martonborzak April 3, 2021 15:07
@zehnm zehnm marked this pull request as ready for review April 3, 2021 16:21
@zehnm zehnm merged commit 28948f9 into master Apr 3, 2021
@zehnm zehnm deleted the swupd-partitions branch April 3, 2021 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update strategy for the not just the app but the whole system. Add partitions for software update
2 participants