We have upgraded the community system as part of the upgrade a password reset is required for all users before login in.

rc.local doesn't work on boot



  • hi. I am interested in omega2+ by two years. I designed and shared some pcbs including omega2+.
    When developing software it doesn't matter. But i want to run my omega2+ standalone at my car.
    It boot until then line below.

    [ 87.656889] random: 6 urandom warning(s) missed due to ratelimiting

    omega2+ wait until pressing enter key. (I am connected to omega2+ with usb serial converter)

    Then i pressed enter, it boots and shows Omega what will you invent screen.
    At this point boot process ends but rc.local doesn't work.

    I have this problem with b200ü, b233, b239 versions.
    I tried it 3 different omega2+ chip. All of them didn't work.

    I asked this before. Someone answered that create a service under /etc/rc.d .
    I couldn't have success.

    I want to run a python file on boot of Omega2+.

    Screenshot_1.jpg


    Screenshot_2.jpg ![alt metni](Boot screen)



  • @Fikret-UYSAL What do you want to do exactly?
    Please let us know your python code and your rc.local file.



  • @Fikret-UYSAL Take a look at procd, this is the correct way to run an app at boot.

    https://openwrt.org/docs/guide-developer/procd-init-scripts



  • @György-Farkas
    I add rc.local the code below.
    python3 /home/sayHello.py

    When I gave this command on terminal window, it prints "hello" text.

    İf I can run rc.local file, I will run a python file that controls gsm module and gps tracking app.
    It runs normally when I gave the command below:
    python3 /home/arts/gets.py

    I have no problem with files.
    I have problem with rc.local starting

    I tried this at raspberry pi. It works fine.



  • @György-Farkas
    On the other hand, boot process wait at 87.xxx line.
    It waits until press enter.
    So boot process never attends standalone. Why it waits enter key.

    İf I don't press enter key, it never complete boot process.



  • @Fikret-UYSAL You watch your Omega2+ Serial Console that shows very useful sytem (bootloader, kernel) messages.
    Your Omega2+ boot was successful and this was the last kernel message for now:
    [ 87.656889] random: 6 urandom warning(s) missed due to ratelimiting

    On the other hand, boot process wait at 87.xxx line.
    It waits until press enter.
    So boot process never attends standalone. Why it waits enter key.

    İf I don't press enter key, it never complete boot process.

    No.
    Maybe you saw this message earlier:
    Please press Enter to activate this console.



  • @György-Farkas
    Maybe, if it is so, nothing is change.
    Omega2 can't boot standalone and doesn't run rc.local file.



  • @György-Farkas
    I want omega2 to boot up without help of any keystrokes.
    Which settings should I do for this?



  • @Fikret-UYSAL With an official firmware you don't need to press any key to boot up an Omega2(+).



  • @György-Farkas
    I downloaded from repo.onion.io, b239 official image.
    I used b200 and b233 images before. They have been waiting for enter key too.
    Can you offer image link?



  • @Fikret-UYSAL

    • With any official firmware you don't need to press any key to boot up an Omega2(+). Full Stop / Period

    • There is a Serial Console on Omega2(+)'s UART0 (/dev/ttyS0).

      Please press Enter to activate this console.
      This message warns you that please press Enter to activate this console if you want to use it.



  • @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/mylog

    To examine the log: cat /var/log/mylog

    Two other things to look for:

    1. 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.

    2. 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 of which python3 and ls -l /etc/rc.local. Those should provide an immediate answer to your issue.



  • @Lnx-Prof

    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.

    alt metni
    bağlantı metni
    alt metni

    bağlantı metni

    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.py

    When 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?



  • @György-Farkas

    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.



  • @György-Farkas

    thanks. I added > /dev/ttyS0 to rc.local. It works fine. Thanks a lot.
    Screenshot_4.jpg
    red arrows are my outputs of my app.



Looks like your connection to Community was lost, please wait while we try to reconnect.