1

On my Pi3B+ I had pigpiod configured to run on boot and I can successfully run compiled c programs; specifically DHTXXD.c which contains:-

/*
DHTXXD.c
2016-02-16
Public Domain
*/

#include <stdio.h>
#include <stdlib.h>

#include <pigpiod_if2.h>

However when I try to run pigs hwver I get an error "socket connect failed" even though systemctl status pigpiod shows it is running and port 8888 is open.

Indeed any pigs command failed.

I disabled and reenabled pigpiod with sudo systemctl enable pigpiod which responded:-

Created symlink /etc/systemd/system/multi-user.target.wants/pigpiod.service → /lib/systemd/system/pigpiod.service.

When I disable pigpiod on boot then DHTXXD fails.

If I manually enable with sudo pigpiod then both work.

With pigpiod manually started

$ sudo systemctl status pigpiod
● pigpiod.service - Daemon required to control GPIO pins via pigpio
   Loaded: loaded (/lib/systemd/system/pigpiod.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

With pigpiod automatically started

$ sudo systemctl status pigpiod
● pigpiod.service - Daemon required to control GPIO pins via pigpio
   Loaded: loaded (/lib/systemd/system/pigpiod.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2018-12-13 12:18:39 AEDT; 35s ago
  Process: 347 ExecStart=/usr/bin/pigpiod -l (code=exited, status=0/SUCCESS)
 Main PID: 371 (pigpiod)
   CGroup: /system.slice/pigpiod.service
           └─371 /usr/bin/pigpiod -l

Anyone have any idea to make reliable autostart?

1
  • Sorry if this sounds flippant but it does look as though it has something to do with the systemd setup - I use the older (non-standard these days) sysV init to run my own daemon from that setup's /erc/rc.local that spawns a separate pigpiod thread - and from what I recall of @joan 's pigpio library it used to (I am not sure that it used the same mechanism nowadays) check that there is only one instance running by looking for a /run/pigpiod.pid file - but if it crashed previously that file might still be around and be preventing a new instance from starting...
    – SlySven
    Commented Dec 14, 2018 at 3:17

3 Answers 3

2

In case anyone else runs into this problem, I discovered WHY
- the /lib/systemd/system/pigpiod.service was set to Disable remote socket interface!

How to fix it - either fix the faulty pigpiod.service script -
remove the -l switch in

ExecStart=/usr/bin/pigpiod -l

OR Run raspi-config and Interfacing Options will allow you to enable or disable remote connection to GPIO server. The actual unit script is fine and does not need to be changed.

See also https://raspberrypi.stackexchange.com/a/104441/8697

0

This problem will be fixed in pigpiod version 77.

Workaround is bind the demon an the local ip:

/lib/systemd/system/pigpiod.service

[Service] ExecStart=/usr/bin/pigpiod -l -n 127.0.0.1

0

My Pi came without pigpio installed for some odd reason (64 bit Lite OS)

sudo apt-get install pigpio once installed sudo systemctl enable pigpiod (not a typo) sudo systemctl start pigpiod

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.