rc.local doesn't work on boot
-
@Fikret-UYSAL if you don't want to use procd (bizarre) add some debugging to your rc.local. Just pipe your output to a file so can review the file to determine if your command actually runs and fails.
eg: add this to your rc.local
echo "Before my command runs" >> /var/log/mylog
/mydirectory/mycommand >> /var/log/mylog
echo "After my command runs" >> /var/log/mylogTo examine the log: cat /var/log/mylog
Two other things to look for:
-
You may want to try running your app using a shell script so you can use sh /mydirectory/myappname sometimes rc.local fails to run commands due to path and other environment issues.
-
add an empty line to the end of your rc.local after your command. I had a problem previously where it didn't seem to be understanding that the command had been terminated. Not sure why.
-
-
@Fikret-UYSAL One more time please let us know what do you want to do exactly?
-
rc.local paradigm works just fine on the Omega.
Your issue would be OBVIOUS if you would post your rc.local, but instead have everyone guessing as to what you're doing and why it's not working.
My guesses:
- You haven't made rc.local executable. Make sure to
chmod +x
the file. - You are trying to run python3, but you likely haven't specified a shell interpreter in a hash-bang at the top - so python can't be found because there's no set executable search path.
- You don't have python3, or it's not found in the executable search path (have you tried hardcoding the full path:
/usr/bin/python3
?)
Before saying "no, no, no" to these (admitted) guesses, consider actually posting your full
rc.local
along with the output ofwhich python3
andls -l /etc/rc.local
. Those should provide an immediate answer to your issue.
- You haven't made rc.local executable. Make sure to
-
Hi. Thanks for attention. I designed two different pcb. One is gsm+gps module supported vehicle tracking project. the other is a hub of lots of gpio and sensor connection pcb.
I load bin file from repo.onioniot.io/omega2/images
B239 latest image, made update, install python3, pyserial.Module is still waiting to press enter before "crng init done" line.
İf I press enter omega2 busybox screen comes and prints what will you want, if i don't press enter, it waits for enter key. Do nothing else.
I load b202 image and made update, install python, pyserial and reboot.
Omega2+ waits to press enter,
When i press enter it prints busybox screen. İf i don't press enter, omega2 waits for enter key, do nothing else.I added to rc.local file, the line below:
python /home/sayHello.pyWhen i give this command at terminal window, it works fine and prints "hello" word. But at rc.local file it does nothing.
Two different images (b202 and b239) and two different omega2+ chip, i couldn't boot properly and rc.local file didn't work.
Now, sun is rising when i am writing this sentences. Morning is coming up.
I try to take a youtube video of boot process and give link to you.
Thanks for your attention @crispyoz and @Lnx-Prof and @György-Farkas
-
@Fikret-UYSAL What is your /home/sayHello.py file please?
-
Just a python file: sayHello.py file content is:
print("hello")İ wanted to see whether it would work.
-
@Fikret-UYSAL
Q: What do you want to do exactly?
A: I want to print the 'hello' word to the Serial Console during boot with rc.local.
(if Í understand well )Please modify your rc.local file:
# Omega2+ FW v0.3.2 b239 # this is the modified rc.local file root@Omega-5BE1:/# cat /etc/rc.local # Put your custom commands here that should be executed once # the system init finished. By default this file does nothin echo "hello" > /dev/ttyS0 exit 0
Please reboot your Omega2+ board and watch the output of the Serial Console carefully:
... [ 29.736829] IPv6: ADDRCONF(NETDEV_UP): br-wlan: link is not ready [ 30.417503] [ 30.417503] _ _____ ___ ___ _________ ___ ____ [ 30.417503] | | /| / / _ | / _ \/ _ \ / ___/ __ \/ _ \/ __/ V1.1 [ 30.417503] | |/ |/ / __ |/ , _/ ___/ / /__/ /_/ / , _/ _/ [ 30.417503] |__/|__/_/ |_/_/|_/_/ \___/\____/_/|_/___/ [ 30.417503] Onion Enhanced MT7688 WiFi Driver [ 30.417503] [ 30.769845] DMA Scheduler Mode=0(LMAC) [ 30.773760] efuse_probe: efuse = 10000012 [ 30.777889] 1. Phy Mode = 14 [ 31.051046] 2. Phy Mode = 14 [ 31.054078] 3. Phy Mode = 14 [ 31.083726] WTBL Segment 1 info: [ 31.087104] MemBaseAddr/FID:0x28000/0 [ 31.090991] EntrySize/Cnt:32/128 [ 31.094478] WTBL Segment 2 info: [ 31.097838] MemBaseAddr/FID:0x40000/0 [ 31.101722] EntrySize/Cnt:64/128 [ 31.105182] WTBL Segment 3 info: [ 31.108541] MemBaseAddr/FID:0x42000/64 [ 31.112512] EntrySize/Cnt:64/128 [ 31.115971] WTBL Segment 4 info: [ 31.119330] MemBaseAddr/FID:0x44000/128 [ 31.123404] EntrySize/Cnt:32/128 hello [ 48.657547] br-wlan: port 1(ra0) entered blocking state [ 48.662862] br-wlan: port 1(ra0) entered disabled state [ 48.668604] device ra0 entered promiscuous mode [ 48.673576] br-wlan: port 1(ra0) entered blocking state [ 48.678884] br-wlan: port 1(ra0) entered forwarding state [ 48.686136] IPv6: ADDRCONF(NETDEV_CHANGE): br-wlan: link becomes ready [ 50.901365] Interface apcli0 link up! (WPA2PSK AES) [ 77.940640] random: crng init done [ 77.944109] random: 6 urandom warning(s) missed due to ratelimiting
As you see the modified rc.local works as expected.
-
@György-Farkas
Thanks.
I will try.
-
thanks. I added > /dev/ttyS0 to rc.local. It works fine. Thanks a lot.
red arrows are my outputs of my app.
-
Hi,
i have a new onion module and seem to get exact same error as yours. it will get stuck here
[ 44.852427] br-wlan: port 1(ra0) entered forwarding state
[ 44.859496] IPv6: ADDRCONF(NETDEV_CHANGE): br-wlan: link becomes readyand wont proceed until i press "enter". my setup is identical to you yours. onion connected to pc through usb.
the module was never used and does not have any special code or script running during boot.
any idea what might be going on here.
Thanks for looking into this.
-
@Anil-bhaskar did you try the example rc.local @György-Farkas posted above? It may be that rc.local is functioning correctly but that the commands you are executing are not.
You can post your rc.local
If you are trying to start a daemon you may need to background it using & so it doesn't exit. I personally thing procd is more appropriate in that case.