From cb51e2bc3db7e266c26d8165243605f0be771e56 Mon Sep 17 00:00:00 2001 From: Jose Luis Duran Date: Thu, 10 Feb 2022 12:42:36 -0700 Subject: [PATCH] rc: Allow the removal of firstboot_sentinel on read-only file systems NanoBSD or, more generally, systems with root_rw_mount="NO" are not able to remove the firstboot_sentinel file, typically /firstboot, because the logic in /etc/rc is currently inverted. When checkyesno root_rw_mount tests on a read-only file system, the return is 1, hence avoiding the option to mount the system read-write. Restore the ability to remove the firstboot_sentinel file on read-only mounted file systems. This change was introduced in 40adda8665bb, and partially fixed in 1ce07411fae8. Differential Revision: https://reviews.freebsd.org/D34166 --- libexec/rc/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rc/rc b/libexec/rc/rc index f117125d2d8..f021251bbd8 100644 --- a/libexec/rc/rc +++ b/libexec/rc/rc @@ -137,7 +137,7 @@ done # Note: this assumes firstboot_sentinel is on / when we have # a read-only /, or that it is on media that's writable. if [ -e ${firstboot_sentinel} ]; then - checkyesno root_rw_mount && mount -uw / + checkyesno root_rw_mount || mount -uw / chflags -R 0 ${firstboot_sentinel} rm -rf ${firstboot_sentinel} if [ -e ${firstboot_sentinel}-reboot ]; then