View previous topic :: View next topic |
Author |
Message |
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Fri Jan 08, 2021 7:16 pm Post subject: sys-power/pm-utils after last-riting |
|
|
Hi
The last-riting of sys-power/pm-utils and sys-power/pm-quirks was announced.
"Replaced by elogind or systemd builtin functions". As I don't use neither elogind, nor systemd, and as pm-utils work fine on my laptop, I decided to keep pm-utils in my GitHub repositories (despite of one more ebuild of the last 1.4.1-r7 version exists in c2p-overlay).
How that turned out:
I successfully copied pm-utils/pm-quirks ebuilds and all other files from the main Gentoo tree to my overlay.
Then I saw that the pm-utils ebuild applies many patches, missing upstream; the upstream, indeed, looks abandoned.
I made a fork of the pm-utils GitHub mirror, applied all the missing patches and made it a new version (1.4.2) - mainly for git practicing purposes. I've been able to commit some patches with `git am --signoff` so that their authors are shown.
Trying to write the ebuild for this new version, I found that the source code that I forked on GitHub differs from the source code of the last release used in ::Gentoo. The main difference is that there is no configure script in my fork.
I found a solution: 'eautoreconf' from autotools.eclass.
Finally, the new version is successfully compiling and installing. I haven't yet had time to test how it works.
Please ping me if :
you are also a user of pm-utils and are interested in keeping it available for Gentoo;
you know other patches to apply to pm-utils;
you find some issues using my overlay / fork.
https://github.com/halcon74/halcon-overlay/blob/master/sys-power/pm-utils/pm-utils-9999.ebuild
https://github.com/halcon74/pm-utils/commits/pm-utils-1.4
LAST UPDATE
Included all the patches present in ::gentoo before last-riting in January 2021, non-specific Debian patches and a patch from c2p-overlay.
Included all the additional files from Gentoo/Debian (the same).
Deleted obsolete files which was being removed by Gentoo ebuild / Debian rules.
Included pm-quirks.
Fixed Gentoo bugs 666380, 579912, 549848, 489650, 443530, 703026 and Debian bugs 485443, 659260. _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
asturm Developer
Joined: 05 Apr 2007 Posts: 9280
|
Posted: Mon Jan 11, 2021 6:50 am Post subject: |
|
|
You might also want to check if sys-power/suspend does what you need instead. |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2179
|
Posted: Mon Jan 11, 2021 9:20 am Post subject: |
|
|
asturm wrote: | You might also want to check if sys-power/suspend does what you need instead. |
Following the packages.gentoo.org link to suspend.sourceforge.net takes me to a package that's not been updated since 2011. That's only marginally better than pm-utils!
laptop-mode-tools seems to be much more up-to-date, though I'm not sure if it's functionally equivalent. _________________ Greybeard |
|
Back to top |
|
|
asturm Developer
Joined: 05 Apr 2007 Posts: 9280
|
Posted: Mon Jan 11, 2021 9:44 am Post subject: |
|
|
At least it seems to have regular snapshots:
Code: | $ equery l -op suspend
* Searching for suspend ...
[-P-] [ ] sys-power/suspend-1.0_p20190605:0
[-P-] [ ] sys-power/suspend-1.0_p20200924:0 |
|
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Mon Jan 11, 2021 12:35 pm Post subject: |
|
|
asturm, Goverp, thanks for your attention!
asturm wrote: | sys-power/suspend |
I've never tried it. I think that I should, yes...
Goverp wrote: | laptop-mode-tools |
Hmmm... I remember that I tried it many years ago, during the first Gentoo installation on a laptop, and I didn't like something (can't remember what exactly; I guess, it is indeed not an equivalent) and preferred pm-utils, and since then the line "emerge -v pm-utils" has never been changed in my personal "Gentoo installation tutorial"...
I am not going to put too much effort in this pm-utils fork. Just feel pity that, in essence, a very well-established tool, to which I've been used for years, turned out abandoned (and last-rited).
Becoming new pm-utils maintainer is not my purpose. First, I have not been able for a long time to bring myself to learn automake Second, I think that cleaning up all that mess with patching-removing-adding in Gentoo/Debian (all Linux distros? ) is the least that I should have done. Maybe anybody else, more experienced, will take over the baton from me in some time? Or just send me PRs
Actually, I am personally interested to make at least 2 things more:
- build the last version, with all changes, on Debian (I haven't yet done that on Debian; on Gentoo it's OK)
- debug/understand why a script for creating ChangeLog in Makefile.am does not work _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
patrickdepinguin n00b
Joined: 18 Jan 2007 Posts: 14
|
Posted: Tue Jan 19, 2021 8:12 am Post subject: |
|
|
I have been using pm-utils for years without problems. Having seen the deprecation, I emerged sys-power/suspend to see if I can use that instead.
However, since I installed sys-power/suspend, my regular pm-hibernate is broken. It hibernates fine based on the logs, but the thaw does not happen and I get a full boot from scratch.
I have not made any changes to the configuration of pm-utils or kernel, I just installed sys-power/suspend. I don't understand the link between both.
I also tried running s2disk from sys-power/suspend, which first expected a valid config file. I made one change to the stock config file, to fill in my resume partition (set to my swap partition). This seems to resume but also does not thaw.
I would be fine with sys-power/suspend if it worked, or continue using a forked pm-utils. But like halcon, I don't want to install elogind just to get something to work that worked fine before without it.
Do you have any tips on restoring or debugging my current pm-utils setup?
And what are the remaining problems with your fork? You mention some problems with autotools but it's not clear to me what they currently are. I have some knowledge of autotools in general, not specifically inside ebuilds though. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22685
|
Posted: Tue Jan 19, 2021 5:23 pm Post subject: |
|
|
You may need to use a matched suspend/resume pair. If you hibernate with s2disk, you need to resume using the resume command from the same package. If you hibernate using the in-kernel hibernation, then you need to use the in-kernel resume. Mixing may lead to the resume side logic failing to recognize a "foreign" hibernation image, which it would then refuse to resume. I used sys-power/suspend for a long time, but switched to the in-kernel hibernation and have been quite happy with it. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Tue Jan 19, 2021 6:30 pm Post subject: |
|
|
patrickdepinguin wrote: | I have not made any changes to the configuration of pm-utils or kernel, I just installed sys-power/suspend. I don't understand the link between both. |
These two packages are not related with each other. pm-utils installs three main binaries: pm-suspend, pm-hibernate and pm-suspend-hybrid. And sys-power/suspend installs, correspondingly, s2ram, s2disk and s2both. WRT libs, pm-utils installs them into /usr/lib64/pm-utils, and sys-power/suspend installs into /usr/lib64/suspend.
patrickdepinguin wrote: | I also tried running s2disk from sys-power/suspend, which first expected a valid config file. I made one change to the stock config file, to fill in my resume partition (set to my swap partition). This seems to resume but also does not thaw. |
I haven't yet tried to use sys-power/suspend (just installed, looked at its files and then uninstalled).
patrickdepinguin wrote: | since I installed sys-power/suspend, my regular pm-hibernate is broken |
patrickdepinguin wrote: | Do you have any tips on restoring or debugging my current pm-utils setup? |
Unfortunately, no, except uninstalling sys-power/suspend.
patrickdepinguin wrote: | And what are the remaining problems with your fork? You mention some problems with autotools but it's not clear to me what they currently are. I have some knowledge of autotools in general, not specifically inside ebuilds though. |
My main problem with autotools is that my knowledge of it is poor. I have been able to edit makefiles so that the forked version is being installed correctly but I don't understand the meaning of each line in each makefile... The fork works fine for me as it is now (I use pm-hibernate). _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
patrickdepinguin n00b
Joined: 18 Jan 2007 Posts: 14
|
Posted: Fri Jan 29, 2021 9:58 am Post subject: |
|
|
I found the link between sys-power/suspend and pm-utils: pm-hibernate will actually hibernate via s2disk if that binary is found. So the installation of sys-power/suspend does change the behavior of pm-utils.
Uninstalling sys-power/suspend again fixes my hibernation via pm-utils.
I still don't understand the reason that s2disk did not work though. I looked at the scripts in the initramfs, and as far as I can see the resume part should be the same between the kernel hibernation and software hibernation via s2disk, i.e. echo'ing the resume device to a /sys file. So the problem may be in the hibernate part itself.
I do have an encrypted root partition with luks/dm-crypt, although my swap is unencrypted. On the following gentoo bug, there is a reference to requiring 'resume-offset' in such case, but it's not clear to me what the offset should be. And also, it's not clear whether or not this bug is still applicable, i.e. whether genkernel supports resume from s2disk out-of-the-box now or not.
https://bugs.gentoo.org/156445#c50 |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Fri Jan 29, 2021 11:26 am Post subject: |
|
|
patrickdepinguin wrote: | I found the link between sys-power/suspend and pm-utils: pm-hibernate will actually hibernate via s2disk if that binary is found. So the installation of sys-power/suspend does change the behavior of pm-utils.
Uninstalling sys-power/suspend again fixes my hibernation via pm-utils. |
That is non-default pm-utils behavior. From /usr/lib64/pm-utils/defaults:
Code: | ##########################################################
# DO NOT EDIT THIS FILE! #
# #
# Add files in /etc/pm/config.d/ instead! #
##########################################################
<...>
# The default sleep/wake system to use. Valid values are:
# kernel The built-in kernel suspend/resume support.
# Use this if nothing else is supported on your system.
# uswsusp If your system has support for the userspace
# suspend programs (s2ram/s2disk/s2both), then use this.
# tuxonice If your system has support for tuxonice, use this.
#
# The system defaults to "kernel" if this is commented out.
# SLEEP_MODULE="kernel" |
EDIT
My apologies... I didn't look carefully at the text I'm posting myself:
# The system defaults to "kernel" if this is commented out.
So, you're right, evidently, "uswsusp" is a default. To switch to "kernel", one has to add the line SLEEP_MODULE="kernel" to a file in /etc/pm/config.d/. _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22685
|
Posted: Fri Jan 29, 2021 6:09 pm Post subject: |
|
|
patrickdepinguin wrote: | I still don't understand the reason that s2disk did not work though. I looked at the scripts in the initramfs, and as far as I can see the resume part should be the same between the kernel hibernation and software hibernation via s2disk, i.e. echo'ing the resume device to a /sys file. So the problem may be in the hibernate part itself. | As I wrote above, I think you need a matched suspend/resume pair. If you hibernate via s2disk, I think you need to resume via the resume command provided by sys-power/suspend. Mixing s2disk to hibernate and echo >/sys/power/resume to resume is trying to mix two different techniques. patrickdepinguin wrote: | I do have an encrypted root partition with luks/dm-crypt, although my swap is unencrypted. | Why bother encrypting the drive and then keeping an unencrypted swap? Anything that pages out in normal use, or that is written to swap for hibernation, will then be visible in the clear. patrickdepinguin wrote: | On the following gentoo bug, there is a reference to requiring 'resume-offset' in such case, but it's not clear to me what the offset should be. And also, it's not clear whether or not this bug is still applicable, i.e. whether genkernel supports resume from s2disk out-of-the-box now or not.
https://bugs.gentoo.org/156445#c50 | As I read that comment, the parameter is required when using swap in a file on an encrypted filesystem. You are using unencrypted swap directly on a partition. Therefore, you should not need this parameter. |
|
Back to top |
|
|
patrickdepinguin n00b
Joined: 18 Jan 2007 Posts: 14
|
Posted: Sat Jan 30, 2021 9:26 am Post subject: |
|
|
Hu wrote: | As I wrote above, I think you need a matched suspend/resume pair. If you hibernate via s2disk, I think you need to resume via the resume command provided by sys-power/suspend. Mixing s2disk to hibernate and echo >/sys/power/resume to resume is trying to mix two different techniques. |
But how? I'm not doing any manual action to resume. I turn up the pc, the kernel commandline contains a resume= parameter, and the initramfs I created with genkernel initiates the resume.
Should the 'resume=' parameter be removed for s2disk resume?
Hu wrote: |
Why bother encrypting the drive and then keeping an unencrypted swap? Anything that pages out in normal use, or that is written to swap for hibernation, will then be visible in the clear. |
Yes, you're right. I initially did not bother because supposedly hibernation is more complex sure to that, but maybe it's fine after all.
I'd need to check how to make the switch to encrypted swap in an existing system.
Hu wrote: | As I read that comment, the parameter is required when using swap in a file on an encrypted filesystem. You are using unencrypted swap directly on a partition. Therefore, you should not need this parameter. |
Ok thanks for confirming. |
|
Back to top |
|
|
asturm Developer
Joined: 05 Apr 2007 Posts: 9280
|
Posted: Sat Jan 30, 2021 3:26 pm Post subject: |
|
|
halcon wrote: | I haven't yet tried to use sys-power/suspend (just installed, looked at its files and then uninstalled). |
I've extended pm-utils last-rites time for a bit, but please check out sys-power/suspend or sys-power/hibernate-script as an alternative.
Also, you're invited to improve https://wiki.gentoo.org/wiki/Suspend_and_hibernate with any findings should you choose to migrate. |
|
Back to top |
|
|
patrickdepinguin n00b
Joined: 18 Jan 2007 Posts: 14
|
Posted: Sat Jan 30, 2021 3:54 pm Post subject: |
|
|
That wiki page says:
"The following software can be used for in-kernel default suspend/hibernate implementation, namely, swsusp.
root #emerge --ask sys-power/suspend"
My understanding is that 'swsusp' is indeed the kernel implementation, but this does _not_ need sys-power/suspend, which is specifically created for userspace-driver suspend/hibernate, called _uswsusp_.
So the above wiki statement seems incorrect to me, although I'm not fully sure.
Generally, if desiring to use the kernel method of resuming, by interacting with sysfs, it is not clear to me what any package like pm-utils or hibernate-script offers over directly writing to sysfs. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Sat Jan 30, 2021 5:11 pm Post subject: |
|
|
asturm wrote: | I've extended pm-utils last-rites time for a bit |
Thanks!
asturm wrote: | but please check out sys-power/suspend or sys-power/hibernate-script as an alternative. |
sys-power/suspend: I had looked at it - it's written in C, and, as I am a beginner in C, it's difficult for me to understand how it is/works.
sys-power/hibernate-script: Thanks, looked at it for the first time now - at their git; it's written in shell, their code is more clear and modularized than pm-utils's one - I like that coding style...
Thanks a lot for the invitation! I've just recently made my first contribution to the Gentoo Wiki. I will look at what else I could add.
But regarding the migration to other tools...I am not going to do that soon because:
1. I've been minimalist and conservative in choosing software for a very long time - I read the David Platt's book "Why Software Sucks...and What You Can Do About It" soon after moving from Windows to Linux (2007/2008). So, I appreciate much every little piece of software that has been working for me. Like pm-utils.
2. I am not an expert in shell but I've spent some time for writing my own hibernation shell script with which I launch pm-utils. This field is interesting for me and I would like to learn it more.
3. The forked pm-utils version works fine for me now.
So, 1+2+3... I appreciate this software, I would like to learn more this field, I can continue to use it even if it is removed from the Gentoo tree. What is the reason for me to migrate to other tools now? Nothing.
Instead, I am interested in finding the time to read carefully the pm-utils code and understand it. Now, after that you pointed me to sys-power/hibernate-script, to read carefully its code too
May be I won't be able to understand enough and will give up. But, maybe, I will be able to add something new to pm-utils or to improve at least my own script. Or, maybe, after comparing the two codes I will consider sys-power/hibernate-script a better alternative in all senses and will move to it - it's possible too. In short, I need to deal with this.
As I have another active projects, it can take a long time.
While I will be dealing, I am open to every help _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
patrickdepinguin n00b
Joined: 18 Jan 2007 Posts: 14
|
Posted: Sat Jan 30, 2021 7:44 pm Post subject: |
|
|
I installed hibernate-script now, and tested both 'hibernate-ram' (suspend to memory) and 'hibernate' (suspend to disk).
It worked right out of the box without any changes, coming from using pm-suspend and pm-hibernate.
The script will try using the sys-power/suspend tools when present, and the tuxonice method in case you're running that kernel. As I have neither, it uses the same method as pm-hibernate was using, i.e. kernel swsusp via sysfs.
If I don't bump into new problems in the coming days, I'll remove pm-utils and consider hibernate-script as the new method. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Sat Jan 30, 2021 10:28 pm Post subject: |
|
|
...Found that sys-power/hibernate-script is written by Nigel Cunningham, the author of TuxOnIce. Very promising! But only one file has been changed in its code for past 10 years... _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 22685
|
Posted: Sat Jan 30, 2021 10:46 pm Post subject: |
|
|
It is just a wrapper to invoke all the real actions in the right order. Once that order is found, it may not need further maintenance, since all the real work is done by the things it runs for you. The important question is not how much its code has changed, but how many open issues exist for it. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Sat Jan 30, 2021 11:12 pm Post subject: |
|
|
Hu wrote: | It is just a wrapper to invoke all the real actions in the right order. Once that order is found, it may not need further maintenance, since all the real work is done by the things it runs for you. |
OK...
Hu wrote: | The important question is not how much its code has changed, but how many open issues exist for it. |
On GitLab - zero issues (not open ones, but at all). And no "bugs-to" tag in the package metadata in Gentoo. But there is a merge request "Gentoo fixups", open for 8 years...
By the way, there are other authors indicated in README. I guess, Cunningham just forked and is maintaining it, or didn't bother to indicate himself as author?
EDIT:
There is "maintainer-needed" tag in its metadata; if it is going to be last-rited too... _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2858
|
Posted: Sun Jan 31, 2021 12:00 am Post subject: |
|
|
halcon wrote: | There is "maintainer-needed" tag in its metadata; if it is going to be last-rited too... | maintainer-needed isn't necessarily a bad thing, that means any devs can work on it and so they often fix those on the sides if there's interest. Can always send a PR yourself to get issues fixed too and then, if there's no problems, it just stays. It's when bugs start to accumulate (and/or causing trouble for other packages) and nobody cares enough to do something about it (or reasonably can't, replacing upstream is a lot to ask for) that it gets last-rited.
Edit: hibernate-script's ebuild has no real dependencies and is EAPI 7, so I'd say it's safe for long time unless the script breaks with new things and nobody (including users) cares to propose a valid fix in a reasonable time frame. |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Sun Jan 31, 2021 1:27 am Post subject: |
|
|
Ionen,
Thanks for clarification!
Ionen wrote: | replacing upstream is a lot to ask for |
...and to do _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
Goverp Advocate
Joined: 07 Mar 2007 Posts: 2179
|
Posted: Wed Feb 10, 2021 12:55 pm Post subject: |
|
|
FWIW: I replaced pm-utils with laptop-mode-tools. Works OK; haven't noticed any change in power consumption. It may be of interest to know it installs a simple Qt5 GUI and creates a desktop menu item. The GUI lets you switch off things that don't apply or seem desirable - there's hover-help to give a one-liner description of the various knobs to turn. AFAIR, it can exploit some other packages, notably hdparm and or sdparm; I've not tried it with them. _________________ Greybeard |
|
Back to top |
|
|
Princess Nell l33t
Joined: 15 Apr 2005 Posts: 926
|
Posted: Wed Feb 10, 2021 7:28 pm Post subject: |
|
|
Not having looked at the code - what is the specific autotools/automake problem you need to solve? |
|
Back to top |
|
|
halcon l33t
Joined: 15 Dec 2019 Posts: 649
|
Posted: Wed Feb 10, 2021 10:16 pm Post subject: |
|
|
Princess Nell wrote: | Not having looked at the code - what is the specific autotools/automake problem you need to solve? |
Is this question addressed to me? I guess...
Actually, no specific problem. The forked version is being installed fine for Gentoo and Debian.
If talking about my plans. I was going to compare the code of pm-utils and the code of hibernate-script. I would already have done that, but I don't like that there are multiple makefiles in pm-utils, and also that some files with code have extension .in, like this, and then lines like these. I would like to get rid of autotools and to write a script like that which I like (and understand) much better, making two codes more comparable... _________________ A wife asks her husband, a programmer:
- Could you please go shopping for me and buy one carton of milk, and if they have eggs, get 6?
He comes back with 6 cartons of milk.
- Why did you buy 6 cartons of milk?
- They had eggs. |
|
Back to top |
|
|
asturm Developer
Joined: 05 Apr 2007 Posts: 9280
|
Posted: Wed Feb 10, 2021 10:24 pm Post subject: |
|
|
Handmade build scripts are consistently the worst case scenario for packaging. Better keep autotools then. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|