pigpio: "socket connect failed" but only if starting pigpiod via systemctl

Not sure if I’m using it wrong but I can’t seem to get pigpiod working if I start it as a service via systemd. Log of my actions as follows:

Made sure pigpiod was not running and then started it via systemctl:

pi@rpi-robot:~ $ ps aux | grep pigpiod
pi        1381  0.0  0.5   4364  1912 pts/0    S+   14:47   0:00 grep --color=auto pigpiod

pi@rpi-robot:~ $ sudo systemctl start pigpiod

pi@rpi-robot:~ $ pigs hwver
socket connect failed

Noticed that it seemed to have only bound to the ipv6 address ::1?

pi@rpi-robot:~ $ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      447/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      447/sshd
tcp6       0      0 ::1:8888                :::*                    LISTEN      1390/pigpiod
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           436/minissdpd
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           244/avahi-daemon: r
udp        0      0 0.0.0.0:34300           0.0.0.0:*                           244/avahi-daemon: r
udp        0      0 0.0.0.0:68              0.0.0.0:*                           429/dhcpcd
udp6       0      0 :::42667                :::*                                244/avahi-daemon: r
udp6       0      0 :::5353                 :::*                                244/avahi-daemon: r

Killed that version and started up via sudo and it works fine. Notice how the bind address is different but the port (8888) is the same

pi@rpi-robot:~ $ sudo killall pigpiod
pi@rpi-robot:~ $ sudo pigpiod
pi@rpi-robot:~ $ pigs hwver
9437377
pi@rpi-robot:~ $ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      447/sshd
tcp6       0      0 :::22                   :::*                    LISTEN      447/sshd
tcp6       0      0 :::8888                 :::*                    LISTEN      1428/pigpiod
udp        0      0 0.0.0.0:1900            0.0.0.0:*                           436/minissdpd
udp        0      0 0.0.0.0:5353            0.0.0.0:*                           244/avahi-daemon: r
udp        0      0 0.0.0.0:34300           0.0.0.0:*                           244/avahi-daemon: r
udp        0      0 0.0.0.0:68              0.0.0.0:*                           429/dhcpcd
udp6       0      0 :::42667                :::*                                244/avahi-daemon: r
udp6       0      0 :::5353                 :::*                                244/avahi-daemon: r
pi@rpi-robot:~ $

This is pretty much a fresh install of Raspbian Lite 9 (Stretch) on a Pi Zero W.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 21 (5 by maintainers)

Most upvoted comments

@ralphhughes is perfectly right!

As a quick fix, I suggest to change the ExecStart stanza to:

ExecStart=/usr/bin/pigpiod -l -n 127.0.0.1

This makes the daemon bind to IPv4.

The longterm solution should be to make the daemon listen to both IPv4 and IPv6, I guess.