Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to change the default kill timeout for systemd service
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
0x006e
n00b
n00b


Joined: 02 Aug 2023
Posts: 33

PostPosted: Wed Dec 27, 2023 12:33 pm    Post subject: How to change the default kill timeout for systemd service Reply with quote

I'm using distrobox for managing couple of containers w/ podman. The problem is when I reboot or shutdown of the host computer. It takes about 2 minutes which I believe is the current limit to kill the podman process and shutdown/reboot. So how can I change this timelimit to something reasonable like 15s. I tried changing the /etc/systemd/system.conf(DefaultAbortTimeoutSec) but it does not change anything

Code:

#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it under the
#  terms of the GNU Lesser General Public License as published by the Free
#  Software Foundation; either version 2.1 of the License, or (at your option)
#  any later version.
#
# Entries in this file show the compile time defaults. Local configuration
# should be created by either modifying this file (or a copy of it placed in
# /etc/ if the original file is shipped in /usr/), or by creating "drop-ins" in
# /etc/systemd/system.conf.d/ directory. The latter is generally recommended.
# Defaults can be restored by simply deleting the main configuration file and
# all drop-ins located in /etc/.
#
# Use 'systemd-analyze cat-config systemd/system.conf' to display the full config.
#
# See systemd-system.conf(5) for details.

[Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#LogTime=no
#DumpCore=yes
#ShowStatus=yes
#CrashChangeVT=no
#CrashShell=no
#CrashReboot=no
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=
#NUMAPolicy=default
#NUMAMask=
#RuntimeWatchdogSec=off
#RuntimeWatchdogPreSec=off
#RuntimeWatchdogPreGovernor=
#RebootWatchdogSec=10min
#KExecWatchdogSec=off
#WatchdogDevice=
#CapabilityBoundingSet=
#NoNewPrivileges=no
#SystemCallArchitectures=
#TimerSlackNSec=
#StatusUnitFormat=description
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
DefaultTimeoutAbortSec=15s
#DefaultDeviceTimeoutSec=90s
#DefaultRestartSec=100ms
#DefaultStartLimitIntervalSec=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=yes
#DefaultIOAccounting=no
#DefaultIPAccounting=no
#DefaultMemoryAccounting=yes
#DefaultTasksAccounting=yes
#DefaultTasksMax=15%
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=1024:524288
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=8M
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
#DefaultMemoryPressureThresholdSec=200ms
#DefaultMemoryPressureWatch=auto
#DefaultOOMPolicy=stop
#DefaultSmackProcessLabel=
#ReloadLimitIntervalSec=
#ReloadLimitBurst=
Back to top
View user's profile Send private message
alamahant
Advocate
Advocate


Joined: 23 Mar 2019
Posts: 3879

PostPosted: Wed Dec 27, 2023 4:47 pm    Post subject: Reply with quote

Try
DefaultTimeoutStopSec=15s
_________________
:)
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 926
Location: Richmond Hill, Canada

PostPosted: Wed Dec 27, 2023 6:39 pm    Post subject: Reply with quote

0x006e,

I don't use podman but my understanding is podman do everything docker can do so,

I think in your case it is not service stop timeout is causing delay, it is more of container not stopped in time. In docker there is a global configuration directive to container dockerd to cause it forcefully stop container. may be you can check into where podman do that. I believe at least podman have --timeout command line option to cause per container stop delay.
Back to top
View user's profile Send private message
0x006e
n00b
n00b


Joined: 02 Aug 2023
Posts: 33

PostPosted: Thu Dec 28, 2023 3:26 am    Post subject: Reply with quote

alamahant wrote:
Try
DefaultTimeoutStopSec=15s

I have tried this, unfortunately doesn't work for me.

pingtoo wrote:
0x006e,

I don't use podman but my understanding is podman do everything docker can do so,

I think in your case it is not service stop timeout is causing delay, it is more of container not stopped in time. In docker there is a global configuration directive to container dockerd to cause it forcefully stop container. may be you can check into where podman do that. I believe at least podman have --timeout command line option to cause per container stop delay.


When I manually run podman stop, it SIGKILLs in 10s which is the default timeout. So I am not sure why systemd takes it 1.30 minutes. I've found a github issue in which this issue is mentioned but the solution it has is to reduce systemd timeout and that fedora does this nowadays.
https://github.com/containers/podman/issues/14531
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum