'make installkernel' succeeding on read-only fs?

Alexander Best arundel at freebsd.org
Sun Nov 20 18:10:59 UTC 2011


On Sun Nov 20 11, Alexander Best wrote:
> On Sun Nov 20 11, Denise H. G. wrote:
> > 
> > On 2011/11/19 at 19:24, Alexander Best <arundel at freebsd.org> wrote:
> > > 
> > > hi there,
> > > just stumbled upon this little detail:
> > > 
> > > 1) have "/" mounted read-only
> > > 2) 'make buildkernel'
> > > 3) 'make installkernel && echo "success"'
> > >    -> this will fail
> > > 4) 'mount -uw /'
> > > 5) 'make installkernel && echo "success"'
> > >    -> this will succeed
> > > 6) 'mount -ur /'
> > > 7) 'make installkernel && echo "success"'
> > >    -> this will succeed. why?
> > 
> > According to mount(8), 'mount -ur /' will fail if / is already mounted
> > read-write with any files currently opened by some processes. I think
> > this might be your case.
> 
> i'd don't think so:
> 
> otaku% sudo mount -uw /
> otaku% echo $?
> 0
> otaku% sudo mount -ur /
> otaku% echo $?         
> 0
> 
> ...also 'mount -p' reports "/" to be read-only again.
> 
> ...also during 7), mkdir(1) returns an error that "/" isn't writable. it's
> install(1) that claims the kernel was successfully installed into /boot/kernel,
> although installation of the kernel didn't succeed.
> 
> i don't think this is an install(1) issue, since in 3), install(1) returns an
> error. i think in 7), install(1)'s output gets somehow redirected to /dev/null,
> and its return value isn't being preserved.
> 
> i'll try to use 'mount -ufr /' in 6) and see, if that has any impact. also
> after 6) i'll try to run install(1) manually to see, whether it actually
> reports an error (then the build(7) facility is to blame) or not (in which case
> there's a problem with install(1) itself).

MYSTERY SOLVED! ;)

install gets executed with the -p option, which implies the -C option. this
means that install will do a comparison of the installed kernel in /boot/kernel
and the one in /usr/obj, before actually executing. during the first
installkernel invocation, the files differ, so install complains. during the
second invocation the files don't differ. that's why install succeeds, although
"/" is mounted read-only. ;)

cheers.
alex

> 
> cheers.
> alex
> 
> > 
> > > 
> > > cheers.
> > > alex
> > > ................ 
> > 
> > 
> > 
> > -- 
> > If you've got them by the balls,
> > their hearts and minds will follow.


More information about the freebsd-toolchain mailing list