Author Topic: systemd rc.local failure to execute script I'm using for powersaving  (Read 696 times)

0 Members and 1 Guest are viewing this topic.

Offline Odysseus

  • Neuling
  • *
  • Posts: 18
  • I'm new. Be nice!
  • Branch: stable
  • Desktop: KDE
  • GPU Card: nVidia GeForce Go 7950 GTX
  • GPU driver: nVidia non-free
  • Kernel: linux44-x64
  • Skill: Intermediate
I hope I posted this to the correct forum, as I'm not exactly sure.

OK, I've encountered an issue I'm having difficulty resolving. I'm much more familiar with OpenRC than Systemd, and can't figure out where I'm going wrong.

My laptop is too old to use the Thermald daemon, it kept failing, I did research and discovered it was because my CPU doesn't have the features required for its use, so I removed it.

I can, however, take advantage of some of the other power save features that do work including those found by running Powertop. I followed the wiki page here https://wiki.manjaro.org/index.php?title=PowerTOP_to_Optimise_Laptop_Power_Consumption and on Arch https://wiki.archlinux.org/index.php/fan_speed_control to the letter.

I've been able to get the fancontrol daemon working with no issues. My laptop is running cool and I've adjusted the settings to my liking.

The problem lies with /etc/rc.local. I followed the instructions, but can't get the script to work properly for me, and I've looked all over the net for solutions. On the Manjaro powertop wiki page the author talks about using the powertop results to write a a bash shell script that gets executed at startup. I placed the recommended command into /etc/rc.local. I edited the file as directed so it now looks like this, and made sure it is executable:

Code: [Select]
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
/usr/local/bin/startup.sh

exit 0


Then I created a script named startup.sh placed it in /usr/local/bin and made it executable as instructed, that script looks like this:

Code: [Select]
#!/bin/bash
echo '0' > '/proc/sys/kernel/nmi_watchdog';
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';
echo 'auto' > '/sys/bus/pci/devices/0000:09:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.3/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:0c:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:01.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.3/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.1/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:03:01.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:03:01.1/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:03:01.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:01:00.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1e.0/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.7/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.1/power/control';
echo 'auto' > '/sys/bus/pci/devices/0000:03:01.3/power/control';
echo 'auto' > '/sys/bus/usb/devices/usb5/power/control';
echo 'auto' > '/sys/bus/usb/devices/usb4/power/control';
echo 'auto' > '/sys/bus/usb/devices/usb3/power/control';
echo 'auto' > '/sys/bus/usb/devices/usb2/power/control';
echo 'auto' > '/sys/bus/usb/devices/usb1/power/control';

However, when I tried to enable the rc-local.service as instructed on the wiki page, I was dismayed to discover there was no such daemon. Looking at systemd daemon control panel applet I could see that there should be one, but it was listed as "not-found" under load state. So I researched around the net to find a suitable daemon and where it should be located.

Over at Arch, I found several posts in the forum saying it belonged at /usr/lib/systemd/system/ and there I placed this rc-local.service daemon:

Code: [Select]
[Unit]
 Description=/etc/rc.local Compatibility
 ConditionPathExists=/etc/rc.local

[Service]
 Type=forking
 ExecStart=/etc/rc.local
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes

[Install]
 WantedBy=multi-user.target

I enabled it, then started it with no error messages. All seems to be fine with it executing on boot, however, when I check in powertop after rebooting, it's as if the script was not run at all. I can manually evoke the startup.sh script and all is good, so I know that that portion of this procedure is working. And rc-local.service is running fine, with no errors I can see, when I check it.

So the question is, why isn't all of this working when I boot-up? Where have I gone wrong, and what can I do to make this work? Any help would be greatly appreciated. TIA
« Last Edit: 10. May 2016, 19:11:32 by Odysseus »