Q:

Problem autostarting pigpiod

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?

A:

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

