SUMMARY Missing IPv6 loopback entry in /etc/hosts causing systemctl service Unit not found

Latest response

Hi colleagues,

Last night I was involved in unusual debugging session as others could not figure out what was causing systemd services not to be recognised. They apparently used to work and "nobody seemingly made any changes on the system".

Maybe this resolution will help someone else not to waste their precious time in the future :)

Description of a problem:

All of a sudden, various systemd services were not found:

# systemctl start myservice
Failed to start myservice.service: Unit not found.

# systemctl list-units --all myservice*
UNIT        LOAD   ACTIVE   SUB  DESCRIPTION
myservice.service loaded inactive dead My Service

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.
1 loaded units listed.

Resolution:

All standard checks were done and none of them revealed any problem.

In the end, this entry was found to be the culprit: commended out line for IPv6 loopback interface in /etc/hosts:

#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

Once I enabled it, everything started working as expected.

Regards,

Dusan Baljevic (amateur radio VK2COT)

Responses