[systemd-devel] Intercepting/Delaying the boot process

Andreas Hartmann hartan at 7x.de
Fri Apr 8 07:01:31 UTC 2022


Hi,


I've been owning a Pinephone for a while now and one thing that I find rather
annoying is that whenever I plug the charger in, the thing will perform a full
boot. I often find myself just wanting to plug it in without performing a full
boot, i.e. only to have it charge and maybe see how far it has charged already.

To this end I was wondering whether it would be feasible to "hook" into the boot
process, somewhere before the disks are decrypted, to only have it charge (or
continue to boot when I press some magic button maybe). Looking at the order of
service startup I was thinking about maybe intercepting the boot between "local-
fs-pre.target" and "machines.target" because nothing happens there on my setup.

For this to work ideally I would like to have the sysfs available so I don't have
to interact with the kernel directly. So here are my questions:

- After which stage in the boot process is the sysfs available?
- Can I delay the boot for an indefinite amount of time, or will this cause some
services later on in the process to timeout and fail?
- Is it possible for a service during early boot to command a system shutdown
instead of continuing to boot?
- May I simply take control of the TTY and clear/rewrite it as I like, or does
systemd use some magic for this?

Thank you in advance!


hartan




More information about the systemd-devel mailing list