On Fri, Nov 16, 2018 at 12:11 AM Andrew Udvare <audv...@gmail.com> wrote:
>
> - use key to decrypt root partition (systemd job in the first systemd
> launched within initramfs)
> ...
> Nov 16 00:01:52 limelight systemd[1]: Dependency failed for /mnt/chuan.
> Nov 16 00:01:52 limelight systemd[1]: mnt-chuan.mount: Job
> mnt-chuan.mount/start failed with result 'dependency'.

So, I haven't messed around that much with systemd and removable
media, but a few things I'd start by looking at:

systemctl show mnt-chuan.mount
systemctl list-dependencies --reverse --all mnt-chuan.mount

I'd have to read up the manpages on how automounting works and what
the appropriate flags are in fstab to trigger that.  Obviously that is
someplace else to check.

Clearly you have things set up so that the usb drive is mounted before
your script goes and reads the key off of it.  If you're doing that in
a service and have a dependency on the usb drive (or system somehow
figured out that there should be a dependency on it), and that service
is left in a running state after the decryption is done, that could be
causing issues as systemd thinks that drive is still needed and is
desperately trying to get it back.

With systemd mountpoints are units, and can be started/stopped like
any service and can be dependencies of services.  This is usually a
good thing, but services tend to be persistent and removable drives
tend not to be, so you probably need to use some care when mixing the
two.  Note that due to generators system will create mount units
automatically from fstab and other sources.  Usually traditional
commands like mount/umount and so on just do the right thing, but if
you've inadvertently enabled some kind of automounting logic or
systemd believes there is a dependency with another unit then you
might be fighting the system.

Here is another route you could take.  When you want to remove that
usb drive, instead of just pulling it out or manually unmounting it,
try running:
systemctl stop mnt-chuan.mount
That is asking systemd to nicely unmount it.  If systemd doesn't want
to unmount it then it will nicely tell you take a hike, but perhaps
the error output will give you some clues as to why.

-- 
Rich

Reply via email to