Re: Fwd: rc.local and systemd
Rainer Dorsch wrote: > Nevertheless I am still wondering why it has the failed status, > rc.local has an hard "exit 0" return code (?) : Look at the first line of /etc/rc.local script. > rd@nanette:/etc$ cat rc.local > #!/bin/sh -e The set -e ^^ here is what sets the -e flag for the shell. Bob signature.asc Description: Digital signature
Re: Fwd: rc.local and systemd
Am 23.05.2015 um 20:56 schrieb Rainer Dorsch: > Am Montag, 18. Mai 2015, 22:21:42 schrieb Michael Biebl: >> 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. .. > Hmmseems 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 (?) : The "exit 0" is useless since, as already explained, the script use "set -e". If a command returns a non-zero exit status, the script will stop at this point and return that exit status. Which means you'll never reach exit 0 in such a case. From "help set" -e Exit immediately if a command exits with a non-zero status. -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth? signature.asc Description: OpenPGP digital signature
Re: Fwd: rc.local and systemd
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@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@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. Hmmseems 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@nanette:/etc$ diff -u rc.local~ rc.local --- rc.local~ 2015-01-31 15:34:33.044782111 +0100 +++ rc.local2015-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@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@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@nanette:/etc$ Thanks, Rainer -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/2566366.HTGLlFCDbi@nanette
Re: Fwd: rc.local and systemd
Am 18.05.2015 um 22:01 schrieb Rainer Dorsch: > root@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@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. -- Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth? signature.asc Description: OpenPGP digital signature
Re: Fwd: rc.local and systemd
Hi Michael, thanks for your quick reply. Am Sonntag, 17. Mai 2015, 11:33:23 schrieben Sie: > > Hello, > > > > I have a jessie system here on which /etc/rc.local is not executed. > > /etc/rc.local is executable > > > > root@nanette:~# ls -l /etc/rc.local > > -rwxr-xr-x 1 root root 328 Jan 31 15:34 /etc/rc.local > > root@nanette:~# > > > > Before the jessie upgrade, it was executed properly during startup > > > > root@nanette:~# ls -l /etc/rc*.d/*rc* > > lrwxrwxrwx 1 root root 18 Dec 5 2012 /etc/rc2.d/S24rc.local -> > > ../init.d/rc.local > > lrwxrwxrwx 1 root root 18 Dec 5 2012 /etc/rc3.d/S24rc.local -> > > ../init.d/rc.local > > lrwxrwxrwx 1 root root 18 Dec 5 2012 /etc/rc4.d/S24rc.local -> > > ../init.d/rc.local > > lrwxrwxrwx 1 root root 18 Dec 5 2012 /etc/rc5.d/S24rc.local -> > > ../init.d/rc.local > > root@nanette:~# > > > > Is that expected? > > > > Is > > > > cd /lib/systemd/system/multi-user.target.wants > > ln -s ../rc-local.service rc-local.service > > > > the proper way to enable it using systemd? > > What's the output of > sudo systemctl status rc-local.service root@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@nanette:~# In /etc/rc.local I have root@nanette:~# cat /etc/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. powertop --auto-tune exit 0 root@nanette:~# Rainer -- To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: https://lists.debian.org/2563499.M34GAdGaSA@nanette