-1

I am trying to run kex --win -s in kali linux in order to get the GUI but I am getting an error message:

Error: unable to connect socket: connection refused(10061)

Can you help

I have tried the following:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

wsl --set-default-version 2

wsl --set-version kali-linux 2

sudo apt install -y kali-win-kex



kex --win -s

Start the vncserver to accept connection from all network address:

vncserver -localhost no

Check the status of the kex again by:

kex --status

It should now list the vnc sessions

Type the following command to start the kali windows:

kex --win -sl

If I run vncserver -localhost no I get the following:

Killing Xtigervnc process ID 29... success!

tail /home/vi/.vnc/Vik.localdomain:5901.log:

Xvnc TigerVNC 1.11.0 - built 2021-03-22 21:21
Copyright (C) 1999-2020 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12010000, The X.Org Foundation


Mon May 24 18:42:53 2021
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0

Mon May 24 18:43:24 2021
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)

vncserver: /usr/bin/Xtigervnc did not start up, please look into '/home/vi/.vnc/Vik.localdomain:5901.log' to determine the reason! -1

Am new to kali linux

2
  • Sorry, are you running Windows (which would account for the .exes) or are you running Kali linux? And the error message explicitly told you to look at /home/vi/.vnc/Vik.localdomain:5901.log; to tell what is wrong, we might need its contents. May 24, 2021 at 18:06
  • Does this answer your question? can't launch kex on wsl2 : error 10061 Apr 13, 2022 at 20:19

3 Answers 3

1

A note for everyone else having this issue: Make sure you have WSL2 and not WSL1! I spent hours trying to figure it out until I realized that I have WSL1.

  • To get WSL 2 follow the instructions on this page.
  • To upgrade an existing WSL1 kali-linux installation, open a Powershell with Administrator rights and type:
    wsl --set-version kali-linux 2
    

Note: Referenced here

0

Try to stop all running distributions and WSL 2 light utility virtual machines.

wsl --shutdown

and login to Win-KeX.

kali
kex

It worked on my computer.

0

I've tried every solution I've found on the Internet so far, but nothing has worked.  My solution: I looked at the status via kex status:

/usr/bin/kex: line 266: tasklist.exe: command not found

Solution was found at Microsoft Docs (also available in Russian).

I've added /mnt/c/Windows/system32 to $PATH.

Also I've created file .wslconfig in my User folder and added these lines:

[wsl2]
localhostForwarding=true

Then I restarted the computer and it worked.

My current $PATH looks like this:

/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games:
/usr/lib/wsl/lib:
/mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath:
/mnt/c/Program Files/Python39/Scripts/:
/mnt/c/Program Files/Python39/:
/mnt/c/Windows/system32:
/mnt/c/Windows:
/mnt/c/Windows/System32/Wbem:
/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:
/mnt/c/Windows/System32/OpenSSH/:
/mnt/c/Program Files/Git/cmd:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .