Any linux nerds? Need help with systemd and overrides

I run influxd in a VM running ubuntu.

Influx has been taking a long time to start because the database is pretty large. The default systemd start timeout is 1m30.

I followed the steps to to create an override.conf for the service and changed the TimeoutStartUSec to 5min from 1m30, and rebooted but the change isn't taking.

Here's a webpage explaining the steps I did:

I know that's Centos, but my Ubuntu install uses systemd with the same file locations.

Did you check what config file it uses to set the time-out?
sudo systemctl status

Weird. I'm not seeing anything about influxd in there. Unless that's because it isn't running. At the top it shows degraded, failed 1 units.

Until I can get it to start on boot again, I just have it running in terminal.

Ahaha. If I do a sudo systemctl status influxd..

I just had the timeout in there by iteself. Then I tried adding [Unit] on the line above it, and it doesn't like that. I can't figure out what syntax it wants.

un 30 12:17:54 rainman systemd[1]: /etc/systemd/system/influxdb.service.d/override.conf:1: Assignment outside of section. Ignoring.
Jun 30 12:24:43 rainman systemd[1]: /etc/systemd/system/influxdb.service.d/override.conf:1: Assignment outside of section. Ignoring.
Jun 30 12:25:27 rainman systemd[1]: /etc/systemd/system/influxdb.service.d/override.conf:1: Assignment outside of section. Ignoring.
Jun 30 12:30:35 rainman systemd[1]: /etc/systemd/system/influxdb.service.d/override.conf:2: Unknown lvalue 'TimeoutStartUSec' in section 'Unit'
Jun 30 12:31:10 rainman systemd[1]: /etc/systemd/system/influxdb.service.d/override.conf:2: Unknown lvalue 'TimeoutStartUSec' in section 'Unit'

Contents of my override.conf

# If you modify this, please also make sure to edit init.sh

[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target
TimeoutStartUSec=5min  



[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh
KillMode=control-group
Restart=on-failure
Type=forking
PIDFile=/var/lib/influxdb/influxd.pid

[Install]
WantedBy=multi-user.target
Alias=influxd.service



Well for one: set the tagg under service, as you are trying to ajust the behaviour of the service.
The correct syntax you can always use the help function. (and I think you need to use seconds.
So try:

# If you modify this, please also make sure to edit init.sh

[Unit]
Description=InfluxDB is an open-source, distributed, time series database
Documentation=https://docs.influxdata.com/influxdb/
After=network-online.target  



[Service]
User=influxdb
Group=influxdb
LimitNOFILE=65536
EnvironmentFile=-/etc/default/influxdb
ExecStart=/usr/lib/influxdb/scripts/influxd-systemd-start.sh
TimeoutStartUSec=300
KillMode=control-group
Restart=on-failure
Type=forking
PIDFile=/var/lib/influxdb/influxd.pid

[Install]
WantedBy=multi-user.target
Alias=influxd.service
1 Like

I believe it's supposed to be specified as TimeoutStartSec

https://systemd.io/TRANSIENT-SETTINGS/

2 Likes

when you update a systemd conf you have to do a daemon reload.

Also "systemctl status" only gives you basic status. If you want status on influxdb you'd use "systemctl status influxdb".

That was my issue. I needed it to be under [Service].

And as @SmartHomePrimer pointed out, I had to drop the uSec and change it to Sec.

I noticed there was a lot of back and forth with the syntax of sec vs uSec when I was googling this. So problem solved.

Thanks!

1 Like

Yeah, I really hate systemd. My understanding is that TimeoutStartSec and TimeoutStopSec are stored in microseconds. It reports TimeoutStartUSec, but in minutes and seconds, not ยตSec ! :man_facepalming:

2 Likes

That explains the confusion! Everything I was reading was micro seconds, and when I did a show influxd.service it was showing me minutes/seconds but the field was uSec I scratched my head lol