When puppet is listing all the available services (via puppet resource service), systemctl is queried, through the instances method, to gather all the services. These are filtered and only the ones with any of the following states are shown to the user: `disabled`, `enabled`, `masked` or `indirect`. Since in our case pe-postgresql is marked as bad, it is indeed omitted. systemctl's man section for the is-enabled parameter possible statuses states that:
| Name |
Description |
Error code |
| "bad" |
The unit file is invalid or another error occurred. Note that is-enabled will not actually return this state, but print an error message instead. However the unit file listing printed by list-unit-files might show it. |
> 0 |
Puppet will simply ignore the error message described above and will decide that a service is not enabled. In case of debian based operating systems, which is our current case with Ubuntu, it will further check and find out that the service is indeed well and actually enabled. Steps taken in investigating why that is the only service marked as bad: Running `systemctl list-unit-files pe-postgre*` shows our pe-postgresql services available on the system:
pe-postgresql.service bad |
pe-postgresql11.service static
|
By running `systemctl status pe-postgresql`, we got the service’s status, unit file and conf file:
pe-postgresql.service - Puppet Enterprise PostgreSQL database server |
Loaded: loaded (/lib/systemd/system/pe-postgresql.service; bad; vendor preset: enabled) |
Drop-In: /lib/systemd/system/pe-postgresql.service.d |
└─pe-postgresql.conf
|
When checking the conf file, we found out that it actually is a symlink.
> ls -l /lib/systemd/system/pe-postgresql.service.d/pe-postgresql.conf |
pe-postgresql.service.d/pe-postgresql.conf -> /etc/alternatives/pe-postgresql-server-service
|
And when checking the destination, it turned out to be another symlink, pointing towards the pe-postgresql11 service:
> ls -l /etc/alternatives/pe-postgresql-server-service |
/etc/alternatives/pe-postgresql-server-service -> /lib/systemd/system/pe-postgresql11.service.d/pe-postgresql11.conf
|
Getting rid of the symlink chain and replacing it with a copy of pe-postgresql11.conf seems to be a solution:
> cp --remove-destination -d /lib/systemd/system/pe-postgresql11.service.d/pe-postgresql11.conf /lib/systemd/system/pe-postgresql.service.d/pe-postgresql.conf |
systemctl doesn't consider the pe-postgresql service as bad anymore:
> systemctl list-unit-files pe-postgre* |
pe-postgresql.service enabled |
pe-postgresql11.service static
|
Also puppet now shows it to the user:
|