It is a fresh install of Ubuntu 20.4 or Ubuntu 22.04 but they all failed when I tried to enable ufw with errors as below from a Ubuntu console.
sudo ufw enable
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/ufw/util.py", line 427, in under_ssh
ppid = get_ppid(pid)
File "/usr/lib/python3/dist-packages/ufw/util.py", line 419, in get_ppid
ppid = open(name).readlines()[0].split(')')[1].split()[1]
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/sbin/ufw", line 138, in <module>
not ui.continue_under_ssh():
File "/usr/lib/python3/dist-packages/ufw/frontend.py", line 901, in continue_under_ssh
if self.backend.do_checks and ufw.util.under_ssh(): # pragma: no cover
File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh
return under_ssh(ppid)
File "/usr/lib/python3/dist-packages/ufw/util.py", line 457, in under_ssh
return under_ssh(ppid)
My WSL2 has the following ...
wsl -l -v
NAME STATE VERSION
* Ubuntu-22.04 Running 2
Ubuntu-20.04 Stopped 2
I have similar configuration in another PC but do not have this issue. I have shutdown, updated WSL, reinstalled different versions of Ubuntu but got same result. I have searched around but could not find any match. Hopefully some experts with ufw experience can help me out. Thanks,