Howto trigger pppd chat script for usb LTE stick?

Hi Everyone,
I'm looking for a reliable way to bring up my wan connection over an LTE stick.

in short: what is the proper way to trigger the chat script that sets up the LTE connection?

my setup: 19.07.7, gi.inet AR300M, no brand LTE stick
I removed the WAN interface completely - the LTE stick is the only connection - so no mwan3 etc.
added a modem_1_1 interface for the LTE stick - which is not automatically brought up on boot

When I manually login and call ifup modem_1_1 pppd starts, the interface is brought up and everything works.
When in rc.local I call ifup modem_1_1 after a soft reboot, the interface is brought up and everything works.... but not after a hard reboot (i.e. powercycle) - the command is called correctly put pppd doesn't run the chat script.

A workaround I found (via this forum) was to rename the interface, and then call ifup - but that is terribly hacky - what is the proper way to get ifup to trigger pppd's chat script?

thanks!

My bet is that rc.local is run "too fast" and something is not yet loaded/done when the ifup is run. (while not related to openwrt I had a case when nouveau driver was stalling for ~30 seconds during load process for some reasons while x org was trying to load before nouveau was fully loaded and x was happy crashing, i was basicaly forced to delay the loading of x to fix it, it wasn't always happening only in ~50% of the cases...)
Is there any error in the logs when ifup doesn't run the chat script? I kinda expect an error message there.

You might want to "wait" for 60-120 second before ifup modem_1_1 .

I would try to add

sleep 90

before ifup modem_1_1 in rc.local and see if it improves the situation.

hi theduksd,
yes there is a "sleep 60" before the ifup.

but I'm pretty sure the driver is loaded already (dmesg, shows it correctly) and I can correctly communicate with the stick (i'm writing an AT command to it to change a setting and that works, regardless of soft boot/hard boot).

nothing in the logs, it's as if ifup simply doesn't trigger pppd.

Had another look, but this is as far as I get.. nothing else shows in the log

daemon.notice netifd: Interface 'modem_1_1' is setting up now
daemon.notice netifd: Interface 'modem_1_1' is now down

if i then do

uci rename network.modem_1_1=test
uci commit
ifup test

it does work correctly and pppd runs the caht script...

daemon.notice pppd[11478]: pppd 2.4.7 started by root, uid 0
local2.info chat[11480]: abort on (BUSY)
<snip>
daemon.info pppd[11478]: Serial connection established.
kern.info kernel: [ 1211.486373] 3g-test: renamed from ppp0
daemon.info pppd[11478]: Renamed interface ppp0 to 3g-test
daemon.info pppd[11478]: Using interface 3g-test
daemon.notice pppd[11478]: Connect: 3g-test <--> /dev/ttyUSB1
daemon.warn pppd[11478]: Could not determine remote IP address: defaulting to 10.64.64.64
daemon.notice pppd[11478]: local  IP address 10.40.35.189
daemon.notice pppd[11478]: remote IP address 10.64.64.64
daemon.notice pppd[11478]: primary   DNS address 80.58.61.250
daemon.notice pppd[11478]: secondary DNS address 80.58.61.254
daemon.notice netifd: Network device '3g-test' link is up
daemon.notice netifd: Interface 'test' is now up

I may have found a way to make this work, although it is a bit heavy-handed.
Would love to hear a cleaner/proper way rather than restarting the whole network in rc.local.

I added these lines to /etc/rc.local to make the stick come up (reliably)

/etc/init.d/network restart
sleep 5
interface=modem_1_1
ubus call network.interface up "{ \"interface\" : \"$interface\" }"