Mask NetworkManager-wait-online.service during boot to prevent timeouts
Windows Version
Microsoft Windows [Version 10.0.26200.7171]
WSL Version
2.6.2.0
Are you using WSL 1 or WSL 2?
- [x] WSL 2
- [ ] WSL 1
Kernel Version
6.6.87.2
Distro Version
Ubuntu 25.10
Other Software
No response
Repro Steps
- Enable systemd in WSL.
- Install/use a distro that uses NetworkManager.
- Boot WSL.
Expected Behavior
WSL boots without delay or error.
Actual Behavior
WSL boot is delayed, and the following error eventually appears:
wsl: Failed to start the systemd user session for 'username'. See journalctl for more details.
Diagnostic Logs
This issue is similar to the one addressed in PR #13611 regarding systemd-networkd-wait-online.service.
Since WSL interfaces are unmanaged by systemd/NetworkManager, this service waits for an event that never happens, causing a 60-second timeout during boot.
I was able to workaround this by configuring NetworkManager to stop managing devices via /etc/NetworkManager/conf.d/exclude.conf:
[keyfile]
unmanaged-devices=*
Per the discussion in PR #13611, it is suggested to mask NetworkManager-wait-online.service by default in WSL to avoid this delay.
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1
The script will output the path of the log file once done.
If this is a networking issue, please use collect-networking-logs.ps1, following the instructions in Collect WSL logs for networking issues
Once completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.