# ttyUSB0 not ready in time to start ppp

## ddriver

I have set up a 3G dongle on a SBC so that it starts the connection from net.ppp0 using settings in /etc/conf.d/net.

This is all working fine when I run the startup script manually, but it fails to start on boot. The problem is that when the system boots, it tries to start ppp before the ttyUSB0 device has been recognised, so fails to bring up the link and gives me an error. It doesn't retry - it just gives up.

The system boots very quickly as it is a very trimmed down build and uses a CF card rather than a HDD, which is probably why it gets to the net.ppp0 script before the modules for the dongle have loaded.

I have worked round this by creating a script in /etc/local.d which tests for the existence of /etc/runlevels/default/net.ppp0 and runs it if found. However this seems like a bit of a hack.

Is there a correct way to make the net.ppp0 script wait for the ttyUSB0 device to be initialised, or to make it retry if it doesn't find the device?

----------

## ianw1974

Are you usb devices compiled into your kernel, or as modules?  If as modules, try re-compiling the kernel so that the usb stuff is built into the kernel.  Does that help any better?

Otherwise, I guess the usb modules, need to be loaded before the networking starts, would need to find out where this is as I'm unsure myself.

----------

## ddriver

I have them as modules. I really want them that way because this is a standard build for multiple SBCs, most of which don't have USB and won't be using a dongle. I can however try them in the kernel instead.

The ttyUSB0 device becomes ready just after it's needed - it's just a timing issue, I don't know how to make this a dependency.

----------

## ianw1974

Have you got the module loaded in /etc/conf.d/modules?  Maybe add it in here, and see if that helps.  Otherwise, I'll have to check something else on my system.

----------

## ianw1974

Something in /etc/rc.conf - could be exactly what you need:

```
##############################################################################

# SERVICE CONFIGURATION VARIABLES

# These variables are documented here, but should be configured in

# /etc/conf.d/foo for service foo and NOT enabled here unless you

# really want them to work on a global basis.

# Some daemons are started and stopped via start-stop-daemon.

# We can set some things on a per service basis, like the nicelevel.

#export SSD_NICELEVEL="-19"

# Pass ulimit parameters

#rc_ulimit="-u 30"

# It's possible to define extra dependencies for services like so

#rc_config="/etc/foo"

#rc_need="openvpn"

#rc_use="net.eth0"

#rc_after="clock"

#rc_before="local"

#rc_provide="!net"

# You can also enable the above commands here for each service. Below is an

# example for service foo.

#rc_foo_config="/etc/foo"

#rc_foo_need="openvpn"

#rc_foo_after="clock"
```

your dependency for the service would be your usb module no doubt.  Something work trying perhaps.

----------

