Trisquel 9 LibreBoot: how to autostart powertop properly?

7 replies [Last post]
doxanthropos
Offline
Joined: 04/28/2013

Hi Folks,

my "new" x60 just received it's upgrade from proprietary BIOS to free LibreBoot.
Just as the documentation says, it started to produce a high pitched whining sound, that can be removed by starting "powertop --auto-tune".
There is this nice script for Trisquel 7 to set up that command to autostart.

Does someone have an updated version of this script that works with Trisquel 9?

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

Since Trisquel 7 was already using systemd, I tend to believe the same script should work on Trisquel 9. Doesn't it? If not, the instructions on https://libreboot.org/docs/misc/#high-pitched-whining-noise-on-idle-in-parabola should work, substituting the first two commands with:
$ sudo -s
# apt install powertop

doxanthropos
Offline
Joined: 04/28/2013

Thanks for the answer and the link to that docs page.
The script I was trying to use was the one supplied with the LibreBoot binaries, "powertop.trisquel7". That one still assumes classic init for some reason.
After figuring out that this might be the problem (before seeing your comment) I wrote a systemd unit like the Arch people suggest here:
https://wiki.archlinux.org/index.php/powertop#Usage
With the difference that powertop in Trisquel seems to be in /usr/sbin and not in /usr/bin.
It worked when I started it, but "systemctl enable powertop" seemed to not do as it should:
After reboot the small noise was back there and could be silenced by a call to "systemctl powertop start".
After reading your comment, I had a look at that Unit description and included the two lines:
RemainAfterExit=no
and
Environment="TERM=xterm"
from there in my unit.
Disabled the powertop unit, did a daemon-reload and enabled it.
To no avail. Still small noise after boot, can be silenced but manually starting the systemd unit.
I feel like this was a step forward, but not the last one needed.
If someone reading this knows from the top of their head what is going on here, please enlighten me.
Will dig deeper into this later, when I come back from work.

Geshmy
Offline
Joined: 04/23/2015

From that arch link

'/etc/systemd/system/powertop.service'
so would it be
sudo systemctl enable powertop.service
rather than
sudo systemctl enable powertop

?

doxanthropos
Offline
Joined: 04/28/2013

One would think that, but the systemctl commands only take the name of the service, not the full name of the service config (I don't think that this is very unixy or linuxy, but more like Windows, but that is also my general view on systemd).

The config that I have now cannot be totally wrong, when I start the service (using "sudo systemctl start powertop") it actually starts.
"sudo systemctl status powertop" shows that it at some point fails, because of missing measurements.

Supposedly to use it with auto-tune, it needs to have taken measurements, while on battery power only. Now I am very glad that I have a battery for this old device and can test if that is the problem.

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010

One would think that, but the systemctl commands only take the name of the service, not the full name of the service config

No. 'man systemctl' specifies the parameter syntax:
Unit commands listed above take either a single unit name (designated as NAME), or multiple unit specifications (designated as PATTERN...). In the first case, the unit name with or without a suffix must be given. If the suffix is not specified (unit name is "abbreviated"), systemctl will append a suitable suffix, ".service" by default, and a type-specific suffix in case of commands which operate only on specific unit types. For example,
# systemctl start sshd
and
# systemctl start sshd.service
are equivalent, as are
# systemctl isolate default
and
# systemctl isolate default.target

Look at the output of:
$ journalctl -u powertop.service

doxanthropos
Offline
Joined: 04/28/2013

Did look into that yesterday and found some "Error: Cannot load from file" which are explained also in the Arch wiki. So now I did generate enough measurements, by running powertop while on battery. I feel like this is a gap in the LibreBoot documentation (unless it is explained in a place I did not find).
After this it behaves the sames as before:
according to systemctl status powertop it is loaded, but inactive(dead) after boot and the noise is there.
Starting the service manually (systemctl start) silences the noise, but the service is still inactive(dead).

The current journal entries are now shorter:

-- Reboot --
Feb 04 07:04:33 freedomX systemd[1]: Started Powertop tunings.
Feb 04 07:04:33 freedomX powertop[1019]: modprobe cpufreq_stats failedLoaded 336 prior measurements
Feb 04 07:04:33 freedomX powertop[1019]: RAPL device for cpu 0
Feb 04 07:04:33 freedomX powertop[1019]: RAPL device for cpu 0
Feb 04 07:04:33 freedomX powertop[1019]: Devfreq not enabled
Feb 04 07:04:33 freedomX powertop[1019]: glob returned GLOB_ABORTED
Feb 04 07:04:36 freedomX powertop[1019]: Leaving PowerTOP

Still does not seem right. Hm ..

Magic Banana

I am a member!

I am a translator!

Offline
Joined: 07/24/2010