[sf-lug] sudo abuse, suspend/shutdown, and polkit

Akkana Peck akkana at shallowsky.com
Tue Feb 19 15:30:48 PST 2019


Rick Moen writes:
> Quoting Akkana Peck (akkana at shallowsky.com):
> 
> [snip]
> 
> > And it may be that systemd's suspend
> > and shutdown services require polkit to work:
> > man systemd-logind.service suggests they may be joined at the hip.
> 
> I'm pretty sure that's the case.  My frequent characterisation is that
> systemd, PolKit, upower, udisks2 (in particular) are a dependency
> hairball of Freedesktop.org codebases.  They're written to require each
> other (a large part of why I want to avoid them).

Gotcha. I guess I'll give up on this crazy quest to shut down via
systemd and without root.

> The old-school way of doing shutdown has always been:
> 
> $ su -
> # shutdown -h now

I usually use /sbin/poweroff these days, to be absolutely clear
about what I want. In the past, I've had some machines that would
shut down on shutdown -h now but not actually power down. That's
probably rare now, but I figure it doesn't hurt to be clear.

But I'll do it through sudo because it seems silly to have to
type three lines instead of one for something I do every day.
And besides, sometimes I shut down through a windowmanager menu,
where su to a new shell isn't an option.

> _Or_ for lazy people like me, you do Ctrl-Alt-F1 to change to a text
> console, do ctrl-alt-del to initiate orderly shutdown and reboot, but
> then shut off the power switch before reboot gets very far.  (Thus, just
> two keystrokes.)

Ha. Lately, shutting down often involves pulling the plug (or
pulling the battery out of the laptop) because of another supremely
annoying systemd misfeature, "A stop job is running", followed by a
90-second pointless delay before the system finishes shutting down,
with no way to debug what the actual problem is and why it has
decided to wait 90 seconds on this particular shutdown.

I spent days chasing down one of those and it turned out to mean
"some obscure systemd file has the wrong UUID for the swap partition".
I fixed that, at least for a while, but now I'm getting stop job
delays again and I haven't changed the swap partition.

> I guess the old-school way of entering suspend-to-RAM is with
> 
> $ su -
> # echo 2 > /proc/acpi/sleep
> 
> (Above is according to
> https://github.com/torvalds/linux/blob/master/Documentation/power/swsusp.txt , 
> but I'm not sure.
> 
> The pm-utils scripts (power management utilities) traditionally handled
> such things prior to the Freedesktop.org people deciding to stop
> maintaining those and force-upgrade everyone to upower.  I'm not clear
> on whether those are still a best-of-breed option; possibly.  (I mostly
> run Linux on servers, and don't do suspend.)

For years I've been using "pm-suspend --auto-quirks", which works
on all my machines. With sudo, of course. I used to use
various ACPI methods to suspend, years ago, but they changed
frequently so I kept needing to update my aliases, and more recently
I was under the impression most of those ACPI methods were deprecated
(though I still use /usr/bin/acpi with no arguments to check
the battery charge state on my laptop).


        ...Akkana



More information about the sf-lug mailing list