ufw crashes in wsl2
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ufw |
Fix Released
|
High
|
Jamie Strandboge | ||
ufw (Ubuntu) |
Fix Released
|
High
|
Jamie Strandboge | ||
Focal |
Fix Released
|
High
|
Jamie Strandboge | ||
Jammy |
Fix Released
|
High
|
Jamie Strandboge | ||
Lunar |
Fix Released
|
High
|
Jamie Strandboge | ||
Mantic |
Fix Released
|
High
|
Jamie Strandboge |
Bug Description
[ Impact ]
Currently, ufw is unusable on WSL due to this bug because the get_ppid() function traces back on /proc when the command name has parentheses (like in WSL). get_ppid() is called with 'ufw enable' and so ufw is not able to be enabled on WSL. The upstream patch adjusts get_ppid() for this and adds unit tests for this function.
[ Test Plan ]
Call 'sudo ufw enable' (it should not trace back) and call 'sudo ufw status' to show that it was enabled. Importantly, this is called as part of autopkgtests already.
Furthermore, look in the build logs for:
test_util
...
test_get_ppid (tests.
Test get_ppid() ... ok
test_get_
Test get_ppid() no space ... ok
test_get_
Test get_ppid() with parens ... ok
test_get_
Test get_ppid() with space ... ok
...
-------
Ran 49 tests in 0.355s
OK
[ Where problems could occur ]
The risk of regression is considered low since comprehensive unit tests are added for the patched function. Not only is this change in upstream ufw 0.36.2, it is already in Debian Bookworm and Ubuntu Mantic as part of 0.36.2-1.
# Original Description
When I enable systemd in WSL2 (it became supported recently), install ufw, and run sudo ufw enable, I get the error detailed in https:/
I verified that you can fix this issue by replacing the first split in line 427 with rsplit(')', 1) so it splits based on the last parenthesis instead of the all parenthesis.
Before:
ppid = open(name)
After:
ppid = open(name)
C:\Users\caleb>wsl --version
WSL version: 1.1.6.0
Kernel version: 5.15.90.1
WSLg version: 1.0.50
MSRDC version: 1.2.3770
Direct3D version: 1.608.2-61064218
DXCore version: 10.0.25131.
Windows version: 10.0.19045.2728
➜ ufw git:(master) ufw --version
ufw 0.36
Copyright 2008-2015 Canonical Ltd.
➜ ufw git:(master) cat /proc/229/stat | cut -c -23
229 (Relay(230)) S 228
Changed in ufw (Ubuntu Mantic): | |
status: | New → Triaged |
Changed in ufw (Ubuntu Jammy): | |
status: | New → Triaged |
Changed in ufw (Ubuntu Focal): | |
status: | New → Triaged |
Changed in ufw (Ubuntu Mantic): | |
importance: | Undecided → High |
Changed in ufw (Ubuntu Jammy): | |
importance: | Undecided → High |
Changed in ufw (Ubuntu Focal): | |
importance: | Undecided → High |
description: | updated |
Thanks for the report!