# recreate the WSL2 scenario by having the parent shell contain 'Relay(NNN)'.
# This could be done various ways, but the easiest is to create a script named
# /tmp/Relay(230) to launch ufw:
$ cat <<EOM > "/tmp/Relay(230)"
#!/bin/bash
sudo ufw enable
EOM
$ chmod 755 "/tmp/Relay(230)"
# before the update
$ "/tmp/Relay(230)"
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)
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 434, in under_ssh
raise ValueError(err_msg)
ValueError: Couldn't find parent pid for '1294'
# after the update
$ cat <<EOF | sudo tee /etc/apt/sources.list.d/ubuntu-$(lsb_release -cs)-proposed.list
# Enable Ubuntu proposed archive
deb http://archive.ubuntu.com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe
EOF
# Enable Ubuntu proposed archive
deb http://archive.ubuntu.com/ubuntu/ jammy-proposed restricted main multiverse universe
Note that autopkg tests for ufw test various aspects of normal ufw usage, including ufw enable. I also performed the testing for this issue on jammy:
$ apt-cache policy ufw archive. ubuntu. com/ubuntu jammy/main amd64 Packages dpkg/status
ufw:
Installed: 0.36.1-4build1
Candidate: 0.36.1-4build1
Version table:
*** 0.36.1-4build1 500
500 http://
100 /var/lib/
# recreate the WSL2 scenario by having the parent shell contain 'Relay(NNN)'.
# This could be done various ways, but the easiest is to create a script named
# /tmp/Relay(230) to launch ufw:
$ cat <<EOM > "/tmp/Relay(230)"
#!/bin/bash
sudo ufw enable
EOM
$ chmod 755 "/tmp/Relay(230)"
# before the update python3/ dist-packages/ ufw/util. py", line 427, in under_ssh python3/ dist-packages/ ufw/util. py", line 419, in get_ppid .readlines( )[0].split( ')')[1] .split( )[1]
$ "/tmp/Relay(230)"
Traceback (most recent call last):
File "/usr/lib/
ppid = get_ppid(pid)
File "/usr/lib/
ppid = open(name)
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last): under_ssh( ): python3/ dist-packages/ ufw/frontend. py", line 901, in continue_under_ssh do_checks and ufw.util. under_ssh( ): # pragma: no cover python3/ dist-packages/ ufw/util. py", line 457, in under_ssh python3/ dist-packages/ ufw/util. py", line 457, in under_ssh python3/ dist-packages/ ufw/util. py", line 457, in under_ssh python3/ dist-packages/ ufw/util. py", line 434, in under_ssh
File "/usr/sbin/ufw", line 138, in <module>
not ui.continue_
File "/usr/lib/
if self.backend.
File "/usr/lib/
return under_ssh(ppid)
File "/usr/lib/
return under_ssh(ppid)
File "/usr/lib/
return under_ssh(ppid)
File "/usr/lib/
raise ValueError(err_msg)
ValueError: Couldn't find parent pid for '1294'
# after the update
$ cat <<EOF | sudo tee /etc/apt/ sources. list.d/ ubuntu- $(lsb_release -cs)-proposed.list archive. ubuntu. com/ubuntu/ $(lsb_release -cs)-proposed restricted main multiverse universe archive. ubuntu. com/ubuntu/ jammy-proposed restricted main multiverse universe
# Enable Ubuntu proposed archive
deb http://
EOF
# Enable Ubuntu proposed archive
deb http://
$ sudo apt-get update && sudo apt-get install ufw/jammy-proposed
...
Setting up ufw (0.36.1-4ubuntu0.1) ...
# it now doesn't traceback
$ "/tmp/Relay(230)"
Command may disrupt existing ssh connections. Proceed with operation (y|n)? n
$