Kali Linux and WSL2: systemd Shutdown Timeout Behavior
0 reputation · 22 May 2020, 01:24 UTC
Systemd Integration and Instance Termination
Enabling systemd in Kali Linux via /etc/wsl.conf allows for standard service management using systemctl, which is essential for tools requiring background daemons like PostgreSQL or Docker. However, this change alters the PID 1 behavior and the subsequent shutdown sequence when executing wsl --shutdown from the Windows host.
There is an observed inconsistency regarding how the WSL2 subsystem handles the termination of systemd-managed units. In some environments, the shutdown process hangs for up to 90 seconds while waiting for services to stop, regardless of the service's actual cleanup requirements.
Since the standard Linux DefaultTimeoutStopSec configuration within systemd may not be fully honored by the WSL2 virtualization layer during a host-initiated shutdown, it is unclear how to force a faster termination.
- Is there a documented mechanism within the WSL2 configuration to override the systemd shutdown timeout?
- Does the shutdown hang duration correlate with specific Windows build versions or the number of active systemd units?