Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL2 Kali not work: 13:30:38.521676 ERROR: Exception information: FileNotFoundError: [Errno 2] No such file or directory: 'certutil.exe' #63

Open
Alan3344 opened this issue Oct 29, 2024 · 2 comments

Comments

@Alan3344
Copy link

Pulgins version: MySQL Shell for VS Code 1.16.4+9.0.1 Preview

Freshly installed Kali Linux in WSL2

┌──(kali㉿DESKTOP-JMN88CV)-[~/wwwroot]
└─$ uname -a
Linux DESKTOP-JMN88CV 5.15.153.1-microsoft-standard-WSL2 #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 GNU/Linux

About vscode:

Version: 1.94.2 (system setup)
Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
Date: 2024-10-09T16:08:44.566Z
Electron: 30.5.1
ElectronBuildId: 10262041
Chromium: 124.0.6367.243
Node.js: 20.16.0
V8: 12.4.254.20-electron.0
OS: Windows_NT x64 10.0.19045
MySQL Shell for VS Code error detail
Running on a ssh-remote VS Code session.
Starting embedded MySQL Shell, using config dir '/home/kali/.mysqlsh-gui' ...
Please enter the single instance token: 
13:27:41.196550 INFO: Token read from STDIN
13:27:41.196589 INFO: Starting MySQL Shell GUI web server...

13:27:41.196665 INFO: 	Checking web server certificate...

13:27:41.198370 ERROR: Exception information:
Traceback (most recent call last):
-  File "/home/kali/.vscode-server/extensions/oracle.mysql-shell-for-vs-code-1.16.4/shell/lib/mysqlsh/plugins/gui_plugin/core/lib/certs/locations.py", line 721, in _get_installed_certs
-    exit_code, output = lib.run_shell_cmd(cmd)
-                        ^^^^^^^^^^^^^^^^^^^^^^
-  File "/home/kali/.vscode-server/extensions/oracle.mysql-shell-for-vs-code-1.16.4/shell/lib/mysqlsh/plugins/gui_plugin/core/lib/SystemUtils.py", line 158, in run_shell_cmd
-    stream = popen(cmd, cwd=cwd)
-             ^^^^^^^^^^^^^^^^^^^
-  File "/home/kali/.vscode-server/extensions/oracle.mysql-shell-for-vs-code-1.16.4/shell/lib/mysqlsh/plugins/gui_plugin/core/lib/SystemUtils.py", line 187, in popen
-    proc = subprocess.Popen(cmd,
-           ^^^^^^^^^^^^^^^^^^^^^
-  File "/home/kali/.vscode-server/extensions/oracle.mysql-shell-for-vs-code-1.16.4/shell/lib/mysqlsh/lib/python3.12/subprocess.py", line 1026, in __init__
-    self._execute_child(args, executable, preexec_fn, close_fds,
-  File "/home/kali/.vscode-server/extensions/oracle.mysql-shell-for-vs-code-1.16.4/shell/lib/mysqlsh/lib/python3.12/subprocess.py", line 1953, in _execute_child
-    raise child_exception_type(errno_num, err_msg, err_filename)
-FileNotFoundError: [Errno 2] No such file or directory: 'certutil.exe'

13:27:41.198432 INFO: The installed certificate has errors: The certificate is not installed at WIN Certificate Store

13:27:41.198456 INFO: 	Certificate is not installed. Use gui.core.installShellWebCertificate() to install one.

Starting embedded MySQL Shell, using config dir '/home/kali/.mysqlsh-gui' ...
13:27:54.159543 ERROR: Exception information:
FileNotFoundError: [Errno 2] No such file or directory: 'certutil.exe'

13:27:54.490374 ERROR: Exception information:
FileNotFoundError: [Errno 2] No such file or directory: 'certutil.exe'

13:27:54.491105 ERROR: Exception information:
FileNotFoundError: [Errno 2] No such file or directory: 'certutil.exe'
true

image

@Alan3344 Alan3344 changed the title WSL kali not work: 13:30:38.521676 ERROR: Exception information: FileNotFoundError: [Errno 2] No such file or directory: 'certutil.exe' WSL2 Kali not work: 13:30:38.521676 ERROR: Exception information: FileNotFoundError: [Errno 2] No such file or directory: 'certutil.exe' Oct 29, 2024
@jolsen-mitsu
Copy link

I get the same error using WSL2 Ubuntu.

I wonder if the extension is getting confused because VSC is running on Windows. That is, if the extension detects it is running on Windows (host) and assuming that the install in WSL is also Windows (vs checking the WSL OS type and acting accordingly)

@jolsen-mitsu
Copy link

There are at least two issues I've found doing a quick scan of code:

  1. At least on my system, python -m platform 'print(platform.system())' returns Linux-5.15.167.4-microsoft-standard-WSL2-x86_64-with-glibc2.39 and the code in Start.py is expecting the short, simple string of Linux. Perhaps all instances of this OS check should be changed as follows:
# from
if platform.system() == "Linux":
# to 
if platform.system().startswith("Linux"):
  1. In SystemUtils.py this if should maybe be changed in as similar way:
# from
if type == "Linux":
# to 
if type.startswith("Linux"):

There may be more appropriate ways to detect the OS, but this is one way to modify the code.

Once I made these changes and restarted VS Code and tried to run the Welcome Wizard, it finally popped up the certificate installation window and installed the certificate after answering the prompts.

A potential temporary workaround is to go to extension settings and turn off "Enforce HTTPS" until these bugs are fixed. I looked at trying to make a PR but it looks like a multi-step process just to get to the point of making a PR, let alone actually submitting it. Hopefully they'll give me credit in the changelog anyway.

As an overall code comment, IMO, all of the various system detection statements should be standardized in a single function vs repeated several times in code, so fixes like this only need to happen in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants