ThePorgs / Exegol

Fully featured and community-driven hacking environment
https://exegol.readthedocs.io/
GNU General Public License v3.0
1.95k stars 191 forks source link

WSL2 "Exec format error" when running 'cmd.exe' #191

Closed KayZ-Safeit closed 11 months ago

KayZ-Safeit commented 1 year ago

Describe the bug

│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolController.py:59 in main       │
│                                                                                                  │
│   56 │   │   # Set logger verbosity depending on user input                                      │
│   57 │   │   ExeLog.setVerbosity(ParametersManager().verbosity, ParametersManager().quiet)       │
│   58 │   │   # Start Main controller & Executing action selected by user CLI                     │
│ ❱ 59 │   │   ExegolController.call_action()                                                      │
│   60 │   except KeyboardInterrupt:                                                               │
│   61 │   │   logger.empty_line()                                                                 │
│   62 │   │   logger.info("Exiting")                                                              │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolController.py:39 in            │
│ call_action                                                                                      │
│                                                                                                  │
│   36 │   │   │   # Fetch main operation function                                                 │
│   37 │   │   │   main_action = cls.__action()                                                    │
│   38 │   │   │   # Execute main function                                                         │
│ ❱ 39 │   │   │   main_action()                                                                   │
│   40 │   │   else:                                                                               │
│   41 │   │   │   # TODO review required parameters                                               │
│   42 │   │   │   logger.error(f"These parameters are mandatory but missing: {','.join(missing    │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │            cls = <class 'exegol.manager.ExegolController.ExegolController'>                  │ │
│ │    main_action = <bound method ExegolManager.install of <class                               │ │
│ │                  'exegol.manager.ExegolManager.ExegolManager'>>                              │ │
│ │ missing_params = []                                                                          │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolManager.py:127 in install      │
│                                                                                                  │
│   124 │   @classmethod                                                                           │
│   125 │   def install(cls):                                                                      │
│   126 │   │   """Pull or build a docker exegol image"""                                          │
│ ❱ 127 │   │   ExegolManager.print_version()                                                      │
│   128 │   │   try:                                                                               │
│   129 │   │   │   if not ExegolModules().isExegolResourcesReady():                               │
│   130 │   │   │   │   raise CancelOperation                                                      │
│                                                                                                  │
│ ╭────────────────────────── locals ──────────────────────────╮                                   │
│ │ cls = <class 'exegol.manager.ExegolManager.ExegolManager'> │                                   │
│ ╰────────────────────────────────────────────────────────────╯                                   │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolManager.py:220 in              │
│ print_version                                                                                    │
│                                                                                                  │
│   217 │   │   if EnvInfo.arch != EnvInfo.raw_arch:                                               │
│   218 │   │   │   logger.debug(f"Raw arch: {EnvInfo.raw_arch}")                                  │
│   219 │   │   if EnvInfo.isWindowsHost():                                                        │
│ ❱ 220 │   │   │   logger.debug(f"Windows release: {EnvInfo.getWindowsRelease()}")                │
│   221 │   │   │   logger.debug(f"Python environment: {EnvInfo.current_platform}")                │
│   222 │   │   │   logger.debug(f"Docker engine: {str(EnvInfo.getDockerEngine()).upper()}")       │
│   223 │   │   logger.debug(f"Docker desktop: {boolFormatter(EnvInfo.isDockerDesktop())}")        │
│                                                                                                  │
│ ╭────────────────────────── locals ──────────────────────────╮                                   │
│ │ cls = <class 'exegol.manager.ExegolManager.ExegolManager'> │                                   │
│ ╰────────────────────────────────────────────────────────────╯                                   │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/config/EnvInfo.py:122 in getWindowsRelease   │
│                                                                                                  │
│   119 │   │   │   │   # Find version using MS-DOS command 'ver'                                  │
│   120 │   │   │   │   if not shutil.which("cmd.exe"):                                            │
│   121 │   │   │   │   │   logger.critical("cmd.exe is not accessible from your WSL environment   │
│ ❱ 122 │   │   │   │   proc = subprocess.Popen(["cmd.exe", "/c", "ver"], stdout=subprocess.PIPE   │
│   123 │   │   │   │   proc.wait()                                                                │
│   124 │   │   │   │   assert proc.stdout is not None                                             │
│   125 │   │   │   │   # Try to match Windows version                                             │
│                                                                                                  │
│ ╭─────────────────── locals ────────────────────╮                                                │
│ │ cls = <class 'exegol.config.EnvInfo.EnvInfo'> │                                                │
│ ╰───────────────────────────────────────────────╯                                                │
│                                                                                                  │
│ /usr/lib/python3.11/subprocess.py:1024 in __init__                                               │
│                                                                                                  │
│   1021 │   │   │   │   │   self.stderr = io.TextIOWrapper(self.stderr,                           │
│   1022 │   │   │   │   │   │   │   encoding=encoding, errors=errors)                             │
│   1023 │   │   │                                                                                 │
│ ❱ 1024 │   │   │   self._execute_child(args, executable, preexec_fn, close_fds,                  │
│   1025 │   │   │   │   │   │   │   │   pass_fds, cwd, env,                                       │
│   1026 │   │   │   │   │   │   │   │   startupinfo, creationflags, shell,                        │
│   1027 │   │   │   │   │   │   │   │   p2cread, p2cwrite,                                        │
│                                                                                                  │
│ ╭─────────────────────────────────── locals ───────────────────────────────────╮                 │
│ │               args = ['cmd.exe', '/c', 'ver']                                │                 │
│ │            bufsize = -1                                                      │                 │
│ │            c2pread = 5                                                       │                 │
│ │           c2pwrite = 6                                                       │                 │
│ │          close_fds = True                                                    │                 │
│ │      creationflags = 0                                                       │                 │
│ │                cwd = None                                                    │                 │
│ │           encoding = None                                                    │                 │
│ │                env = None                                                    │                 │
│ │             errors = None                                                    │                 │
│ │            errread = -1                                                      │                 │
│ │           errwrite = 7                                                       │                 │
│ │         executable = None                                                    │                 │
│ │       extra_groups = None                                                    │                 │
│ │                  f = <_io.BufferedReader name=5>                             │                 │
│ │                gid = None                                                    │                 │
│ │               gids = None                                                    │                 │
│ │              group = None                                                    │                 │
│ │            p2cread = -1                                                      │                 │
│ │           p2cwrite = -1                                                      │                 │
│ │           pass_fds = ()                                                      │                 │
│ │           pipesize = -1                                                      │                 │
│ │         preexec_fn = None                                                    │                 │
│ │      process_group = -1                                                      │                 │
│ │    restore_signals = True                                                    │                 │
│ │               self = <Popen: returncode: 255 args: ['cmd.exe', '/c', 'ver']> │                 │
│ │              shell = False                                                   │                 │
│ │  start_new_session = False                                                   │                 │
│ │        startupinfo = None                                                    │                 │
│ │             stderr = -3                                                      │                 │
│ │              stdin = None                                                    │                 │
│ │             stdout = -1                                                      │                 │
│ │               text = None                                                    │                 │
│ │                uid = None                                                    │                 │
│ │              umask = -1                                                      │                 │
│ │ universal_newlines = None                                                    │                 │
│ │               user = None                                                    │                 │
│ ╰──────────────────────────────────────────────────────────────────────────────╯                 │
│                                                                                                  │
│ /usr/lib/python3.11/subprocess.py:1901 in _execute_child                                         │
│                                                                                                  │
│   1898 │   │   │   │   │   │   err_filename = orig_executable                                    │
│   1899 │   │   │   │   │   if errno_num != 0:                                                    │
│   1900 │   │   │   │   │   │   err_msg = os.strerror(errno_num)                                  │
│ ❱ 1901 │   │   │   │   │   raise child_exception_type(errno_num, err_msg, err_filename)          │
│   1902 │   │   │   │   raise child_exception_type(err_msg)                                       │
│   1903                                                                                           │
│   1904                                                                                           │
│                                                                                                  │
│ ╭───────────────────────────────────── locals ──────────────────────────────────────╮            │
│ │                    args = ['cmd.exe', '/c', 'ver']                                │            │
│ │                 c2pread = 5                                                       │            │
│ │                c2pwrite = 6                                                       │            │
│ │    child_exception_type = <class 'OSError'>                                       │            │
│ │ child_exec_never_called = False                                                   │            │
│ │               close_fds = True                                                    │            │
│ │           creationflags = 0                                                       │            │
│ │                     cwd = None                                                    │            │
│ │                     env = None                                                    │            │
│ │                env_list = None                                                    │            │
│ │            err_filename = 'cmd.exe'                                               │            │
│ │                 err_msg = 'Exec format error'                                     │            │
│ │               errno_num = 8                                                       │            │
│ │            errpipe_data = bytearray(b'OSError:8:')                                │            │
│ │            errpipe_read = 8                                                       │            │
│ │           errpipe_write = 9                                                       │            │
│ │                 errread = -1                                                      │            │
│ │                errwrite = 7                                                       │            │
│ │          exception_name = bytearray(b'OSError')                                   │            │
│ │              executable = b'cmd.exe'                                              │            │
│ │         executable_list = (                                                       │            │
│ │                           │   b'/home/jt/.local/bin/cmd.exe',                     │            │
│ │                           │   b'/home/jt/.local/bin/cmd.exe',                     │            │
│ │                           │   b'/usr/local/sbin/cmd.exe',                         │            │
│ │                           │   b'/usr/local/bin/cmd.exe',                          │            │
│ │                           │   b'/usr/sbin/cmd.exe',                               │            │
│ │                           │   b'/usr/bin/cmd.exe',                                │            │
│ │                           │   b'/sbin/cmd.exe',                                   │            │
│ │                           │   b'/bin/cmd.exe',                                    │            │
│ │                           │   b'/usr/games/cmd.exe',                              │            │
│ │                           │   b'/usr/local/games/cmd.exe',                        │            │
│ │                           │   ... +17                                             │            │
│ │                           )                                                       │            │
│ │             fds_to_keep = {9}                                                     │            │
│ │                     gid = None                                                    │            │
│ │                    gids = None                                                    │            │
│ │               hex_errno = bytearray(b'8')                                         │            │
│ │        low_fds_to_close = []                                                      │            │
│ │         orig_executable = 'cmd.exe'                                               │            │
│ │                 p2cread = -1                                                      │            │
│ │                p2cwrite = -1                                                      │            │
│ │                    part = b''                                                     │            │
│ │                pass_fds = ()                                                      │            │
│ │                     pid = 462                                                     │            │
│ │              preexec_fn = None                                                    │            │
│ │           process_group = -1                                                      │            │
│ │         restore_signals = True                                                    │            │
│ │                    self = <Popen: returncode: 255 args: ['cmd.exe', '/c', 'ver']> │            │
│ │                   shell = False                                                   │            │
│ │       start_new_session = False                                                   │            │
│ │             startupinfo = None                                                    │            │
│ │                     sts = 65280                                                   │            │
│ │                     uid = None                                                    │            │
│ │                   umask = -1                                                      │            │
│ ╰───────────────────────────────────────────────────────────────────────────────────╯            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: [Errno 8] Exec format error: 'cmd.exe' ```

### Steps To Reproduce

Install WSL 2
Installed python3 ; pip3 ; git ; docker on windows client and based on WSL 2 + WSL2 integration

### Exegol Wrapper Version

```Text
can't run it

Host OS

Windows 10 and before

Configuration of the concerned container

No response

Execution logs in debug mode

jt@DESKTOP-EUI8PI0:~$ exegol install -vvv
[D] Running install module
[*] Exegol is currently in version v4.2.5
[*] Exegol Discord serv.: https://discord.gg/cXThyp7D6P
[*] Exegol documentation: https://exegol.rtfd.io/
[+] We thank Capgemini for supporting the project (helping with dev) 🙏
[+] We thank HackTheBox for sponsoring the multi-arch support 💚
[D] Pip installation: On ✔
[D] Git source installation: Off 🪓
[D] Host OS: HostOs.WINDOWS (DockerEngine.WLS2)
[D] Arch: amd64
[D] Raw arch: x86_64
[-] It seems that something unexpected happened ...
[-] To draw our attention to the problem and allow us to fix it, you can share your error with us (by copying and pasting it with this syntax:  <error> ```) by creating a GitHub issue at this address:
https://github.com/ThePorgs/Exegol/issues
[+] Thank you for your collaboration!
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolController.py:59 in main       │
│                                                                                                  │
│   56 │   │   # Set logger verbosity depending on user input                                      │
│   57 │   │   ExeLog.setVerbosity(ParametersManager().verbosity, ParametersManager().quiet)       │
│   58 │   │   # Start Main controller & Executing action selected by user CLI                     │
│ ❱ 59 │   │   ExegolController.call_action()                                                      │
│   60 │   except KeyboardInterrupt:                                                               │
│   61 │   │   logger.empty_line()                                                                 │
│   62 │   │   logger.info("Exiting")                                                              │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolController.py:39 in            │
│ call_action                                                                                      │
│                                                                                                  │
│   36 │   │   │   # Fetch main operation function                                                 │
│   37 │   │   │   main_action = cls.__action()                                                    │
│   38 │   │   │   # Execute main function                                                         │
│ ❱ 39 │   │   │   main_action()                                                                   │
│   40 │   │   else:                                                                               │
│   41 │   │   │   # TODO review required parameters                                               │
│   42 │   │   │   logger.error(f"These parameters are mandatory but missing: {','.join(missing    │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │            cls = <class 'exegol.manager.ExegolController.ExegolController'>                  │ │
│ │    main_action = <bound method ExegolManager.install of <class                               │ │
│ │                  'exegol.manager.ExegolManager.ExegolManager'>>                              │ │
│ │ missing_params = []                                                                          │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolManager.py:127 in install      │
│                                                                                                  │
│   124 │   @classmethod                                                                           │
│   125 │   def install(cls):                                                                      │
│   126 │   │   """Pull or build a docker exegol image"""                                          │
│ ❱ 127 │   │   ExegolManager.print_version()                                                      │
│   128 │   │   try:                                                                               │
│   129 │   │   │   if not ExegolModules().isExegolResourcesReady():                               │
│   130 │   │   │   │   raise CancelOperation                                                      │
│                                                                                                  │
│ ╭────────────────────────── locals ──────────────────────────╮                                   │
│ │ cls = <class 'exegol.manager.ExegolManager.ExegolManager'> │                                   │
│ ╰────────────────────────────────────────────────────────────╯                                   │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/manager/ExegolManager.py:220 in              │
│ print_version                                                                                    │
│                                                                                                  │
│   217 │   │   if EnvInfo.arch != EnvInfo.raw_arch:                                               │
│   218 │   │   │   logger.debug(f"Raw arch: {EnvInfo.raw_arch}")                                  │
│   219 │   │   if EnvInfo.isWindowsHost():                                                        │
│ ❱ 220 │   │   │   logger.debug(f"Windows release: {EnvInfo.getWindowsRelease()}")                │
│   221 │   │   │   logger.debug(f"Python environment: {EnvInfo.current_platform}")                │
│   222 │   │   │   logger.debug(f"Docker engine: {str(EnvInfo.getDockerEngine()).upper()}")       │
│   223 │   │   logger.debug(f"Docker desktop: {boolFormatter(EnvInfo.isDockerDesktop())}")        │
│                                                                                                  │
│ ╭────────────────────────── locals ──────────────────────────╮                                   │
│ │ cls = <class 'exegol.manager.ExegolManager.ExegolManager'> │                                   │
│ ╰────────────────────────────────────────────────────────────╯                                   │
│                                                                                                  │
│ /home/jt/.local/lib/python3.11/site-packages/exegol/config/EnvInfo.py:122 in getWindowsRelease   │
│                                                                                                  │
│   119 │   │   │   │   # Find version using MS-DOS command 'ver'                                  │
│   120 │   │   │   │   if not shutil.which("cmd.exe"):                                            │
│   121 │   │   │   │   │   logger.critical("cmd.exe is not accessible from your WSL environment   │
│ ❱ 122 │   │   │   │   proc = subprocess.Popen(["cmd.exe", "/c", "ver"], stdout=subprocess.PIPE   │
│   123 │   │   │   │   proc.wait()                                                                │
│   124 │   │   │   │   assert proc.stdout is not None                                             │
│   125 │   │   │   │   # Try to match Windows version                                             │
│                                                                                                  │
│ ╭─────────────────── locals ────────────────────╮                                                │
│ │ cls = <class 'exegol.config.EnvInfo.EnvInfo'> │                                                │
│ ╰───────────────────────────────────────────────╯                                                │
│                                                                                                  │
│ /usr/lib/python3.11/subprocess.py:1024 in __init__                                               │
│                                                                                                  │
│   1021 │   │   │   │   │   self.stderr = io.TextIOWrapper(self.stderr,                           │
│   1022 │   │   │   │   │   │   │   encoding=encoding, errors=errors)                             │
│   1023 │   │   │                                                                                 │
│ ❱ 1024 │   │   │   self._execute_child(args, executable, preexec_fn, close_fds,                  │
│   1025 │   │   │   │   │   │   │   │   pass_fds, cwd, env,                                       │
│   1026 │   │   │   │   │   │   │   │   startupinfo, creationflags, shell,                        │
│   1027 │   │   │   │   │   │   │   │   p2cread, p2cwrite,                                        │
│                                                                                                  │
│ ╭─────────────────────────────────── locals ───────────────────────────────────╮                 │
│ │               args = ['cmd.exe', '/c', 'ver']                                │                 │
│ │            bufsize = -1                                                      │                 │
│ │            c2pread = 5                                                       │                 │
│ │           c2pwrite = 6                                                       │                 │
│ │          close_fds = True                                                    │                 │
│ │      creationflags = 0                                                       │                 │
│ │                cwd = None                                                    │                 │
│ │           encoding = None                                                    │                 │
│ │                env = None                                                    │                 │
│ │             errors = None                                                    │                 │
│ │            errread = -1                                                      │                 │
│ │           errwrite = 7                                                       │                 │
│ │         executable = None                                                    │                 │
│ │       extra_groups = None                                                    │                 │
│ │                  f = <_io.BufferedReader name=5>                             │                 │
│ │                gid = None                                                    │                 │
│ │               gids = None                                                    │                 │
│ │              group = None                                                    │                 │
│ │            p2cread = -1                                                      │                 │
│ │           p2cwrite = -1                                                      │                 │
│ │           pass_fds = ()                                                      │                 │
│ │           pipesize = -1                                                      │                 │
│ │         preexec_fn = None                                                    │                 │
│ │      process_group = -1                                                      │                 │
│ │    restore_signals = True                                                    │                 │
│ │               self = <Popen: returncode: 255 args: ['cmd.exe', '/c', 'ver']> │                 │
│ │              shell = False                                                   │                 │
│ │  start_new_session = False                                                   │                 │
│ │        startupinfo = None                                                    │                 │
│ │             stderr = -3                                                      │                 │
│ │              stdin = None                                                    │                 │
│ │             stdout = -1                                                      │                 │
│ │               text = None                                                    │                 │
│ │                uid = None                                                    │                 │
│ │              umask = -1                                                      │                 │
│ │ universal_newlines = None                                                    │                 │
│ │               user = None                                                    │                 │
│ ╰──────────────────────────────────────────────────────────────────────────────╯                 │
│                                                                                                  │
│ /usr/lib/python3.11/subprocess.py:1901 in _execute_child                                         │
│                                                                                                  │
│   1898 │   │   │   │   │   │   err_filename = orig_executable                                    │
│   1899 │   │   │   │   │   if errno_num != 0:                                                    │
│   1900 │   │   │   │   │   │   err_msg = os.strerror(errno_num)                                  │
│ ❱ 1901 │   │   │   │   │   raise child_exception_type(errno_num, err_msg, err_filename)          │
│   1902 │   │   │   │   raise child_exception_type(err_msg)                                       │
│   1903                                                                                           │
│   1904                                                                                           │
│                                                                                                  │
│ ╭───────────────────────────────────── locals ──────────────────────────────────────╮            │
│ │                    args = ['cmd.exe', '/c', 'ver']                                │            │
│ │                 c2pread = 5                                                       │            │
│ │                c2pwrite = 6                                                       │            │
│ │    child_exception_type = <class 'OSError'>                                       │            │
│ │ child_exec_never_called = False                                                   │            │
│ │               close_fds = True                                                    │            │
│ │           creationflags = 0                                                       │            │
│ │                     cwd = None                                                    │            │
│ │                     env = None                                                    │            │
│ │                env_list = None                                                    │            │
│ │            err_filename = 'cmd.exe'                                               │            │
│ │                 err_msg = 'Exec format error'                                     │            │
│ │               errno_num = 8                                                       │            │
│ │            errpipe_data = bytearray(b'OSError:8:')                                │            │
│ │            errpipe_read = 8                                                       │            │
│ │           errpipe_write = 9                                                       │            │
│ │                 errread = -1                                                      │            │
│ │                errwrite = 7                                                       │            │
│ │          exception_name = bytearray(b'OSError')                                   │            │
│ │              executable = b'cmd.exe'                                              │            │
│ │         executable_list = (                                                       │            │
│ │                           │   b'/home/jt/.local/bin/cmd.exe',                     │            │
│ │                           │   b'/home/jt/.local/bin/cmd.exe',                     │            │
│ │                           │   b'/usr/local/sbin/cmd.exe',                         │            │
│ │                           │   b'/usr/local/bin/cmd.exe',                          │            │
│ │                           │   b'/usr/sbin/cmd.exe',                               │            │
│ │                           │   b'/usr/bin/cmd.exe',                                │            │
│ │                           │   b'/sbin/cmd.exe',                                   │            │
│ │                           │   b'/bin/cmd.exe',                                    │            │
│ │                           │   b'/usr/games/cmd.exe',                              │            │
│ │                           │   b'/usr/local/games/cmd.exe',                        │            │
│ │                           │   ... +17                                             │            │
│ │                           )                                                       │            │
│ │             fds_to_keep = {9}                                                     │            │
│ │                     gid = None                                                    │            │
│ │                    gids = None                                                    │            │
│ │               hex_errno = bytearray(b'8')                                         │            │
│ │        low_fds_to_close = []                                                      │            │
│ │         orig_executable = 'cmd.exe'                                               │            │
│ │                 p2cread = -1                                                      │            │
│ │                p2cwrite = -1                                                      │            │
│ │                    part = b''                                                     │            │
│ │                pass_fds = ()                                                      │            │
│ │                     pid = 473                                                     │            │
│ │              preexec_fn = None                                                    │            │
│ │           process_group = -1                                                      │            │
│ │         restore_signals = True                                                    │            │
│ │                    self = <Popen: returncode: 255 args: ['cmd.exe', '/c', 'ver']> │            │
│ │                   shell = False                                                   │            │
│ │       start_new_session = False                                                   │            │
│ │             startupinfo = None                                                    │            │
│ │                     sts = 65280                                                   │            │
│ │                     uid = None                                                    │            │
│ │                   umask = -1                                                      │            │
│ ╰───────────────────────────────────────────────────────────────────────────────────╯            │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
OSError: [Errno 8] Exec format error: 'cmd.exe'

Exception

No response

Anything else?

No response

Dramelac commented 1 year ago

Hello @KayZ-Safeit Did you follow all the requirements from the docs when installing Exegol for Windows ? https://exegol.readthedocs.io/en/latest/getting-started/install.html

KayZ-Safeit commented 1 year ago

Yes, I followed every steps

Dramelac commented 1 year ago

Ok, can you run the command cmd.exe /c ver inside your WSL2 shell and copy/paste or screenshot the result ?

KayZ-Safeit commented 1 year ago

jt@DESKTOP-EUI8PI0:~$ cmd.exe /c ver -bash: /mnt/c/Windows/system32/cmd.exe: cannot execute binary file: Exec format error

KayZ-Safeit commented 1 year ago

It looks like there is a problem with systemd

Dramelac commented 1 year ago

It looks like there is a problem with systemd

Indeed, i don't know WSL enough to debug but i found this thread: https://github.com/microsoft/WSL/issues/9146

Maybe try sudo update-binfmts --disable cli and run cmd.exe /c ver again ?

KayZ-Safeit commented 1 year ago

jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ sudo update-binfmts --disable cli jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ cmd.exe -bash: /mnt/c/Windows/system32/cmd.exe: cannot execute binary file: Exec format error jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ sudo update-binfmts --disable-cli update-binfmts: unrecognized option '--disable-cli' Try 'update-binfmts --help' or 'update-binfmts --usage' for more information. jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ exit logout

C:\Users\KayZn>wsl --shutdown

C:\Users\KayZn>wsl jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ cmd.exe -bash: /mnt/c/Windows/system32/cmd.exe: cannot execute binary file: Exec format error jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$

Didn't work, i'll try on another distro i guess

KayZ-Safeit commented 1 year ago

jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ cmd.exe -bash: /mnt/c/Windows/system32/cmd.exe: cannot execute binary file: Exec format error jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ vim /etc/wsl.conf jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ sudo vim /etc/wsl.conf [sudo] password for jt: jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ exit logout

C:\Users\KayZn>wsl --shutdown

C:\Users\KayZn>wsl jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ cmd.exe Microsoft Windows [version 10.0.19045.3570] (c) Microsoft Corporation. Tous droits réservés.

C:\Users\KayZn>exit

I get this when i comment the systemd boot part in /etc/wsl.conf

Dramelac commented 1 year ago

Okay, is exegol working now ?

KayZ-Safeit commented 1 year ago

No because exegol needs the systemd, so if I use the default I have cmd but not exegol but with [boot] systemd=true then i don't have access to cmd.exe I guess you can close the issue because I wont do further debbuging

Dramelac commented 1 year ago

Sorry to hear that. You are the first with this problem.. maybe a recent upgrade. We will try to reproduce, which distro did you use on WSL2 ?

If you need a workaround, you can install the exegol wrapper in your Windows directly using powershell for example. You just need to have python3 and pip install on windows to run in powershell the pip install command: https://exegol.readthedocs.io/en/latest/getting-started/install.html#installation-of-exegol

KayZ-Safeit commented 1 year ago

C:\Users\KayZn>wsl --list Distributions du Sous-système Windows pour Linux : Debian (par défaut) docker-desktop docker-desktop-data

C:\Users\KayZn>wsl jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" jt@DESKTOP-EUI8PI0:/mnt/c/Users/KayZn$ exit logout

C:\Users\KayZn>wsl --version Version WSL : 1.2.5.0 Version du noyau : 5.15.90.1 Version WSLg : 1.0.51 Version MSRDC : 1.2.3770 Version direct3D : 1.608.2-61064218 Version de DXCore : 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Version de Windows : 10.0.19045.3570

C:\Users\KayZn>wsl -l -v NAME STATE VERSION

C:\Users\KayZn> I can export the image if you want to investigate further

Dramelac commented 1 year ago

Hello @KayZ-Safeit your problem should be fixed now on the lastest dev version of the wrapper.

If you want to test now, you can do a source installed (new pip version not released yet).