Onion2s+ Reflashes itself randomly.



  • Hey All - I seem to have the exact opposite problem from everyone else. Seems like most people can't get their unit to FLASH. Mine won't stop. I have a set of python scripts that have been proven over several years on over 200 commercial units to be good - normal system is RPi. Since I can't get Pi's anymore, we are trying to switch to Onion. Everything is working fine except two things:

    1. Unable to get the scripts to run from Cron at boot without losing the console
    2. After 24-48 hours of running the code, the system goes away. When I finally reconnect, I'm greeted with the first time setup screens. All my files are gone and I have to do a complete setup all over again.

    This has happened about 10 times so far and is both frustrating and un-nerving. What info would y'all need to provide some assistance?

    Thanks in advance.



  • @wflynn Not sure why you would be running a script from cron at boot time. Typically you would use procd or rc.local. Perhaps you can provide more detail on what your script does and how you have the device configured to run the script.

    issue 2 sounds like there may be an issue in your script, I've never seen the firmware reflash itself, that would be quite a sight. My suspicion is that your file system may be getting mucked up, but we need more detail on what your script does in order to be able to troubleshoot further.



  • @crispyoz Thanks for the reply. The script is actually quite complex. It is a number of python files and threads that automate the cleaning of a beer line in a Pub. So, there are some buttons, some LEDs, a couple of pumps, valves, and the like. Press a button and we start a clean cycle with many many steps. Like I said quite complicated actually for what it is. We've got this running on over 200 RPis in actual pubs for over 4 years and no issues, but I don't think the Pi has the capability to reflash itself. But other than issues caused by leaking cleaning fluid (pH of 12 oh my) no real operational issues. So, we think the scripts are solid.
    Could be a thing we are not aware of on the Onion vs RPi - like if we write a configuration file to the file system, on the Pi it goes to the USB drive (from which we boot and run everything). Where does it go on the Onion? Program FLASH?



  • @wflynn The Omega2 will write a file to the location on the file system you specify, so the first step is to determine where that is and provide that information here.

    Are you booting the Omega2 from USB?

    The Omega2 doesn't reflash itself, but perhaps you have a cron job set up to make it do so, which would be a risky strategy. Post the output of each of these commands:

    oupgrade -v
    mount
    crontab -l
    cat /etc/rc.local
    ls -la /etc/init.d



  • @crispyoz Thanks for the help. Freshly installed system ready to run (but not auto run - we've put a hold on that for the moment).

    root@Omega-BE66:/mnt/sda1# oupgrade -v

    Device Firmware Version: 0.3.3 b253
    root@Omega-BE66:/mnt/sda1# mount
    /dev/root on /rom type squashfs (ro,relatime)
    proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
    sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
    tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
    /dev/mtdblock6 on /overlay type jffs2 (rw,noatime)
    overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
    tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
    devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
    debugfs on /sys/kernel/debug type debugfs (rw,noatime)
    mountd(pid1100) on /tmp/run/blockd type autofs (rw,relatime,fd=7,pgrp=1,timeout=30,minproto=5,maxproto=5,indirect)
    /dev/mtdblock7 on /mnt/mtdblock7 type jffs2 (rw,relatime)
    /dev/sda1 on /mnt/sda1 type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
    root@Omega-BE66:/mnt/sda1# crontab -l
    crontab: can't open 'root': No such file or directory
    root@Omega-BE66:/mnt/sda1# cat /etc/rc.local

    Put your custom commands here that should be executed once

    the system init finished. By default this file does nothing.

    exit 0
    root@Omega-BE66:/mnt/sda1# ls -la /etc/init.d
    drwxr-xr-x 2 root root 468 Feb 8 2022 .
    drwxr-xr-x 1 root root 0 Nov 28 21:14 ..
    -rwxr-xr-x 1 root root 267 Feb 8 2022 avahi-daemon
    -rwxr-xr-x 1 root root 288 Feb 8 2022 blockd
    -rwxr-xr-x 1 root root 1122 Feb 8 2022 boot
    -rwxr-xr-x 1 root root 157 Feb 8 2022 bootcount
    -rwxr-xr-x 1 root root 821 Feb 8 2022 cron
    -rwxr-xr-x 1 root root 28796 Feb 8 2022 dnsmasq
    -rwxr-xr-x 1 root root 255 Feb 8 2022 done
    -rwxr-xr-x 1 root root 4909 Feb 8 2022 dropbear
    -rwxr-xr-x 1 root root 658 Feb 8 2022 ethernet-mode
    -rwxr-xr-x 1 root root 997 Feb 8 2022 firewall
    -rwxr-xr-x 1 root root 215 Feb 8 2022 fstab
    -rwxr-xr-x 1 root root 1013 Feb 8 2022 gpio_switch
    -rwxr-xr-x 1 root root 3364 Feb 8 2022 led
    -rwxr-xr-x 1 root root 2479 Feb 8 2022 log
    -rwxr-xr-x 1 root root 7475 Feb 8 2022 mosquitto
    -rwxr-xr-x 1 root root 2663 Feb 8 2022 network
    -rwxr-xr-x 1 root root 292 Feb 8 2022 odhcpd
    -rwxr-xr-x 1 root root 276 Feb 8 2022 onion-helper
    -rwxr-xr-x 1 root root 95 Feb 8 2022 oupgrade
    -rwxr-xr-x 1 root root 249 Feb 8 2022 rpcd
    -rwxr-xr-x 1 root root 484 Feb 8 2022 shellinabox
    -rwxr-xr-x 1 root root 1212 Feb 8 2022 sysctl
    -rwxr-xr-x 1 root root 662 Feb 8 2022 sysfixtime
    -rwxr-xr-x 1 root root 2155 Feb 8 2022 sysntpd
    -rwxr-xr-x 1 root root 1047 Feb 8 2022 system
    -rwxr-xr-x 1 root root 4817 Feb 8 2022 uhttpd
    -rwxr-xr-x 1 root root 106 Feb 8 2022 umount
    -rwxr-xr-x 1 root root 85 Feb 8 2022 updateHostname
    -rwxr-xr-x 1 root root 239 Feb 8 2022 urandom_seed
    root@Omega-BE66:/mnt/sda1#



  • @wflynn Nothing stands out to me as problematic, this looks like a standard system other than you have a USB device installed, which should not be an issue. So we need to look at why/how/if the system is being corrupted.

    You mentioned running your script(s) in cron at boot, I assume you are using @reboot prefix in your crontab, correct?
    Have you tested using rc.local or procd? Take a look at /etc/init.d/avahi-daemon for a simple example of how to setup a startup script. Alternatively you can add the command(s) to your /etc/rc.local but be sure you add the ampersand after the command(s) so as to background the script, otherwise you may lose your command prompt, eg:

    /usr/sbin/myprogram -c some parameter &

    I'd also be interested to see the code to how you are writing to file in case there is something potentially corrupting your file system.

    These are my best guesses in the absence of more specific details of the script.



  • @crispyoz After more investigation and thought, it may not be reflashing itself. When I first started with it, I did an upgrade and update, which took some time. Those are now part of our "install" script. So, when it loses its mind, and I run the install script, those things now say nothing to do, you're already up to date. Once you do upgrade and update, do they now become the "factory" image? I wouldn't think so, but maybe. If they don't then it's not reflashing itself I think, but instead is only wiping the file system. Does any of that make sense?



  • @crispyoz Also, for now we're not running scripts on boot. When we did, we didn't use the @reboot prefix. No clue what rc.local is nor procd.
    We are indeed now running the script with the & a the end and that works. The other thing we had done was to disable the console port because our hardware was using that serial port to talk to a configuration program on a PC. This made debugging this quite difficult. So we have cut and jumpered the heck out of the board to move our test port to Uart2 and leave console alone.



  • @crispyoz said in Onion2s+ Reflashes itself randomly.:

    Take a look at /etc/init.d/avahi-daemon for a simple example of how to setup a startup script. Alternatively you can add the command(s) to your /etc/rc.local


Log in to reply
 

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