Fwd: rc.local and systemd

Rainer Dorsch ml at bokomoko.de
Sat May 23 19:56:52 BST 2015


Hi Michael,

thanks for your prompt reply.

Am Montag, 18. Mai 2015, 22:21:42 schrieb Michael Biebl:
> Am 18.05.2015 um 22:01 schrieb Rainer Dorsch:
> > root at nanette:~# systemctl status rc-local.service
> > ● rc-local.service - /etc/rc.local Compatibility
> > 
> >    Loaded: loaded (/lib/systemd/system/rc-local.service; static)
> >    Active: failed (Result: exit-code) since Mon 2015-05-18 14:29:04 CEST;
> >    7h
> > 
> > ago
> > 
> > May 18 14:29:02 nanette rc.local[741]: Loaded 750 prior measurements
> > May 18 14:29:04 nanette rc.local[741]: Error opening terminal: unknown.
> > May 18 14:29:04 nanette rc.local[741]: RAPL device for cpu 0
> > May 18 14:29:04 nanette rc.local[741]: RAPL device for cpu 0
> > May 18 14:29:04 nanette rc.local[741]: RAPL device for cpu 0
> > May 18 14:29:04 nanette systemd[1]: rc-local.service: control process
> > exited, code=exited status=1
> > May 18 14:29:04 nanette systemd[1]: Failed to start /etc/rc.local
> > Compatibility.
> > May 18 14:29:04 nanette systemd[1]: Unit rc-local.service entered failed
> > state.
> > root at nanette:~#
> 
> So, as you can see, /etc/rc.local *is* run.
> As you can also see, powertop exits with a non-zero return code. Since
> /etc/rc.local uses "set -e", your script exits at this point and the
> service is marked as failed.
> 
> Everything working as expected from the systemd side.

Hmm....seems that systemd does not define the TERM variable. Defining that at 
least makes powertop performing the expected settings. Nevertheless I am still 
wondering why it has the failed status, rc.local has an hard "exit 0" return 
code (?) : 

rd at nanette:/etc$ diff -u rc.local~ rc.local
--- rc.local~   2015-01-31 15:34:33.044782111 +0100
+++ rc.local    2015-05-23 14:27:42.043875921 +0200
@@ -11,6 +11,6 @@
 #
 # By default this script does nothing.
 
-powertop --auto-tune
+TERM=vt100 powertop --auto-tune
 
 exit 0
rd at nanette:/etc$ systemctl status rc-local.service 
● rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static)
   Active: failed (Result: exit-code) since Sat 2015-05-23 12:26:46 CEST; 8h 
ago
  Process: 795 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)
rd at nanette:/etc$ cat rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

TERM=vt100 powertop --auto-tune

exit 0
rd at nanette:/etc$ 

Thanks,
Rainer




More information about the Pkg-systemd-maintainers mailing list