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

host/files: Enable managing bootloader/kernel files used before early boot #241

Open
ethanjli opened this issue Jun 13, 2024 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@ethanjli
Copy link
Member

ethanjli commented Jun 13, 2024

Currently, the only way to manage files on the OS is to have them be exported into the exports subdirectory of a staged pallet bundle, and then (during early/mid-boot) overlay-mount (or bind-mount) files/directories within the exports subdirectory to locations on the filesystem (e.g. /usr and/or /etc). However, this mechanism does not enable us to manage files in /boot, which are on a separate partition and are used (for the bootloader and/or the kernel) before Forklift can be used. If we want to manage such files (e.g. /boot/config.txt on a Raspberry Pi SD card) as part of the process of staging a pallet, then we will need to directly modify/replace those files during the [dev] plt stage command, before it commits the new staged pallet bundle as the next one to apply.

For example, maybe we can have a shell script which copies the new bundle's exports/boot subdirectory into /boot/forklift/stages/(id)/exports/boot and then copies /boot/forklift/stages/(id)/exports/boot/config.txt to /boot/config.txt (hard-linking would be better, but the /boot partition on the RPi SD card is vFAT and vFAT doesn't support symlinks or hard-links). Then this script could be run as a hook by the [dev] plt stage subcommand (and also by the stage set-next subcommand, and also when stage apply reverts from the next staged pallet to the current staged pallet if the next one can't be applied - and in that latter case we'd want to be able to run a hook script to reboot after falling back from a failed apply, so that the running containers aren't inconsistent with /boot/config.txt and other OS files until the next boot). Ideally, hooks could be delivered by Forklift and/or by the host OS, and hook scripts would be placed into drop-in directories.

For more context about the boot partition, refer to:

@ethanjli ethanjli added the enhancement New feature or request label Jun 13, 2024
@ethanjli ethanjli self-assigned this Jun 14, 2024
@ethanjli ethanjli changed the title Enable managing bootloader/kernel files used before early boot host/files: Enable managing bootloader/kernel files used before early boot Jun 14, 2024
@ethanjli
Copy link
Member Author

ethanjli commented Sep 21, 2024

What if [dev] plt stage experiences a partial failure? We don't really have a way to roll back /boot/config.txt from a broken file to a known-working file upon a failure...which is not good for making upgrades safe. Ideally, we would instead make use of Raspberry Pi's A/B booting facility to swap between different boot partitions. To support that, there needs to be a clean way for Forklift to plug into an A/B boot-partition-swapping mechanism; and maybe the source-of-truth for Forklift's stage store file needs to be stored/loaded that way partition? This may require some careful thinking.

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
Status: 🔖 Ready
Development

No branches or pull requests

1 participant