Autostart of the phidget22networkserver fails

Supporting 2.6 and up
Post Reply
MerlinElMago
Fresh meat
Posts: 2
Joined: Tue Dec 27, 2022 4:39 pm
Contact:

Autostart of the phidget22networkserver fails

Post by MerlinElMago »

Hello everybody,
I'm running two interfacekits 8/8/8 connected to a RPi 1 model B to control a breeding rack for my fishroom. I use node-red ( which by the way is marvellously easy and I have fallen in love with it ) to control my hardware. When I start all services manually, everything works like a charm, but whenever I try to start the networkserver from a startup script (which is required to be able to run node-red) it fails with the following message:

Code: Select all

2022-12-27T22:28:10  <Info> phidget22 : 
	******************************  Logging Enabled  ******************************
	* Phidget22 - Version 1.12 - Built Dec 22 2022 07:55:11                       *
	* Release 1.12.20220912 - Linux (32-bit)                                      *
	*******************************************************************************
2022-12-27T22:28:10  <Info> phidget22usb[PhidgetUSBScanDevices()] : Initializing libusb
2022-12-27T22:28:10  <Info> phidget22[deviceAttach()] : (Attach) Dictionary (Dictionary) v100 S/N:2 Label:Phidget22 Control
2022-12-27T22:28:10  <Info> phidget22net[PhidgetNet_start()] : Starting Networking
2022-12-27T22:28:11  <Info> phidget22usb[PhidgetUSBScanDevices()] : New Phidget found in PhidgetUSBBuildList: 1/6
2022-12-27T22:28:11  <Info> phidget22[deviceAttach()] : (Attach) 1013/1018/1019 (PhidgetInterfaceKit 8/8/8) v826 S/N:156014
2022-12-27T22:28:11  <Info> phidget22usb[PhidgetUSBScanDevices()] : New Phidget found in PhidgetUSBBuildList: 1/7
2022-12-27T22:28:11  <Info> phidget22[deviceAttach()] : (Attach) 1010/1018/1019 (PhidgetInterfaceKit 8/8/8) v903 S/N:175635
2022-12-27T22:28:11 <ERROR> phidget22net[startIPhidgetServer()] : failed to open server socket
	mos_netops-unix.c+201 mos_netop_tcp_openserversocket() : (IO Failure) failed to bind socket: Cannot assign requested address
2022-12-27T22:28:11 <ERROR> phidget22net[startServer()] : failed to start server
2022-12-27T22:28:11  <Info> phidget22net[PhidgetNet_stop()] : Stopping Networking
2022-12-27T22:28:12  <Info> netsrv[startPhidgetServer()] : PhidgetNet_startserver() failed on IPv4 port 5661
2022-12-27T22:28:12 <ERROR> netsrv[runPhidgetNetworkServer()] : failed to start phidget server
My script looks like this:

Code: Select all

#!/bin/sh
#
# Init script for phidget22networkserver
#
# (c) 2022 MerlinElMago <xxx>
#
#
### BEGIN INIT INFO
# Provides:          phidget22networkserver
# Required-Start:    $all
# Required-Stop:     $local_fs $remote_fs $syslog
# Should-Start:      avahi-daemon
# Should-Stop:       avahi-daemon
# Default-Start:     3 4 5
# Default-Stop:      0 1 2 6
# Short-Description: Phidget Network Server v22
### END INIT INFO

sudo /usr/local/bin/phidget22networkserver -c /etc/phidgets/phidget22networkserver.pc -D
I suspect that it is a permission problem, but I don't know where else to look...

When issuing a

Code: Select all

sudo systemctl list-unit-files
, the service appears as enabled. Actually a

Code: Select all

sudo systemctl status phidget22networkserver
returns success.

Any hints?

Best Regards
Merlin
User avatar
Patrick
Lead Developer
Posts: 634
Joined: Mon Jun 20, 2005 8:46 am
Location: Canada
Contact:

Re: Autostart of the phidget22networkserver fails

Post by Patrick »

You probably need to add $network to your Required-Start - it seems to be starting up before networking is available.

Our init script block:

Code: Select all

### BEGIN INIT INFO
# Provides:          phidget22networkserver
# Required-Start:    $network $remote_fs
# Required-Stop:     $network $remote_fs
# Should-Start:      avahi avahi-daemon
# Should-Stop:       avahi avahi-daemon
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Phidget Network Server
# Description:       Phidget network server for accessing Phidgets over the network.
### END INIT INFO
Also, you shouldn't have sudo in the init-script

-Patrick
MerlinElMago
Fresh meat
Posts: 2
Joined: Tue Dec 27, 2022 4:39 pm
Contact:

Re: Autostart of the phidget22networkserver fails

Post by MerlinElMago »

Works like a charm... thank you!
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests