This bug report is based on https://forums.puri.sm/t/purism-power-optimisations-service-fails-after-recent-update/3331
I'm seeing the following in /var/log/boot.log:
[FAILED] Failed to start Power/battery optimisations for Purism devices.
See 'systemctl status purism-power-optimisations.service' for details.
Doing that:
root@melanobombus:/home/alex# systemctl status purism-power-optimisations.service
● purism-power-optimisations.service - Power/battery optimisations for Purism devices
Loaded: loaded (/lib/systemd/system/purism-power-optimisations.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2018-08-02 16:27:34 CEST; 32s ago
Docs: https://source.puri.sm/pureos/packages/purism-power-optimisations
Process: 713 ExecStart=/usr/lib/pureos-power-optimisations/apply (code=exited, status=203/EXEC)
Main PID: 713 (code=exited, status=203/EXEC)
Aug 02 16:27:34 melanobombus systemd[1]: Starting Power/battery optimisations for Purism devices...
Aug 02 16:27:34 melanobombus systemd[713]: purism-power-optimisations.service: Failed to execute command: No such file or directory
Aug 02 16:27:34 melanobombus systemd[713]: purism-power-optimisations.service: Failed at step EXEC spawning /usr/lib/pureos-power-optimisations/apply: No such file or directory
Aug 02 16:27:34 melanobombus systemd[1]: purism-power-optimisations.service: Main process exited, code=exited, status=203/EXEC
Aug 02 16:27:34 melanobombus systemd[1]: purism-power-optimisations.service: Failed with result 'exit-code'.
Aug 02 16:27:34 melanobombus systemd[1]: Failed to start Power/battery optimisations for Purism devices.
I'll note that I have /usr/lib/purism-power-optimisations/purism-power-optimisations but nothing like the path mentioned in the message above:
$ sudo ls /usr/lib/pureos*
ls: cannot access '/usr/lib/pureos*': No such file or directory
This is a Librem 13v2, I think. This doesn't seem to affect my fan. I don't seem to notice anything negative at all, actually. It's just that error message while booting.
I decided to investigate. First, find the file name:
# systemctl list-unit-files purism-power-optimisations.service
...
# locate purism-power-optimisations
/etc/systemd/system/multi-user.target.wants/purism-power-optimisations.service
...
Checking it out:
# grep -i exec /etc/systemd/system/multi-user.target.wants/purism-power-optimisations.service
ExecStart=/usr/lib/pureos-power-optimisations/apply
OK, so that's the file it wants to start, which doesn't exist on my system!
# ls /usr/lib/pureos*
ls: cannot access '/usr/lib/pureos*': No such file or directory
I wonder whether the simple thing we need to do is change that line and use /usr/lib/purism-power-optimisations/purism-power-optimisations instead. If I run it:
# /usr/lib/purism-power-optimisations/purism-power-optimisations
vm.dirty_writeback_centisecs = 6000
modprobe cpufreq_stats failedLoaded 217 prior measurements
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask f
RAPL device for cpu 0
RAPL Using PowerCap Sysfs : Domain Mask f
Devfreq not enabled
To show power estimates do 8 measurement(s) connected to battery only
Leaving PowerTOP
I have no idea if this is what we want to do. On the last line, it calls powertop --auto-tune. That doesn't sound too bad! :)
What do you think?
OK, so now I'm wondering where this error originates. I have a file on the disk and a different file that is wanted. Let's look at the packages involved.
# dpkg -S /usr/lib/purism-power-optimisations/purism-power-optimisations
purism-power-optimisations: /usr/lib/purism-power-optimisations/purism-power-optimisations
root@melanobombus:/home/alex# apt show purism-power-optimisations
Package: purism-power-optimisations
Version: 0.5.0
Priority: optional
Section: misc
Source: purism-device-config
Maintainer: PureOS Developers <pureos-project@lists.puri.sm>
Installed-Size: 425 kB
Depends: dmidecode, iw, powertop
Homepage: https://source.puri.sm/pureos/packages/purism-device-config
Download-Size: 11.8 kB
APT-Manual-Installed: no
APT-Sources: https://repo.puri.sm/pureos green/main amd64 Packages
Description: Power/battery optimisations for Purism devices
Installing this package will apply a number of power/battery optimisationson
system start.
.
Purism laptops are specifically detected; installing this package on a
non-Purism device will succeed but will do nothing at boot time.
OK, perhaps I can just reinstall this package and it'll fix itself?
root@melanobombus:/home/alex# apt install --reinstall purism-power-optimisations
...
Setting up purism-power-optimisations (0.5.0) ...
Job for purism-power-optimisations.service failed because the control process exited with error code.
See "systemctl status purism-power-optimisations.service" and "journalctl -xe" for details.
Same problem!
So how about the systemd service?
# for f in $(locate purism-power-optimisations.service); do dpkg -S $f; done
dpkg-query: no path found matching pattern /etc/systemd/system/multi-user.target.wants/purism-power-optimisations.service
purism-power-optimisations: /lib/systemd/system/purism-power-optimisations.service
dpkg-query: no path found matching pattern /var/lib/systemd/deb-systemd-helper-enabled/purism-power-optimisations.service.dsh-also
dpkg-query: no path found matching pattern /var/lib/systemd/deb-systemd-helper-enabled/multi-user.target.wants/purism-power-optimisations.service
OK, so /lib/systemd/system/purism-power-optimisations.service is the file that's provided by the same package. This should match. So, does it have the right ExecStart in there? Nope:
# grep -i exec /lib/systemd/system/purism-power-optimisations.service
ExecStart=/usr/lib/pureos-power-optimisations/apply
Still the wrong target. So I think this is a bug.