Tuesday, January 4, 2022

[SOLVED] Cntlmd not starting under systemd on Centos 7.1

Issue

Had a weird error trying to start cntlmd on Centos 7.1.

systemctl start cntlmd` results in the following in the logs (and yes, becomming is exactly how it's spelt in the logs :)):

systemd: Started SYSV: Cntlm is meant to be given your proxy address and becoming

Weird thing is:

  • that it did run initially after installation.
  • The exact same config works perfectly on another machine (provisioned with Chef so 100% same config).
  • If I run it in the foreground it works but through systemd, not.

To "fix" it, I had to manually remove and reinstall, whereupon it worked again.

Anybody seen this error (Google reveals nothing) and know what's going on?


Solution

I realised that the /var/run/cntlm directory seemed to be "removed" after every boot. Turns out the /var/run/cntlm directory is never created by systemd-tmpfiles on boot (thanks to this SO answer), which then resulted in:

Feb 29 06:13:04 node01 cntlm: Using following NTLM hashes: NTLMv2(1) NT(0) LM(0)
Feb 29 06:13:04 node01 cntlm[10540]: Daemon ready
Feb 29 06:13:04 node01 cntlm[10540]: Changing uid:gid to 996:995 - Success
Feb 29 06:13:04 node01 cntlm[10540]: Error creating a new PID file

because cntlm couldn't write it's pid file because /var/run/cntlm didn't exist.

So to get systemd-tmpfiles to create the /var/run/cntlm directory on boot you need to add the following file in /usr/lib/tmpfiles.d/cntlm.conf:

d /run/cntlm   700 cntlm cntlm

Reboot and Bob's your uncle.



Answered By - Donovan Muller