You are not logged in.

#1 2014-11-22 14:23:37

toni
Member
Registered: 2011-10-15
Posts: 437

Systemd Unit - Executable is not an absolute path

I have installed powertop following this:

How to improve battery life using powertop

I have created file "/usr/local/bin/powertop_tuning.sh" and I have set some line within it.

Then I have done this file as executable:

sudo chmod +x /usr/local/bin/powertop_tuning.sh

Finally I create a service using systemd:

sudo $EDITOR /lib/systemd/system/powertop_tuning.service

and I set its content to:

[Unit]
Description="PowerTop Tuning config"
ConditionPathExists=/usr/local/bin/powertop_tuning.sh

[Service]
Type=oneshot
RemainAfterExit=yes
KillMode=none
ExecStart=/usr/local/bin/powertop_tuning.sh
ExecStop=exit

[Install]
WantedBy=multi-user.target

and set it to start automatically:

udo systemctl enable powertop_tuning.service

When I reboot my system, on boot time below message is shown:

systemd[1]: [/usr/lib/systemd/system/powertop_tuning.service:10] Executable path is not absolute, ignoring: exit

Service status is:

[toni@toni ~]$ systemctl status powertop_tuning.service 
● powertop_tuning.service - "PowerTop Tuning config"
   Loaded: loaded (/usr/lib/systemd/system/powertop_tuning.service; enabled)
   Active: active (exited) since sáb 2014-11-22 15:35:43 CET; 1h 4min ago
  Process: 492 ExecStart=/usr/local/bin/powertop_tuning.sh (code=exited, status=0/SUCCESS)
 Main PID: 492 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/powertop_tuning.service

nov 22 15:35:43 toni systemd[1]: Started "PowerTop Tuning config".

Last edited by toni (2014-11-22 15:42:02)

Offline

#2 2014-11-22 15:01:45

jjacky
Member
Registered: 2011-11-09
Posts: 347
Website

Re: Systemd Unit - Executable is not an absolute path

First of all, you shouldn't put files in /lib; put your own service files under /etc/systemd/system that's where they belongs.

Then, I'm not sure what the line "ExecStop=exit" is supposed to do, but it's what's causing the error and since your service simply consist of running a script once, there's no need for an ExecStop here, so you can just remove it.

Lastly, for such things you don't have to write your own service, you could also simply add a .conf file in /etc/tmpfiles.d with content such as:

# NMI watchdog should be turned off
f /proc/sys/kernel/nmi_watchdog - - - - 0

See `man tmpfiles.d` for more about this.

Offline

#3 2014-11-22 15:18:17

teateawhy
Member
From: GER
Registered: 2012-03-05
Posts: 1,138
Website

Re: Systemd Unit - Executable is not an absolute path

Offline

#4 2014-11-22 18:46:10

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Systemd Unit - Executable is not an absolute path

Not an Installation issue, moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2014-11-22 21:45:51

toni
Member
Registered: 2011-10-15
Posts: 437

Re: Systemd Unit - Executable is not an absolute path

jjacky wrote:

First of all, you shouldn't put files in /lib; put your own service files under /etc/systemd/system that's where they belongs.

Then, I'm not sure what the line "ExecStop=exit" is supposed to do, but it's what's causing the error and since your service simply consist of running a script once, there's no need for an ExecStop here, so you can just remove it.

Lastly, for such things you don't have to write your own service, you could also simply add a .conf file in /etc/tmpfiles.d with content such as:

# NMI watchdog should be turned off
f /proc/sys/kernel/nmi_watchdog - - - - 0

See `man tmpfiles.d` for more about this.

so what is the difference between using a service or using /etc/tmpfiles.d?

"/usr/local/bin/powertop_tuning.sh" file is:

#!/bin/bash

# Tiempo límite de reescritura VM
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';

# Vigilancia NMI se debe apagar 	
echo '0' > '/proc/sys/kernel/nmi_watchdog';

