At Fri, 19 Feb 2021 14:49:45 -0000 (UTC), mlelstv%serpens.de@localhost (Michael van Elst) wrote: Subject: Re: can't attach the amd64-install.img file with read-only access > > woods%planix.ca@localhost ("Greg A. Woods") writes: > > >[ 2.0260598] boot device: dk1 > >[ 2.0260598] opendisk: can't open dev dk1 (30) > >[ 2.0260598] root on dk1opendisk: can't open dev dk0 (30) > > The wedge always opens the parent device read-write. Reason is > that the parent is opened only once for all wedges, so the mode > needs to allow arbitrary access. Ah, thanks for the explanation. I thought it might be something like that, but I couldn't find the code doing this on a cursory explore. > Handling read-only parent devices needs some extra complexity. > If you open a wedge read-only and it's the first open and > opening the parent device read-write fails with EROFS you could > retry to open read-only. If the parent device is already open, > you need to validate the wedge open mode against what the parent > device allowed when it was opened. Shouldn't be that difficult to > implement. That makes sense. I don't know if I'd be able to get around to trying to do that any time soon though. > The root is mounted read-only when you enter single-user, you also do > not see the device node, e.g. mount shows: > > root_device on / type ffs (read-only, local) > > The mount gets promoted later to read-write according to the fstab entry. > If the disk is read-only I would guess that mounting read-write fails. > You need a read-only entry in /etc/fstab to stay read-only. Then this would be the fix, I think: --- distrib/common/bootimage/fstab.install.in.~1.3.~ 2019-01-31 11:00:01.000000000 -0800 +++ distrib/common/bootimage/fstab.install.in 2021-02-19 10:29:44.992710010 -0800 @@ -1,2 +1,2 @@ -ROOT.a / ffs rw 1 1 +ROOT.a / ffs ro 1 1 tmpfs /tmp tmpfs rw 0 0 -- Greg A. Woods <gwoods%acm.org@localhost> Kelowna, BC +1 250 762-7675 RoboHack <woods%robohack.ca@localhost> Planix, Inc. <woods%planix.com@localhost> Avoncote Farms <woods%avoncote.ca@localhost>
Attachment:
pgprCqV30nVRW.pgp
Description: OpenPGP Digital Signature