[systemd-devel] sigpwr.target - intended usage?

Lennart Poettering lennart at poettering.net
Mon Jul 18 10:36:21 UTC 2016


On Sat, 16.07.16 17:22, Christian Hofstaedtler (ch at zeha.at) wrote:

> Hi,
> 
> I'm trying to understand how sigpwr.target is intended to be used,
> but couldn't find a good explanation. systemd.special says this
> target is invoked in a power fail situation, but what should happen
> then?
> 
> Debian, Ubuntu and PLD install "sigpwr-container-shutdown.service",
> which for ConditionVirtualization=container runs systemctl
> --no-block poweroff, i.e. triggers a shutdown for containers. For
> "normal" hardware, nothing appears to be triggered.
> 
> I could not find any services installed by Fedora or openSuSE, but
> maybe I was looking in the wrong places.
> 
> I'm now somewhat assuming there should be a default "policy" service
> that causes sigpwr.target to initiate a shutdown?
> 
> Pointers/hints on what is expected behaviour from sigpwr.target
> would be highly appreciated.

My recommendatin: don't bother with SIGPWR. Traditionally on UNIX UPS
software sends SIGPWR to PID 1 to initiate some special kind of
shutdown operation. But it's very vaguely defined only, and one
wonders why a normal shutdown isn't enough here, and why to bounce
this off PID 1 with a special UNIX signal even...

I am pretty sure that power management software that runs in userspace
really shouldn't make use of this anymore. It should just request a
normal shutdown. The only reason why one would want to bother with
SIGPWR at all is that some really power-related old kernel drivers
send SIGPWR to PID 1 too.

>From the systemd PoV: this stuff is ugly legacy crap that only exists
for historic reasons and was never really well-defined in its
behavour. It mostly appears to be a concept that exists only because
Linux never had a useful IPC that was accessible from both kernelspace
and userspace in a sane way... In systemd, we don't want anything to
do with it, but some legacy folks really think it's superduper
important. Hence we simply map it to a target unit, and enable users
to map it to whatever they want to map it, but don't do anything smart
about it at all on our own.

I think it would be best of people would just forget about it...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list