dannycv
Posts: 5
Joined: Mon Dec 25, 2017 1:15 pm

Fail to start /etc/rc.local

Mon Dec 25, 2017 1:27 pm

Hi, I just started using raspberry pi as a torrentbox, following this guide: https://techwiztime.com/article/best-ra ... orrentbox/

I was trying to make deluge run automatically on startup, so I followed the guide , using this code:

Code: Select all

sudo nano /etc/rc.local
, then adding:

Code: Select all

# DISPLAY IP ON REBOOT
_IP=$(hostname -I) || true
if [ “$_IP” ]; then
printf “Connect to Deluge via http://%s:8112 (Without the space)\n” “$_IP”

fi
# DELUGE START ON BOOT

sudo -u pi /usr/bin/python /usr/bin/deluge-web &

exit 0

I received a failed to start error message

Code: Select all

 rc-local.service - /etc/rc.local Compatibility
   Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
  Drop-In: /lib/systemd/system/rc-local.service.d
           └─debian.conf
        /etc/systemd/system/rc-local.service.d
           └─ttyoutput.conf
   Active: failed (Result: exit-code) since Mon 2017-12-25 18:07:38 +05; 4min 39s ago
  Process: 439 ExecStart=/etc/rc.local start (code=exited, status=203/EXEC)

Dec 25 18:07:38 deluge systemd[1]: Starting /etc/rc.local Compatibility...
Dec 25 18:07:38 deluge systemd[1]: rc-local.service: Control process exited, code=exited status=203
Dec 25 18:07:38 deluge systemd[1]: Failed to start /etc/rc.local Compatibility.
Dec 25 18:07:38 deluge systemd[1]: rc-local.service: Unit entered failed state.
Dec 25 18:07:38 deluge systemd[1]: rc-local.service: Failed with result 'exit-code'.
Warning: rc-local.service changed on disk. Run 'systemctl daemon-reload' to reload units.

So now I have to start manually deluge everytime I turn on the raspberry pi.

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 6:21 am

The answer to just about every "I put it in rc.local; it didn't work" question is to put this line in rc.local, just before the line that says "# Print the IP address":

exec > /tmp/rc-local.out 2>&1;set -x

Then reboot and look at the file /tmp/rc-local.out.
It will then be obvious what is wrong.
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

User avatar
rpdom
Posts: 14997
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 9:20 am

n67 wrote:
Tue Dec 26, 2017 6:21 am
The answer to just about every "I put it in rc.local; it didn't work" question is to put this line in rc.local, just before the line that says "# Print the IP address":

exec > /tmp/rc-local.out 2>&1;set -x

Then reboot and look at the file /tmp/rc-local.out.
It will then be obvious what is wrong.
I'd try

Code: Select all

exec >/boot/local.txt 2>&1;set -x
as that would mean if the boot completely failed you'd be able to put the card in any computer and read the log file (some windows text editors may bork over the line endings though).

dannycv
Posts: 5
Joined: Mon Dec 25, 2017 1:15 pm

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 11:57 am

n67 wrote:
Tue Dec 26, 2017 6:21 am
The answer to just about every "I put it in rc.local; it didn't work" question is to put this line in rc.local, just before the line that says "# Print the IP address":

exec > /tmp/rc-local.out 2>&1;set -x


I inserted the line here:

Code: Select all


# DISPLAY IP ON REBOOT
exec > /tmp/rc-local.out 2>&1;set -x


_IP=$(hostname -I) || true
if [ “$_IP” ]; then
printf “Connect to Deluge via http://%s:8112 (Without the space)\n” “$_IP”

fi
# DELUGE START ON BOOT

sudo -u pi /usr/bin/python /usr/bin/deluge-web &

exit 0






^G Get Help  ^O Write Out ^W Where Is  ^K Cut Text  ^J Justify   ^C Cur Pos
^X Exit      ^R Read File ^\ Replace   ^U Uncut Text^T To Spell  ^_ Go To Line
Then reboot and look at the file /tmp/rc-local.out.
It will then be obvious what is wrong.

How do I like at the file /tmp/rc-local.out.? Sorry Im completely new to raspberry pi or anything about coding.

n67
Posts: 938
Joined: Mon Oct 30, 2017 4:55 pm

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 12:21 pm

How do I like[sic] at the file /tmp/rc-local.out.? Sorry Im completely new to raspberry pi or anything about coding.
Presumably, whatever editor you used to change /etc/rc.local would be a good choice to use to examine /tmp/rc-local.out. Whatever you're comfortable with...
"L'enfer, c'est les autres"

G fytc hsqr rum umpbq rm qyw rm rfc kmbq md rfgq dmpsk:

Epmu Sn!

J lnacjrw njbruh-carppnanm vxm rb mnuncrwp vh yxbcb!

beta-tester
Posts: 1236
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 1:06 pm

