Getting back suspend/resume with KDE 5’s powerdevil and no systemd by installing an obsolete version of upower

Using a package out of date since more 2 years ago does not sound like a success story but that is the only way so far I found to get suspend/resume to work without systemd within KDE5 without headaches. pm-suspend and pm-hibernate, on the command line, work perfectly though.

Why? Because Powerdevil, KDE’s power management tool, use upower which itself deprecated pm-utils support in favor of systemd.  So, no matter whether your hardware can actually suspend and hibernate, no matter if the kernel, GNU/Linux itself, can handle, upower won’t.

When calling upower -d, it should output something with can-suspend and can-hibernate. Since they dropped support for pm-utils, it won’t if you don’t use systemd . It’ll behave as if it knew what it was doing except it does not.

I filled a bug report and this one was discarded very fast. Martin Gräßlin immediately marked it as RESOLVED DOWNSTREAM with the comment “This works fine on Debian testing. Please get in contact with your distribution to figure out why this broke in your Debian fork. You might consider of course to install systemd”. You get the idea.  Thanks to Michael Palimaka, I got confirmation that it was tied to upower version (which I guessed beforehand because of several related messages by some Ubuntu or else users – hence the mention “with upower 0.99.3 and Devuan” in my report title) and he listed working solutions: using systemd; using ConsoleKit2; using upower <=0.9.23.

Using systemd to fix a problem caused by an attempt not to use systemd? Not an option. Using ConsoleKit2? Except I have no knowledge of ConsoleKit2 being packaged yet, neither do I know which release of upower actually got ConsoleKit2 support.

So I went for the third option, the lamest obviously, that is installing obsolete, unsupported software, and put in on hold. It can be done as follow:

echo "deb http://ftp.debian.org/debian wheezy main" > /etc/apt/sources.list.d/oldstable.list
apt-get update
apt-get -t wheezy install libgnutls26 libgcrypt11 libtasn1-3 libusbmuxd1 libimobiledevice2 upower libupower-glib libplist1
echo "upower hold" | dpkg --set-selections

Then a call to upower -d gives:

Daemon:
 daemon-version: 0.9.17
 can-suspend: no
 can-hibernate no
 on-battery: no
 on-low-battery: no
 lid-is-closed: no
 lid-is-present: no
 is-docked: no

It is better but still no good. As root it’ll work, though. You need to add some PolicyKit rule to allow regular users to use it. The following assumes that powerdev group exists and that your regular users are in this group (if they are not, add them with adduser thisuser powerdev):

echo "[Suspend power group override]
Identity=unix-group:powerdev
Action=org.freedesktop.upower.suspend
ResultAny=yes
ResultInactive=yes
ResultActive=yes

[Hibernate power group override]
Identity=unix-group:powerdev
Action=org.freedesktop.upower.hibernate
ResultAny=yes
ResultInactive=yes
ResultActive=yes" > /etc/polkit-1/localauthority/50-local.d/power-group.suspend-override.pkla

Now, if done properly, upower -d returns:

Daemon:
 daemon-version: 0.9.17
 can-suspend: yes
 can-hibernate yes
 on-battery: no
 on-low-battery: no
 lid-is-closed: no
 lid-is-present: no
 is-docked: no

Logout and login should be enough to have back suspend and hibernate within KDE5.

So this works. For now. But there is no doubt, this is wrong in so many ways. I wonder for how long it will be possible to run a modern desktop environment on GNU/Linux, and not on systemd/whatever.

 

Next Step towards GNUStep within KDE

Back in the days I started using GNU/Linux, the only user-friendly desktop environment available was KDE 1. So I started using KDE 1. Afterwards, considering license issue of Qt (that was no Libre Software at that time) KDE was depending on, considering progress being made by the GNOME project, I switched to GNOME 1.

Then, my brother Philippe advised me to give a try to WindowMaker. I did. At first, I was puzzled. But finally, I adopted this desktop environment inspired by NextStep. The main point is to kick the taskbar and the big start menu and, instead, going through apps with the right or middle click on the desk and having each important app to get a dock, which one could be used to launch the app or show the app if already launched.

Years afterwards, WindowMaker seemed to make no longer any progress and I wanted a modern desktop environment. Which means I wanted a desktop environment in which every piece of software is neatly integrated, where configuring new features is easy – while toying with both WPrefs and wmakerconf was not. And Qt was freed. So I get back to KDE. GNOME was longer an option, as I do not trust GNOME leaders like Miguel De Icaza to make the right decisions (the Nautilus and Eazel story was revealing enough for me: trying to behave corporatish, they chose the worse software to be the GNOME file manager, but they did while it wasn’t even coded, they only trusted a newly founded company made by people with no experience in Libre Software to do the right and good thing) and it was no surprise to me when HelixCode/Ximian/whatever-crap-it-is-renamed started to sell proprietary software under the denomination commercial software after implementing .NET, I expected nothing more from people talking about Open Source mumbo-jumbo ESR style, instead of Free Sofware, while they were getting popular just because of their involvment in a GNU project. KDE is powerful, rock-solid. But it is also über-conventional. They know what is working good in MS Windows, they clone it, improve it and release it. Moreover, KDE tries to address a broad audience, so KDE is made to seem familiar even to people having no clue about GNU/Linux. Moving back to KDE meant loosing the interesting design of WindowMaker.

Then, I had the opportunity to look at an Apple Macbook Pro. The dock, for good reasons, reminded me of WindowMaker. And finally, I found Daisy. It is a clone of Mac OS X dock, it works like the WindowMaker dock. But it is a plasmoid for KDE. It’s only just clumsier to set up (no easy drag and drop), prone to bugs (sometimes, a click on the dock app launcher start two instance). But it works. And I trashed once more the taskbar I definitely do not like.

KDE with Daisy, WindowMaker/Mac Os X style!

There is no Debian package, so I went to Ubuntu plasma-widget-daisy page. There, I downloaded the source tarball and the debian part (which contains the debian folder necessary to built the package). I extracted them all in a temporary directory. Then:

1/ I edited the debian/changelog file to add a new entry.

2/ I edited “Build-Depends:” in the debian/control file to depends on the pkg-kde-tools version that comes with my system (Debian unstable).

3/ I installed necessary dependancies to build the package – as the package was not in debian trunk, I made the guess that it had the same deps than the similar package plasma-widget-ktorrent:

# apt-get build-dep plasma-widget-ktorrent

4/ I rebuilt it:

$ dpkg-buildpackage -r fakeroot plasma-widget-daisy

5/ Then I installed the package.

You can fetch my plasma-widget-daisy_0.0.4.22a-0ubuntu2-fordebian1_amd64.deb package built against debian sid (unstable) for an amd64 architecture.

I also posted a RFP (request for packaging) against wnpp in debian BTS (bug tracking system).