Skip to content

WSL2? Permissions? Can't find Powershell? I'm not sure what the problem is! #7

@asos-douglaswaugh

Description

@asos-douglaswaugh

Hi! This was working brilliantly for me when I was using WSL1, but I'm trying it in WSL2 and I'm having problems. I know there was a revision for WSL2, but I have that revision in repo I cloned.

If I run

python3 wsl-sudo.py net.exe sessions

I get

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

If I run

sudo python3 wsl-sudo.py net.exe sessions

I get

[sudo] password for douglaswaugh:
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 223, in main
    subprocess.check_call(
  File "/usr/lib/python3.8/subprocess.py", line 359, in check_call
    retcode = call(*popenargs, **kwargs)
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 858, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1704, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'powershell.exe'

But if I invoke powershell in WSL2

powershell.exe

It seems I can access it from Ubuntu, although it's not the cross platform version

Copyright (C) Microsoft Corporation. All rights reserved.

Try the new cross-platform PowerShell https://aka.ms/pscore6

PS Microsoft.PowerShell.Core\FileSystem::\\wsl$\Ubuntu-20.04\home\douglaswaugh\dev>

So it seems I have some sort of permissions issue and some sort of Powershell problem? Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions