[arch-projects] [mkinitcpio][PATCH] shutdown: disassemble devices on shutdown v2

Dave Reisner d at falconindy.com
Thu Mar 29 21:38:46 EDT 2012


On Wed, Mar 28, 2012 at 11:30:08AM -0300, Gerardo Exequiel Pozzi wrote:
> On 03/28/2012 10:44 AM, Dave Reisner wrote:
> >>Is there any way to make something similar work with loop devices? You
> >>would need to disable the loop device before umounting the underlying
> >>file system. If we could solve this as well, then archiso probably
> >>wouldn't need its special shutdown hook anymore.
> >>
> >sure, lsblk loudly declares loop devices to be type loop. Hrmmm, archiso
> >does a lot of weird stuff... in particular, the squashfs mounts are
> >confusing me and/or lsblk. I'll get myself a newer image and poke around
> >at what Gerardo is doing on setup...
> >
> >I'm sure it's possible, I just need to understand what's happening.
> >
> >d
> >
> 
> Hello,
> 
> The first step on "shutdown" for archiso is a mount --move, since
> /oldroot depends on things from /oldroot/run/archiso. This make it a
> bit special.
> 

So, I need to understand more about this... why is this done? The
current shutdown hook that I have in my tree gets archiso's wacky setup
torn down properly sans loop devs. Add in a quick loop:

    # assume starting in /sys/class/block
    for loop in loop*/loop; do
        losetup -d "${loop%/loop}"
    done

And everything seems to be torn down properly because I'm lazily
unmounting everything.

  Unmounting all devices.
  Disassembling stacked devices.

  losetup: /dev/loop0: detach failed: Device or resource busy
  losetup: /dev/loop3: detach failed: Device or resource busy
  losetup: /dev/loop6: detach failed: Device or resource busy

  # findmnt
  TARGET  SOURCE FSTYPE   OPTIONS
  /       run[/initramfs]
                 tmpfs    rw,nosuid,nodev,relatime,mode=755
  |-/sys  sys    sysfs    rw,nosuid,nodev,noexec,relatime
  |-/proc proc   proc     rw,nosuid,nodev,noexec,relatime
  |-/dev  /dev   devtmpfs rw,nosuid,relatime,size=503104k,nr_inodes=125776,mode=75
  `-/run  run    tmpfs    rw,nosuid,nodev,relatime,mode=755

  # lsblk
  NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
  vda    254:0    0     5G  0 disk 
  |-vda1 254:1    0   100M  0 part 
  `-vda2 254:2    0   4.9G  0 part 
  sr0     11:0    1   200M  0 rom  
  loop0    7:0    0  92.9M  1 loop 
  loop3    7:3    0  34.3M  1 loop 
  loop6    7:6    0    53M  1 loop 

  # losetup -a
  /dev/loop0: [2816]:1930 (/arch/x86_64/root-image.fs.sfs)
  /dev/loop3: [2816]:1926 (/arch/x86_64/lib-modules.fs.sfs)
  /dev/loop6: [2816]:1414 (/arch/any/usr-share.fs.sfs)

Those three errors are something that archiso hides. So, as far as I can
tell, my hook is equivalent. Is there some serious problem with using
lazy unmounting that makes this non-desirable? I can't really find any
evidence of negative effects here.

d



More information about the arch-projects mailing list