stupid question...
will you get any error, when you type in that command line to the console/terminal

Code: Select all

sudo -u pi /usr/bin/python /usr/bin/deluge-web
while you are logge on?
{ I only give negative feedback }
RPi Model B (rev1, 256MB) & B (rev2, 512MB) & B+, RPi2B, RPi3B, RPi3B+, RPiZeroW, ...

User avatar
jojopi
Posts: 3079
Joined: Tue Oct 11, 2011 8:38 pm

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 1:14 pm

dannycv wrote:
Mon Dec 25, 2017 1:27 pm
if [ “$_IP” ]; then
printf “Connect to Deluge via http://%s:8112 (Without the space)\n” “$_IP”
As posted, that uses Unicode left and right quotation marks. Make sure you have ASCII quotation marks in the actual file, otherwise you have unprotected parentheses, which is a syntax error.

However:
Dec 25 18:07:38 deluge systemd[1]: rc-local.service: Control process exited, code=exited status=203
status=203 suggests that systemd failed to even start /etc/rc.local. Have you damaged the "#!/bin/sh -e" line at the top?

dannycv
Posts: 5
Joined: Mon Dec 25, 2017 1:15 pm

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 3:57 pm

n67 wrote:
Tue Dec 26, 2017 12:21 pm
How do I like[sic] at the file /tmp/rc-local.out.? Sorry Im completely new to raspberry pi or anything about coding.
Presumably, whatever editor you used to change /etc/rc.local would be a good choice to use to examine /tmp/rc-local.out. Whatever you're comfortable with...

I just typed in the console

Code: Select all

sudo nano /etc/rc.local
And copy paste the text from the tutorial web page.

So I typed sudo nano /tmp/rc-local.out. but nothing appears in the console.

dannycv
Posts: 5
Joined: Mon Dec 25, 2017 1:15 pm

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 10:55 pm

rpdom wrote:
Tue Dec 26, 2017 9:20 am

I'd try

Code: Select all

exec >/boot/local.txt 2>&1;set -x
as that would mean if the boot completely failed you'd be able to put the card in any computer and read the log file (some windows text editors may bork over the line endings though).
I typed exec >/boot/local.txt 2>&1;set -x and got:

Code: Select all

[email protected]:~ $ -bash: /boot/local.txt: Permission denied
+ -bash: /boot/local.txt: Permission denied
-bash: -bash:: command not found
[email protected]:~ $


dannycv
Posts: 5
Joined: Mon Dec 25, 2017 1:15 pm

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 10:57 pm

beta-tester wrote:
Tue Dec 26, 2017 1:06 pm
stupid question...
will you get any error, when you type in that command line to the console/terminal

Code: Select all

sudo -u pi /usr/bin/python /usr/bin/deluge-web
while you are logge on?

I typed that in the console and got:

Code: Select all

[email protected]:~ $ sudo -u pi /usr/bin/python /usr/bin/deluge-web
+ sudo -u pi /usr/bin/python /usr/bin/deluge-web

/usr/lib/python2.7/dist-packages/deluge/_libtorrent.py:59: RuntimeWarning: to-Python converter for boost::shared_ptr<libtorrent::alert> already registered; second conversion method ignored.
  import libtorrent as lt

beta-tester
Posts: 1236
Joined: Fri Jan 04, 2013 1:57 pm
Location: de_DE

Re: Fail to start /etc/rc.local

Tue Dec 26, 2017 11:15 pm

dannycv wrote:
Tue Dec 26, 2017 10:55 pm
I typed exec >/boot/local.txt 2>&1;set -x and got:

Code: Select all

[email protected]:~ $ -bash: /boot/local.txt: Permission denied
+ -bash: /boot/local.txt: Permission denied
-bash: -bash:: command not found
[email protected]:~ $
that's normal, when you typed that in to the command line.
(to write a file to /boot, you need to have higher permissions)
it wasn't intended to type that in to the command line. the intention was, that you put that line on top of the rc.local file, to redirect any output while executing rc.local at boot time to the file /boot/local.txt, to see after next boot, if there were standard or error messages.
(or in case you have exec > /tmp/rc-local.out 2>&1;set -x on top of your rc.local file, then you have to look for the file /tmp/rc-local.out to see what is in there)

so, what are you actually trying to achieve?
adding "exec >/boot/local.txt 2>&1; set -x;" to the top of /etc/rc.local file?
or showing the content of /boot/local.txt (if existing), to see if there was any output at booting/executing rc.local?
or trying out what you get, when you type in "sudo -u pi /usr/bin/python /usr/bin/deluge-web" to the console?
{ I only give negative feedback }
RPi Model B (rev1, 256MB) & B (rev2, 512MB) & B+, RPi2B, RPi3B, RPi3B+, RPiZeroW, ...

Return to “Troubleshooting”