# Habilitar administración de energía del codec de Audio 	
echo '1' > '/sys/module/snd_hda_intel/parameters/power_save';

# Enable SATA link power management for host3
echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy';

# Enable SATA link power management for host4
echo 'min_power' > '/sys/class/scsi_host/host4/link_power_management_policy';

# Enable SATA link power management for host1 	
echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy';

# Enable SATA link power management for host2 	
echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy';

# Enable SATA link power management for host0 	
echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';

# Autosuspender para dispositivo USB AS2105 [ASMedia]	
# echo 'auto' > '/sys/bus/usb/devices/4-3/power/control';

# Autosuspender para dispositivo USB desconocido 3-6 (8087:07dc) 	
# echo 'auto' > '/sys/bus/usb/devices/3-6/power/control';

# Autosuspender para dispositivo USB Microsoft® Nano Transceiver v2.0 [Microsoft] 	
# echo 'auto' > '/sys/bus/usb/devices/3-4/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #2 	
echo 'auto' > '/sys/bus/pci/devices/0000:00:1a.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor DRAM Controller
echo 'auto' > '/sys/bus/pci/devices/0000:00:00.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor PCI Express x16 Controller
echo 'auto' > '/sys/bus/pci/devices/0000:00:01.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor HD Audio Controller
echo 'auto' > '/sys/bus/pci/devices/0000:00:03.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family USB xHCI
echo 'auto' > '/sys/bus/pci/devices/0000:00:14.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family MEI Controller #1
echo 'auto' > '/sys/bus/pci/devices/0000:00:16.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset High Definition Audio Controller
echo 'auto' > '/sys/bus/pci/devices/0000:00:1b.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #1
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #3
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.2/power/control';

# Tiempo de ejecución PM para dispositivo PCI Realtek Semiconductor Co., Ltd. RTS5249 PCI Express Card Reader
echo 'auto' > '/sys/bus/pci/devices/0000:05:00.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #6
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.5/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family USB EHCI #1
echo 'auto' > '/sys/bus/pci/devices/0000:00:1d.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation HM86 Express LPC Controller
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family 6-port SATA Controller 1 [AHCI mode]
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.2/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
echo 'auto' > '/sys/bus/pci/devices/0000:00:1f.3/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation Wireless 3160
echo 'auto' > '/sys/bus/pci/devices/0000:03:00.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 4th Gen Core Processor Integrated Graphics Controller
echo 'auto' > '/sys/bus/pci/devices/0000:00:02.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
echo 'auto' > '/sys/bus/pci/devices/0000:04:00.0/power/control';

# Tiempo de ejecución PM para dispositivo PCI Intel Corporation 8 Series/C220 Series Chipset Family PCI Express Root Port #4
echo 'auto' > '/sys/bus/pci/devices/0000:00:1c.3/power/control';

# Estado Wake-on-lan para dispositivo enp4s0
ethtool -s enp4s0 wol d;

Offline

#6 2014-11-22 22:17:48

nbvcxz
Member
From: Poland
Registered: 2007-12-29
Posts: 202

Re: Systemd Unit - Executable is not an absolute path

@toni
Little offtopic: isn't TLP exactly you need?


Lenovo G50 | LXQT-git | compton | conky

Offline

#7 2014-11-23 09:49:11

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: Systemd Unit - Executable is not an absolute path

A good while back now, I went through and figured out how to properly set each of the powertop recommendations for my machine.  This included using /etc/modprobe.d, /etc/sysctl.d, and /etc/udev/rules.d.  It was somewhat tedious, but I learned a bit about each of those things.

That said, you could simply make a simple service that runs 'ExecStart=/usr/bin/powertop --auto-tune' and be done with it.  But you would still have to remove that strange ExecStop line from the service file.  I also don't think that the RemainAfterExit is necessary either... nor is the KillMode.

Offline

Board footer

Powered by FluxBB