[systemd-devel] systemd 219 unmounting things unexpectedly

Steven Noonan steven at uplinklabs.net
Sun Mar 29 18:04:54 PDT 2015


I cherry-picked some patches from git, which fixed it, but they are
pretty big patches. At least it works now:

commit 628c89cc68ab96fce2de7ebba5933725d147aecc
Author: Lennart Poettering <lennart at poettering.net>
Date:   Fri Feb 27 21:55:08 2015 +0100

   core: rework device state logic

   This change introduces a new state "tentative" for device units. Device
   units are considered "plugged" when udev announced them, "dead" when
   they are not available in the kernel, and "tentative" when they are
   referenced in /proc/self/mountinfo or /proc/swaps but not (yet)
   announced via udev.

   This should fix a race when device nodes (like loop devices) are created
   and immediately mounted. Previously, systemd might end up seeing the
   mount unit before the device, and would thus pull down the mount because
   its BindTo dependency on the device would not be fulfilled.

commit 98f738b62047229af4a929d7996e2ab04253b02c
Author: Colin Walters <walters at verbum.org>
Date:   Tue Feb 17 13:47:34 2015 -0500

   unit: When stopping due to BindsTo=, log which unit caused it

   I'm trying to track down a relatively recent change in systemd
   which broke OSTree; see https://bugzilla.gnome.org/show_bug.cgi?id=743891

   Systemd started to stop sysroot.mount, and this patch should help
   me debug why at least.

   While we're here, "break" on the first unit we find that will
   deactivate, as there's no point in further iteration

commit 5bd4b173605142c7be493aa4d958ebaef21f421d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 25 22:05:14 2015 +0100

   unit: use weaker dependencies between mount and device units in --user mode

   When running in user mode unmounting of mount units when a device
   vanishes is unlikely to work, and even if it would work is already done
   by PID 1 anyway. HEnce, when creating implicit dependencies between
   mount units and their backing devices, created a Wants= type dependency
   in --user mode, but leave a BindsTo= dependency in --system mode.

On Sun, Mar 29, 2015 at 5:56 PM, Canek Peláez Valdés <caneko at gmail.com> wrote:
> On Sun, Mar 29, 2015 at 6:48 PM, Steven Noonan <steven at uplinklabs.net>
> wrote:
>>
>> This is weird. I issued a 'mount' command, which succeeds, but then
>> systemd jumps in and immediately unmounts it. What's going on here?
>>
>> Command issued:
>>
>> mount -o loop,ro someisofile.iso /mnt
>>
>> Journal shows this mess:
>>
>> Mar 29 17:39:06 loki systemd[2460]: Unit mnt.mount is bound to
>> inactive unit. Stopping, too.
>> Mar 29 17:39:06 loki systemd[1]: Unit mnt.mount is bound to inactive
>> unit. Stopping, too.
>> Mar 29 17:39:06 loki systemd[2480]: Unit mnt.mount is bound to
>> inactive unit. Stopping, too.
>> Mar 29 17:39:06 loki systemd[2460]: Unmounting /mnt...
>> Mar 29 17:39:06 loki systemd[2480]: Unmounting /mnt...
>> Mar 29 17:39:06 loki systemd[1]: Unmounting /mnt...
>> Mar 29 17:39:06 loki systemd[1]: mnt.mount mount process exited,
>> code=exited status=32
>> Mar 29 17:39:06 loki systemd[1]: Unmounted /mnt.
>> Mar 29 17:39:06 loki systemd[1]: Unit mnt.mount entered failed state.
>> Mar 29 17:39:06 loki systemd[2460]: mnt.mount mount process exited,
>> code=exited status=1
>> Mar 29 17:39:06 loki systemd[2460]: Unmounted /mnt.
>> Mar 29 17:39:06 loki systemd[2460]: Unit mnt.mount entered failed state.
>> Mar 29 17:39:06 loki umount[4173]: umount: /mnt: not mounted
>> Mar 29 17:39:06 loki umount[4175]: umount: /mnt: not mounted
>> Mar 29 17:39:06 loki systemd[1]: mnt.mount failed to run 'mount' task:
>> No such file or directory
>> Mar 29 17:39:06 loki systemd[1]: Failed to mount /mnt.
>> Mar 29 17:39:06 loki systemd[1]: Mounting /mnt...
>> Mar 29 17:39:06 loki systemd[2480]: Unmounted /mnt.
>>
>> systemd[1] is obviously PID1.
>> systemd[2460] is the 'systemd --user' for my user
>> systemd[2480] is the 'systemd --user' for root
>>
>> Why all three observed the '/mnt' mount appearing and all three
>> decided to issue the unmount is beyond me.
>>
>> What inactive unit is it talking about? I don't have a 'mnt.mount'
>> unit anywhere. Why did systemd decide to do this? Is there a way to
>> tell systemd to keep its hands off?
>
> https://bugs.freedesktop.org/show_bug.cgi?id=89383
>
> The propose patch works for me.
>
> Regards.
> --
> Canek Peláez Valdés
> Profesor de asignatura, Facultad de Ciencias
> Universidad Nacional Autónoma de México
>


More information about the systemd-devel mailing list