[klibc] [PATCH 6/8] switch_root: Fix single file mounts

Michal Suchanek michal.suchanek at ruk.cuni.cz
Fri Jul 29 06:40:48 PDT 2011


Excerpts from maximilian attems's message of Fri Jul 29 10:27:39 +0200 2011:
> On Fri, Jul 29, 2011 at 10:15:29AM +0200, Michal Suchanek wrote:
> > Excerpts from Mike Waychison's message of Thu Jul 28 19:26:06 +0200 2011:
> > > On Wed, Jul 27, 2011 at 12:42 PM, maximilian attems <max at stro.at> wrote:
> > > > On Mon, 18 Jul 2011, Michal Suchanek wrote:
> > > >
> > > >> Hello,
> > > >>
> > > >> Excerpts from maximilian attems's message of Wed Jul 13 15:48:31 +0200 2011:
> > > >> > From: Michal Suchanek <michal.suchanek at ruk.cuni.cz>
> > > >> >
> > > >> > The root of the failure is that nuke cannot cope with file
> > > >> > mounts (single files mounted, not directories). These are the result of
> > > >> > using fuse to get to the root filesystem (httpfs, curlftpfs).
> > > 
> > > Why not just add support for unmounting the file?
> > 
> > Most likely it will be busy (backing /new_root).
> 
> I don't understand this statement.
>  
> > > 
> > > >> >
> > > >> > This fixes
> > > >> > http://bugs.debian.org/476268
> > > >>
> > > >> thanks for looking into this.
> > > >>
> > > >> Since this is a long-standing issue I wrapped the file mount in a tmpfs
> > > >> mount as a workaround.
> > > 
> > > How does this work?
> > 
> > The mountpoint is picked up by another part of the script and moved
> > somewhere where it does not get in the way of nuke_initramfs.
> 
> again please be more explicit and show us at least the code that is
> involved, currently one can only wild guess what you are trying to do.
> 
> If your case is some ghost /foo/bar/ mount in the initramfs what is that
> needed for and why?
> 
> I do agree that run-init needs to emit a warning when it can't remove
> something, this is easily fixable and will be, but that is not the
> use case you are currently promoting.
>  

The code is hundreds of lines of shell scripts so I will only briefly
describe the use case.

I was updating a script for a live cd to boot from different type of
filesystem.

The error I was debugging was caused by mounting the filesystem in
different place:

Usually you get /somedir/ <here CD is mounted> but I did /somedir/<fake
CD directory structure>/<put the correct file here>

Later another part of the script would try to move a mount from /somedir
and fail because it was mounted at /somedir/<fake CD directory tree>.
This was an issue with how the script fits together but run_init would
fail without telling anything about the nature of the error - failing to
remove the still present mount at /somedir/somewhere because it was not
moved earlier.

When things work the CD boots like this:

mount a CD or network location containing filesystem.squashfs
(optionally mount another location containing extra data)
mount tmpfs somewhere
(optionally copy extra data to tmpfs)
create a loop device for filessytem.squashfs
mount filesystem.squashfs somewhere
union squashfs content and tmpfs over new_root using aufs, unionmount or
whatever else

Now there are 3 mounts participating in new_root which can be either
moved to new_root/somedir or hidden somewhere so that neither nuke_initramfs nor
the system running from new_root would damage them. None can be
unmounted. All are busy.

Thanks

Michal



More information about the klibc mailing list