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

Change overlayroot to use /etc/overlayroot.local.conf instead of cmdine.txt, and make it compatible with users' configuration #225

Open
wants to merge 1 commit into
base: bookworm
Choose a base branch
from

Conversation

JinShil
Copy link

@JinShil JinShil commented Nov 13, 2023

See raspberrypi/bookworm-feedback#137 for a discussion of what prompted this pull request.

I believe the procedures to enable and disable the readonly file system overlay can be improved.

My understanding is that Raspberry Pi would prefer to follow the conventions and best practices of upstream repositories whenever possible. As I did my research on the aforementioned issue, I discovered, in the overlayroot documentation, that it should be enabled by modifying the /etc/overlayroot.local.conf file (See /etc/overlayroot.conf for documentation), and that changes to any overlayed file system can be made through the overlayroot-chroot command. See https://manpages.debian.org/bookworm/overlayroot/overlayroot-chroot.8.en.html

This method a few advantages:

  1. It addresses the aforementioned issue making it compatible with users' overlayroot configuration
  2. It is congruent with the upstream repository's intent
  3. It does not need to modify /boot/cmdline.txt, meaning it is no longer necessary to reboot twice when enabling/disabling write protection on the /boot partition.

Although it is no longer necessary to reboot twice when enabling/disabling write protection on the /boot partition, I have not made such a change to keep this pull request as least intrusive as possible. Should this pull request be pulled, a subsequent pull request could be made to enable/disable overlayroot and the write protection on the boot partition simultaneously when one reboot.

…ine.txt, and make it compatible with users' configuration
@JinShil
Copy link
Author

JinShil commented Nov 13, 2023

A little more detail on how this makes raspi-config more compatible with users' overlayroot configuration:

It is quite common for those utilizing the readonly overlay to also have another read/write partition or disk. Beginning with Bookworm, the overlayroot, through its default recurse=1 configuration, causes all partitions and disks to be read-only once the overlay is enabled.

For users that need a read/write partition or disk, they can add a commented line of #overlayroot="temps:recurse=0" (or whatever other configuration they prefer) to their /etc/overlayroot.local.conf file, and, using the implementation in this pull request, enabling the overlay will simply uncomment that line, leaving the user's configuration intact. Similarly, disabling the overlay will simply comment that line, leaving the user's configuration intact.

@JinShil
Copy link
Author

JinShil commented Nov 13, 2023

It is also possible to disable the overlay by adding overlay="" or overlay="disabled" to /boot/cmdline.txt, but I figured I'd try overlayroot-chroot first as that appears to be what the authors of overlayroot intended, at least according to my reading of the source code at https://git.launchpad.net/cloud-initramfs-tools/

@JamesH65
Copy link

@XECDesign @ghollingworth Have you any thoughts on this?

@XECDesign
Copy link
Member

@XECDesign @ghollingworth Have you any thoughts on this?

It has a few nice features over what we have already.

However, what we have already had been tested and works, so this isn't on my todo list right now.

@haukex
Copy link

haukex commented Dec 12, 2023

I think it would be great if this or something like this would be supported. My current workaround is not pretty (applying this patch to raspi-config).

@JinShil
Copy link
Author

JinShil commented Dec 12, 2023

what we have already had been tested and works

The reason for this pull request is that the current implementation does not work for those that utilize additional read-write partitions/disks.

Edit: Also, the implementation in Bullseye did work with read-write partitions and disks, so the implementation in Bookworm potentially breaks existing solutions.

@GrubbyHalo
Copy link

GrubbyHalo commented Feb 21, 2024

Just to add... I have a HAT that has a spi-nand memory device for use as r/w storage. Enabling the overlay on the pi (Bookworm) unexpectedly added the mount for that device to the overlay. This never happened in Bulleseye and previous.

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.

None yet

5 participants