rcnovell-dhcpd start - fails - systemd[1]: dhcpd.service: Failed with result 'timeout'.

  • 7024396
  • 31-Jan-2020
  • 20-Feb-2020

Environment

Open Enterprise Server 2018 (OES 2018) Linux

Situation

Running rcnovell-dhcpd start at the terminal results in the DHCP server failing to load due to a timeout.
Looking in the /var/log/messages file for the reason shows entries like this:
systemd[1]: dhcpd.service: Failed with result 'timeout'.

Resolution

Adjusting systemd's time to wait for a service to load resolved this issue.

Details:

You can configure "DefaultTimeoutStartSec" in /etc/systemd/system.conf, which determines how long systemd should wait for a service to start up.

The default value of "DefaultTimeoutStartSec" is 90 seconds.

The configuration of "DefaultTimeoutStartSec" applies to startup of all services that are not of type "oneshot" and do not have a specific "TimeoutStartSec" in the "[Service]" section of their own .service file.

 

If possible, it would be best to configure the "TimeoutStartSec" parameter in the "[Service]" section of the .service file of a specific service, like dhcpd.


The default dhcpd service file is found here: /usr/lib/systemd/system/dhcpd.service.

The /usr/lib/systemd/system/dhcpd.service file will be overwritten by updates of novell-oes-dhcp-server.

To make sure that the configuration change persists an update, it is recommended to make the change in the user-defined configuration directory /etc/systemd/system.


Before copying /usr/lib/systemd/system/dhcpd.service to /etc/systemd/system, you should first check if a user-defined copy of /etc/systemd/system/dhcpd.service already exists.

 

If it does not exist yet, then you can copy /usr/lib/systemd/system/dhcpd.service to /etc/systemd/system:

 # cp --preserve=all /usr/lib/systemd/system/dhcpd.service /etc/systemd/system

 

After the file has been copied, you can edit the /etc/systemd/system/dhcpd.service file and insert the following line in the "[Service]" section:

 

TimeoutStartSec=360

 

That should make systemd give dhcpd 6 minutes to start, before it times out and terminates the still starting dhcpd process.

 

Once you have saved the change, you can run the following command to allow systemd to learn about the change:

 # systemctl daemon-reload

 

The expectation is that dhcpd will get sufficient time now from systemd to initialize.

Cause

The DHCP service was a taking too long to load. (~5 minutes)
This was caused by there being so many subnets and ranges to load.
This caused DHCP to run into the time limit set in the /etc/systemd/system.conf for the loading of services.