On Thursday 14 August 2014 at 03:10:30, Lennart Poettering wrote: > On Mon, 28.07.14 14:06, Ivan Shapovalov ([email protected]) wrote: > > > Hello all, > > > > I'm trying to implement resuming from hibernation with systemd-based > > initramfs, > > i. e. in terms of systemd unit files. That is, there should be a unit which > > waits for the resume device and writes its major:minor into > > /sys/power/resume. > > > > I've chosen to write a templated resume@<path>.service and a generator which > > parses 'resume=' kernel parameter and enables a corresponding instance of > > the > > [email protected] unit. > > > > The [email protected] itself shall be ordered so that it is activated when > > there > > are no filesystems mounted read-write, except tmpfs instances. It will be > > good > > if it works both from initramfs and from real rootfs (if it is mounted RO). > > > > So, here are some questions: > > - is it the way to go (overall)? > > - is it OK to use generators for outlined purpose? > > - how to order [email protected] and where to symlink it? > > > > I'm using Arch, if that matters -- but, IIUC, Arch strives to do everything > > "in the upstream's way", so there should be no distro-specific details. > > I am not entirely sure how the hibernation logic precisely works, but > wouldn't it be possible to write a little udev rule (maybe with a > helper) that adds a special device node symlink to the resume partition, > so that /dev/disk/resume or so always points to the resume partition to > use? > > That udev rule should then maybe also pull in a unit that acts on > it. But that unit doesn't have to be an instance, could just be a normal > one... > > Does that make any sense? > > Lennart
The udev rule should be possible (provided that udevd does not need rootfs remounted read-write -- I'd like to preserve some decency towards initrd-less systems), but udev is a framework for handling events, whereas we don't have any events here: such symlink can be derived from kernel command-line alone, statically. Yes, a udev rule would allow to create a symlink which is tracked by systemd, so the dev-disk-resume.device appears and then it can be easily After='ed from the resume unit, but... really, is udev the proper tool for this? Actually, the main question is how to order the resume unit. It needs to run before any real filesystems are mounted (speaking in terms of initrd) AND before rootfs is remounted read-write (speaking in terms of initrd-less system), but after whatever is needed to make the device node appear. Thanks, -- Ivan Shapovalov / intelfx /
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
