ShortCut to cancel systemd?

I often have a situation where it would be really usefull to stopp systemd waiting for a process.

After some time i press the powerbutton of my Laptop, but that’s not the nice way?!!

Example:

Dez 16 10:37:04 manjaro systemd[1]: NetworkManager.service: Processes still around after final SIGKILL. Entering failed mode.

/etc/systemd/system.conf:

[Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
#ShowStatus=yes
#CrashChangeVT=no
#CrashShell=no
#CrashReboot=no
#CtrlAltDelBurstAction=reboot-force
#CPUAffinity=1 2
#JoinControllers=cpu,cpuacct net_cls,net_prio
#RuntimeWatchdogSec=0
#ShutdownWatchdogSec=10min
#CapabilityBoundingSet=
#NoNewPrivileges=no
#SystemCallArchitectures=
#TimerSlackNSec=
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
DefaultTimeoutStartSec=30s
DefaultTimeoutStopSec=30s
#DefaultRestartSec=100ms
#DefaultStartLimitIntervalSec=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=no
#DefaultIOAccounting=no
#DefaultIPAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=yes
#DefaultTasksAccounting=yes
#DefaultTasksMax=15%
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=
#DefaultLimitAS=
#DefaultLimitNPROC=
#DefaultLimitMEMLOCK=

#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
#IPAddressAllow=
#IPAddressDeny=

These 30 Secs above are not enough??

Tipps are welcome …

Thank you

Hi @JohnML,

a Quick Google lets me think it can be done giving the specific service a different timeout value than the default one.

According to what I understand from this post: How do I skip the 90s timeout in systemd - Unix & Linux Stack Exchange

the TimeoutStopSpec= value needs to be set per service. So that will mean you need to edit the service configuration (probably /etc/systemd/networkd.conf although there’s a huge chance I’m wrong) , and set TimeoutStopSpec= to something custom.

EDIT:
After some more reading, I have come across this as well:

Running systemctl show SERVICE_NAME.service -p TimeoutStopUSec I could at least see the timeout set by systemd to my service.

I changed the script to a regular unit file one in order for it work properly.

from: centos - How to change systemd service timeout value? - Unix & Linux Stack Exchange

And although it’s for CentOS, AFAIK Systemd is Systemd.

– it happend this morning again and there was a nearly endless list of services systemd was waiting to finish: not only NetworkManager.

Last resort PowerButton …

Thank you for investigating this issue!

I suspect the other units wait for NetworkManager to finish before doing their thing.

Setting above mentioned timeout on the specific unit should, at least in theory, fix that as well.

I’d stongly recommend reading this thread for a safer alternative to holding the power button … assuming REISUB / REISUO works on your system, which it should.

1 Like