[Solved] Procd usb event causes endless reboot loops

i have a short script that resides in /etc/hotplug.d/tty that is activated each time my device reboots (it's custom board with onboard usb ttyACM device) .
the script calls another script that runs for a long period (it downloads a binary from the web and then run some backup and restore from the ttyACM ports. it takes around 4 minutes to complete.
when i run the script alone it runs ok, but when i run it from the hotplug script a and then reboots the hub keeps on rebooting, i can see it reaches a point where it runs procd and then procd states it shutting down everything (no logs) and the hub reboots. i tired to run the script with '&' to run in the background in case procd is taken, but it didn't help, after it happens i can't do anything but reinstall the previous FW using uboot and httpd.
Any idea why ? how can i write the tty script properly so procd wont go crazy ?

I would suggest moving a process that takes 4 minutes to run - to another location. The startup doesn't like hangs.

You should be able to start a background process from procd, given that it starts all the system daemons. I would take it a step at a time and make sure that you are actually spawning a detached process by "looking at" (printing or logging) the PID in a quickie script instead of your four-minute script.

If this is truly a boot-only process, I'd consider treating it as a one-shot process from /etc/init.d/

actually it's not happening and SHOULD NOT happen on boot at all.
the process should happen when:

  1. usb is inserted to the usb port
  2. the device is a ttyACMx device
  3. it's ttyACM1 and ttyACM0 also exists.

i've added some 'ifs' based on ACTION and DEVNAME and added some "sleep" between the runs of the tool that may change the usb and run my script in the background using & from the hotplug.d/tty/ script. i'm not verifiying the 3rd time but it seem to have solved the issue.

Couldn't the script just check the directory structure every so often?

Also, if your problem is fixed, consider marking the thread as "[SOLVED]."

will do, waiting to see if it's indeed resolved in a fresh new image i'm now building.

ok. after reviewing a bit of procd code and reviewing my script i think what happen is my script not explicitly returning using exit 0 and so the result was the last command it run, resulting in a failure causing procd to restart, since it happens once ttyACM0 was discovered (and it's on board, non detachable) it could not be stopped.
adding exit 0 in my script actually solved the issue.
pitty there isn't any best practice ofr all kind of system scripts in openwrt\lede

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.