wsl-sudo icon indicating copy to clipboard operation
wsl-sudo copied to clipboard

socket.timeout: timed out when attempting to run any command with wsl-sudo in WSL2

Open lanouettea opened this issue 3 years ago • 6 comments

I'm running WSL2 Ubuntu 20.04 on Windows 11. This is a fresh WSL2 installation with barely nothing else installed.

I did a fresh checkout of the current master, which should have #2 merged in. When I run the script, using any command as argument, I get a timeout with the following stack trace:

python3 wsl-sudo.py net.exe 
Traceback (most recent call last):
  File "wsl-sudo.py", line 335, in <module>
    main()
  File "wsl-sudo.py", line 331, in main
    UnprivilegedClient().main(**vars(args))
  File "wsl-sudo.py", line 236, in main
    self.sock, acc = listen_socket.accept()
  File "/usr/lib/python3.8/socket.py", line 292, in accept
    fd, addr = self._accept()
socket.timeout: timed out

Any clues as what might be causing this?

lanouettea avatar Aug 17 '21 00:08 lanouettea

I think your current user is not admin. I have the same problem when elevating from non-admin user...

highTowerSU avatar Sep 13 '21 11:09 highTowerSU

@highTowerSU, when you say current user, do you mean the Linux user or the Windows user? I seem to be having a similar problem.

asos-douglaswaugh avatar May 17 '22 15:05 asos-douglaswaugh

I think of was the underlying Win User, but i am unsere...

highTowerSU avatar May 19 '22 09:05 highTowerSU

The error occurs when you run wsl-sudo.py from a non-default WSL instance. Does it work with this version? Here's an example that works for me:

python wsl-sudo.py "/mnt/c/Program Files (x86)/Vim/vim82/gvim.exe"

(I know vim 9 is out.)

fenjen avatar Dec 21 '23 15:12 fenjen

I have the same issue on WSL2 Ubuntu (22.04). I tried applying the changes from this PR that @fenjen mentioned in their comment, but it did not help. Another thing to mention is that my Windows OS has multiple users and the default one is not an Administrator, so when I try to run the python3 ... command, the login window pops up. Maybe that ahs something to do with this issue.

spector32 avatar May 12 '24 00:05 spector32

@spector32 Is the user running the WSL instance an administrator? If not, the login window that pops up (with a pre-filled administrator account asking for a password) is what I would expect.

fenjen avatar May 13 '24 09:05 fenjen