After talking with William about mounting /usr in initramfs level, we agreed that /usr should be remounted into read-write in localmount. Reproducible: Always
Created attachment 300467 [details, diff] a patch
I have one concern about this patch: mountpoint shouldn't be used since it is lnux/sysvinit specific. Please rework the patch so it doesn't use this. Thanks, William
Created attachment 300471 [details, diff] patch v2 Okey. reworked.
Comment on attachment 300471 [details, diff] patch v2 unless i missed something, this will always mount /usr rw. that is wrong. if the user has set /usr in their /etc/fstab to be ro, then openrc should not be overriding that.
You are right. Do you have idea how we can handle it? The only solution what I see is loop over /etc/fstab, check for /usr mountpoint (if exist) and then check in fashion: for flag in ${fsflags//,/ }; do if [ "${flag}" = 'ro' ]; then no_usr_remount=true; fi; done
err, no ... we have `fstabinfo` already for querying fstab setups. and it has a --mount flag. probably easy to add a remount flag so that fstabinfo would automatically remount it with the fstab settings (if it doesn't already).
Check out the fstabinfo helper located in $LIBEXECDIR/bin/fstabinfo. You may be able to use that to look up whether /usr is set up to be ro in fstab.
This needs to be more general. For all mountpoints considered in localmount, we should do this at boot, not just /usr. This can then also partially replace the 'root' init script.
WRT the --remount flag possibility: Can Can this also be done in the *bsd world? I know Linux has a remount mount option, but I don't know how the BSD's do this.
For the --remount option, to make it suit this usecase it would need to check for the ro option as well, if there is no such option and mountpoint is mounted with ro, it should append 'rw' to options. For now I will copy the 'case' statement from root init script. @Robin: Sounds good. I will roll a new patch in a few.
Created attachment 300485 [details, diff] patch v3 Okey, now script will do for-loop on each element from fstabinfo starting with /, it will check if the the path is contain mounted fs and if it is read-only, then it will check for ro flag in fstab for this mountpoint, if there is none, it will run remount,rw on it.
Created attachment 300487 [details, diff] patch v4 Update, case statement for the RC_UNAME, *BSD does not have -o remount, they use -u to update already-mounted mountpoint.
Created attachment 300489 [details, diff] patch v5 if mountpoint is /, append -n (no mtab update). Sorry about all teh updates.
Comment on attachment 300489 [details, diff] patch v5 there's no need to parse the fstabinfo like this. just always call `mount -o remount` if it's found in the fstab. mount is smart enough to load the rw opts from /etc/fstab. that said, i still think this should just be part of fstabinfo as a remount flag.
Created attachment 300553 [details] 0001-fstabinfo-add-remount-option.patch Please review this patch which adds a --remount/-R option to fstabinfo.
(In reply to comment #8) > This needs to be more general. > For all mountpoints considered in localmount, we should do this at boot, not > just /usr. This can then also partially replace the 'root' init script. My patch in the previous comment gives us the --remount option for fstabinfo. Once that is in the tree, the next step would be to extend the root init script to remount any other filesystems that are mounted read-only based on the contents of fstab for those filesystems.
Commit 0fcc625 contains a slightly modified version of this patch; the modifications were suggested by vapier. The next stage of this fix is to add code to the root init.d script so that after it remounts root it attempts to remount any filesystems that are mounted read-only but should not be based on their fstab entries.
i think the logic is off there. the init.d script should remount any fs that was previously mounted and is listed in /etc/fstab. there's no need to parse the options exactly and compare them ... i think that's slower than simply remounting them all and letting mount/kernel sort it out.
Created attachment 300879 [details, diff] make root initscript remount all mounted filesystems.
Created attachment 301041 [details] 0001-Remount-already-mounted-filesystems.patch Piotr and all, this is a slightly modified version of the patch. In this version, I changed the code to use the checkpath helper and reworked the "if eend ...; then" line to be more readable. What do you think of this version? Thanks, William
Looks good for me.
Ok, it passes all of my dogfood testing with the /usr mounting in genkernel, so I've committed it to the tree as commit 497ff7e. Thanks for the submission and work!