[systemd-devel] Implementing resume from hibernation as a systemd unit file
Ivan Shapovalov
intelfx100 at gmail.com
Thu Aug 21 11:06:49 PDT 2014
On Thursday 21 August 2014 at 01:03:20, Lennart Poettering wrote:
> [...]
> > >
> > > ...missing sysroot's fsck, as well as any other x-initrd mounts and their fsck instances.
> > >
> > > Seems that sysroot.mount alone isn't sufficient.
> >
> > ...Anything on this?
> >
> > Should we add yet another passive target(s), something like fsck-pre? I don't
> > actually know what is the best way to tackle this. The resume unit shall be
> > activated before any writes to any block devices, including fsck, cryptsetup
> > and whatever else.
>
> Hmm, so I though a bit about this, and I think we should make the
> following changes to systemd:
>
> a) move local-fs-pre.target before all the fsck. This way we can make
> use of it as a barrier against modifications of any fs.
...all fsck except the systemd-fsck-root.service, right? It's already ordered
before local-fs-pre.target.
Makes sense; then the resume unit will be
Wants=local-fs-pre.target
Before=local-fs-pre.target systemd-fsck-root.service systemd-remount-fs.service shutdown.target
ConditionPathIsReadWrite=!/
However, this breaks when there is a legacy /usr mount without fsck...
src/core/mount.c:mount_add_default_dependencies() does not add
After=local-fs-pre.target if the mount in question is / or /usr.
Hence, the legacy /usr mount is missed by this scheme.
>
>
> b) introduce initrd-fs-pre.target that then plays a similar role, but in
> the initrd.
Is it neeeded? IIUC, local-fs-pre.target can be used in initramfs as well,
the default dependency on this target is still generated on all mounts.
(except in-initramfs /usr, see the above problem)
>
> A service that wants to run before any fs is touched should then order
> itself before both and everything should be good.
>
> If this makes sense, I would be happy to take a patch.
>
> I'd be willing to merge a good patch for a generator + mini-tool that
> parse the resume= option into systemd as well, btw.
I've already implemented the generator and resume tool prototype. Sure, when we
solve the dependencies problem, I'll submit this for inclusion.
--
Ivan Shapovalov / intelfx /
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140821/082579db/attachment.sig>
More information about the systemd-devel
mailing list