Update raspi-config - allow disable_overlayfs to do its job even if a… #254
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…dditional parameters have been added by the user, also, check for error state and report it back.
The creators of raspi-config took a KISS approach to adding overlayroot support - /boot is excluded by default, unless requested by the user (plus overlayroot can't handle vfat anyway).
Which means adding the overlay parameter to cmdline.txt, which is stored under /boot or /boot/firmware, makes removing it easy as well, as it should always be writable or at least trivial to make /boot writable with a simple "mount -o remount,rw" call.
The downside of this is that all entries in /etc/overlayroot.conf and /etc/overlayroot.local.conf are being ignored, as kernel boot parameters will always take precedence (per the spec in the overlayroot documentation). This means that users who wish to add additional parameters to the overlayfs string must do so in cmdline.txt.
One such common addition would be ":recurse=0" to exclude mountpoints below "/" from being covered by overlayroot - this is handy for additional partitions being mounted as data storage or homedirectories. That way, these can be used for persistent storage, yet "/" is protected from catastrophic file system damage so the base system will always boot up.
Adding additional parameters, however, breaks raspi-config's ability to disable overlayfs, because it is looking for the exact string, followed by a blank space. This patch checks for "expected string plus anything trailing that IS NOT a blank space", and will remove it - this SHOULD be safe to do as spaces are not valid characters within an overlayfs string, from what I can tell.
It also adds a simple check in case sed exited with an error state, and will report it with an error message similar in style to the ones already used in this function.