I am trying to set up a Raspberry Pi Zero W to create a network connection via a Nova R410 on boot. I.e. instead of logging in over wifi and running sudo hologram network connect
myself, I would like this to happen automatically. Has anyone done this successfully?
I attempted this by creating a systemctl service as follows.
[Unit]
Description=hologram
After=network-online.target sys-subsystem-net-devices-ppp.device
[Service]
Type=simple
ExecStart=/usr/local/bin/hologram network connect
Restart=on-failure
RestartSec=10
[Install]
WantedBy=multi-user.target
This works sometimes but more often than not it tries to run too early and gets various errors. I noticed that the hologram
script appears to exit with 0
even if it fails to connect, so I wrote a tiny python script to emulate the network connect
behavior and pointed the service at that instead.
...
cloud = CustomCloud(None, network='cellular')
cloud.network.disable_at_sockets_mode()
res = cloud.network.connect()
if res:
sys.exit(0)
else:
sys.exit(1)
First pppd will be unable to open /dev/ttyUSB1 and fail. When it retries 10 seconds later it seems to successfully set up a connection using ppp0 <–> /dev/ttyUSB2, but then it terminates on signal 15. The service then exits with “SUCCESS”. However ifconfig
reveals that ppp0 is not present and I have no network connection through the Nova. In fact the red/blue lights go off. And running network connect
myself results in being unable to find a usable serial port.
Sometimes the modem will “hang up” and then the script just keeps failing, unable to open the serial port.
No idea how this is all going so wrong, but it must be possible to set up a service that either retries the network connection or waits until the Nova is ready.