<div dir="ltr"><div>It is a call to systemd-mount done from initramfs. It ends up in /run/systemd/transient and survives the root switch. The generated unit contains Requires=systemd-fsck@....service.<br></div><div><br></div><div></div><div>Is the conflict on shutdown.target to make shutdown kill fsck if it is running?<br></div><br><div>Generated systemd-cryptsetup@.service units have "DefaultDependencies=no" and no conflict on shutdown. Maybe this is missing then. "cryptsetup attach" might be running.<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jan 6, 2023 at 1:34 PM Lennart Poettering <<a href="mailto:lennart@poettering.net">lennart@poettering.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Do, 05.01.23 14:18, Valentin David (<a href="mailto:valentin.david@canonical.com" target="_blank">valentin.david@canonical.com</a>) wrote:<br>
<br>
> Hello,<br>
><br>
> In Ubuntu Core, we have some mounts that cannot be unmounted until we have<br>
> switched root.<br>
><br>
> To simplify, this looks like that:<br>
><br>
> / mounts a ro loop devices backed by /some/disk/some/path/image.img<br>
> /some/disk mounts a block device (let's say /dev/some-block0p1)<br>
><br>
> In this case, /some/disk cannot be unmounted.<br>
><br>
> We do not want to lazily unmount, we cannot get errors if something fails.<br>
> (Unless we had a lazy unmount that would only work when read-only)<br>
><br>
> We do remount /some/disk read-only on shutdown. And in the shutdown<br>
> intramfs, we unmount /oldroot/some/disk.<br>
><br>
> However, we get an error message with systemd trying to unmount it. While<br>
> functionally, it does not matter, it is still very problematic to have<br>
> error messages.<br>
><br>
> Using `DefaultDependencies=no` is not enough. I have tried to be clever and<br>
> add some-disk.mount to shutdown.target.wants so it would not try to unmount<br>
> it. But systemd got confused with conflicts and randomly kills stop jobs<br>
> until there is no conflict.<br>
><br>
> Debugging it, I have found that this is because some-disk.mount depends on<br>
> systemd-fsck@some\x2dblock0p1.service. And systemd-fsck@.service conflicts<br>
> with shutdown.target.<br>
><br>
> I wonder if having conflict on shutdown.target really needed. Could we<br>
> remove it? (And also add DefaultDepenencies=no to<br>
> system-systemd\x2dfsck.slice) With this, mounts with DefaultDependencie=no<br>
> do not get unmounted as part of shutdown.target. (They do during<br>
> systemd-shutdown)<br>
<br>
hmm, so we generally want system services to go away before<br>
shutdown. This is a very special case though. I wonder if we can just<br>
override systemd-fsck@….service for that specific case?<br>
<br>
How are those mounts established? i.e. by which unit is the<br>
systemd-fsck@.service instance pulled in? and how was that configured?<br>
fstab? ubuntu-own code?<br>
<br>
Lennart<br>
<br>
--<br>
Lennart Poettering, Berlin<br>
</blockquote></div>