View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007586 | Kali Linux | [All Projects] Kali Package Bug | public | 2022-02-16 14:50 | 2023-01-24 20:01 |
Reporter | ShadowXT | Assigned To | re4son | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | assigned | Resolution | open | ||
Product Version | 2022.1 | ||||
Target Version | Fixed in Version | ||||
Summary | 0007586: Using win-kex in WSL kali-linux | ||||
Description | When I use ' kex -- win - s ' as a normal user to experience WSL's Kali desktop experience, the system will always report an error。 The error message is: Error connecting to the KeX server. Please try "kex start" to start the service. If the server fails to start, please try "kex kill" or restart your WSL2 session and try again. At the same time, TigerVNC Viewer will also pop up an error box, and the error message displayed is: Failed to connect to "127.0.0.1:1": unable to connect to socket:Unable to connect because the target computer actively refused(10061) Attempt to reconnect? I've tried many times, but as long as I run this command as root, I won't report such an error and run normally. The following is the message for normal operation ’‘’ sudo kex --win -s Win-KeX server sessions: X DISPLAY # RFB PORT # RFB UNIX PATH PROCESS ID # SERVER 1 5901 7960 (stale) Xtigervnc 2 5902 1426 Xtigervnc You can use the Win-KeX client to connect to any of these displays. ‘’‘ I want to run as a normal user, not as root, how should this be solved? I have tried many methods And I remember that it was normal when I started using this Kex -- win - S. at that time, it was about July 2021. Now it doesn't work | ||||
Steps To Reproduce | Failure process: ┌──(shine㉿Shadow)-[~] └─$ kex --win -s Error connecting to the KeX server. Please try "kex start" to start the service. If the server fails to start, please try "kex kill" or restart your WSL2 session and try again. Failure process: ┌──(shine㉿Shadow)-[~] └─$ sudo kex --win -s Win-KeX server sessions: X DISPLAY # RFB PORT # RFB UNIX PATH PROCESS ID # SERVER 1 5901 7960 (stale) Xtigervnc 2 5902 1426 Xtigervnc You can use the Win-KeX client to connect to any of these displays. | ||||
Additional Information | OS: Kali GNU/Linux Rolling on Windows 10 x86_64 Kernel: 5.10.60.1-microsoft-standard-WSL2 Packages: 3748 (dpkg) Shell: zsh 5.8.1 Theme: Kali-Dark [GTK2/3] Icons: Flat-Remix-Blue-Dark [GTK2/3] Terminal: Windows Terminal CPU: Intel i5-9300H (8) @ 2.400GHz GPU: 4ea2:00:00.0 Microsoft Corporation Device 008e Memory: 662MiB / 3928MiB ┌──(shine㉿Shadow)-[~] └─$ uname -a Linux Shadow 5.10.60.1-microsoft-standard-WSL2 0000001 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 GNU/Linux ┌──(shine㉿Shadow)-[~] └─$ lsb_release -a No LSB modules are available. Distributor ID: Kali Description: Kali GNU/Linux Rolling Release: 2022.1 Codename: kali-rolling | ||||
|
There appears to be a stale session blocking the port. Could you please try running: kex --kill && sudo kex --kill to kill all remnants from earlier sessions and then try again? |
|
I've tried this command, but it still has the same problem ┌──(shine㉿Shadow)-[~] └─$ kex --kill && sudo kex --kill ┌──(shine㉿Shadow)-[~] └─$ kex --win -s 1 ⨯ Error connecting to the KeX server. Please try "kex start" to start the service. If the server fails to start, please try "kex kill" or restart your WSL2 session and try again. |
|
Could you please run "kex --status" and "kex --win --status" and post the output? Many thanks |
|
This is the case when an normal user runs two commands: ┌──(shine㉿Shadow)-[~] └─$ kex --status Kex Server is stopped. Win-KeX SL is stopped. Win-KeX ESM is stopped. '/tmp/.X11-unix' is a Win-KeX socket ┌──(shine㉿Shadow)-[~] └─$ kex --win --status Error connecting to the KeX server. Please try "kex start" to start the service. If the server fails to start, please try "kex kill" or restart your WSL2 session and try again. -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- This is the case when I run two commands after using sudo: ┌──(shine㉿Shadow)-[~] └─$ sudo kex --status KeX Server is running. /usr/bin/kex:行266: tasklist.exe:未找到命令 Win-KeX SL is stopped. Win-KeX ESM is stopped. '/tmp/.X11-unix' is a Win-KeX socket ┌──(shine㉿Shadow)-[~] └─$ sudo kex --win --status Win-KeX server sessions: X DISPLAY # RFB PORT # RFB UNIX PATH PROCESS ID # SERVER 1 5901 7960 (stale) Xtigervnc You can use the Win-KeX client to connect to any of these displays. |
|
I wonder if it's because the Win-Kex socket doesn't have permission to my normal user: This is the file owner I found in the folder where the Win-Kex socket is located: ┌──(shine㉿Shadow)-[/tmp/.X11-unix] └─$ ll 总用量 0 lrwxrwxrwx 1 root root 22 2月 16 20:38 X0 -> /mnt/wslg/.X11-unix/X0 srwxrwxrwx 1 shine shine 0 2月 16 20:40 X10 srwxrwxrwx 1 shine shine 0 2月 16 23:04 X11 Then go to the new folder pointed to by device X0 ┌──(shine㉿Shadow)-[/mnt/wslg] └─$ ll -a drwxrwxrwx 2 root root 60 2月 17 21:26 .X11-unix ┌──(shine㉿Shadow)-[/mnt/wslg/.X11-unix] └─$ ll 总用量 0 srwxrwxrwx 1 shine users 0 2月 17 21:26 X0 The folder name of Win-Kex socket is .X11-UNIX, whose owner is root user, but the owner of X0 file under this folder is normal user. I think the reason may be that my normal user doesn't have access to the folder with root permission, so I can't connect to it by normal user |
|
That's on purpose and not causing it. Does esm mode work for you? |
|
Some additional details + a workaround (which may hopefully lead to finding an actual resolution): https://github.com/microsoft/wslg/issues/782#issuecomment-1196513933 ``` sudo umount /tmp/.X11-unix sudo rm -rf /tmp/.X11-unix sudo ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix ``` It ?appears? kex is not correctly detecting when /tmp/.X11-unix is a mount, that it's a wslg socket, but does when it's a symlink: ``` ┌──(dhoffman㉿mercury)-[~] └─$ ls -lart /tmp total 16 drwxrwxrwx 2 root root 60 Jan 24 14:48 .X11-unix drwxr-xr-x 19 root root 4096 Jan 24 14:48 .. drwxrwxrwt 3 root root 12288 Jan 24 14:48 . ┌──(dhoffman㉿mercury)-[~] └─$ mount | grep .X11 none on /tmp/.X11-unix type tmpfs (ro,relatime) ┌──(dhoffman㉿mercury)-[~] └─$ kex --status Kex Server is stopped. Win-KeX SL is stopped. Win-KeX ESM is stopped. '/tmp/.X11-unix' is a Win-KeX socket <<<<<<<<<<<<<<<<<< ┌──(dhoffman㉿mercury)-[~] └─$ ls -i /tmp/.X11-unix/X0 14 /tmp/.X11-unix/X0 {{{{{{{{{{{{{{{{{{{{{ ┌──(dhoffman㉿mercury)-[~] └─$ ls -i /mnt/wslg/.X11-unix/X0 14 /mnt/wslg/.X11-unix/X0 {{{{{{{{{{{{{{{{{{{{{ ┌──(dhoffman㉿mercury)-[~] └─$ sudo umount /tmp/.X11-unix sudo rm -rf /tmp/.X11-unix sudo ln -s /mnt/wslg/.X11-unix /tmp/.X11-unix ┌──(dhoffman㉿mercury)-[~] └─$ ls -lart /tmp total 16 drwxr-xr-x 19 root root 4096 Jan 24 14:48 .. lrwxrwxrwx 1 root root 19 Jan 24 14:51 .X11-unix -> /mnt/wslg/.X11-unix drwxrwxrwt 2 root root 12288 Jan 24 14:51 . ┌──(dhoffman㉿mercury)-[~] └─$ ls -i /tmp/.X11-unix/X0 14 /tmp/.X11-unix/X0 {{{{{{{{{{{{{{{{{{{{{ ┌──(dhoffman㉿mercury)-[~] └─$ kex --status Kex Server is stopped. Win-KeX SL is stopped. Win-KeX ESM is stopped. '/tmp/.X11-unix' is a WSLg socket <<<<<<<<<<<<<<<<<< ``` After that kex will move it/back it up automatically when starting up, and will work fine. ``` ┌──(dhoffman㉿mercury)-[~] └─$ kex A WSLg socket exists that prevent KeX from starting. Moving the socket now. This will not adversely affect WSL or KeX. Win-KeX server sessions: X DISPLAY # RFB PORT # RFB UNIX PATH PROCESS ID # SERVER 1 5901 1506 Xtigervnc You can use the Win-KeX client to connect to any of these displays. ┌──(dhoffman㉿mercury)-[~] └─$ ls -lart /tmp total 36 drwxr-xr-x 19 root root 4096 Jan 24 14:48 .. lrwxrwxrwx 1 root root 19 Jan 24 14:57 .X11-unix.bak -> /mnt/wslg/.X11-unix drwx------ 2 dhoffman dhoffman 4096 Jan 24 14:58 tigervnc.KqNxIn -r--r--r-- 1 dhoffman dhoffman 11 Jan 24 14:58 .X1-lock drwxrwxrwt 2 root root 4096 Jan 24 14:58 .X11-unix srwxrwxrwx 1 dhoffman dhoffman 0 Jan 24 14:58 dbus-hVvk4qweDU -rw------- 1 dhoffman dhoffman 410 Jan 24 14:58 .xfsm-ICE-U21PZ1 drwxrwxrwt 2 dhoffman dhoffman 4096 Jan 24 14:58 .ICE-unix drwxrwxrwt 5 root root 12288 Jan 24 14:58 . ┌──(dhoffman㉿mercury)-[~] └─$ ls -lart /tmp/.X11-unix total 16 lrwxrwxrwx 1 root root 22 Jan 24 14:58 X0 -> /mnt/wslg/.X11-unix/X0 srwxrwxrwx 1 dhoffman dhoffman 0 Jan 24 14:58 X1 drwxrwxrwt 2 root root 4096 Jan 24 14:58 . drwxrwxrwt 5 root root 12288 Jan 24 14:58 .. ``` You can restore it after if you really need to: ``` ┌──(dhoffman㉿mercury)-[~] └─$ ls -lart /tmp total 20 drwxr-xr-x 19 root root 4096 Jan 24 14:48 .. lrwxrwxrwx 1 root root 19 Jan 24 14:57 .X11-unix.bak -> /mnt/wslg/.X11-unix drwxrwxrwt 2 dhoffman dhoffman 4096 Jan 24 14:58 .ICE-unix lrwxrwxrwx 1 root root 19 Jan 24 15:00 .X11-unix -> /mnt/wslg/.X11-unix drwxrwxrwt 3 root root 12288 Jan 24 15:00 . ``` |
Date Modified | Username | Field | Change |
---|---|---|---|
2022-02-16 14:50 | ShadowXT | New Issue | |
2022-02-17 03:48 | re4son | Note Added: 0015758 | |
2022-02-17 03:51 | re4son | Note Edited: 0015758 | View Revisions |
2022-02-17 05:33 | ShadowXT | Note Added: 0015759 | |
2022-02-17 07:15 | re4son | Note Added: 0015760 | |
2022-02-17 13:32 | ShadowXT | Note Added: 0015761 | |
2022-02-17 14:38 | ShadowXT | Note Added: 0015763 | |
2022-03-25 13:57 | g0tmi1k | Severity | major => feature |
2022-03-25 13:58 | g0tmi1k | Severity | feature => minor |
2022-03-30 15:58 | steev | Assigned To | => steev |
2022-03-30 15:58 | steev | Status | new => assigned |
2022-03-30 15:59 | steev | Assigned To | steev => re4son |
2022-08-21 04:23 | re4son | Note Added: 0016626 | |
2023-01-24 20:01 | vtcifer | Note Added: 0017427 |