nullpo-head / wsl-distrod

Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
MIT License
1.9k stars 90 forks source link

[Bug]: GDB not working #65

Open herrwinfried opened 2 years ago

herrwinfried commented 2 years ago

Describe the bug

I open a visual studio 2022 cmake project and compile it, if wsl-Distrod is open, I get a screen like the image below. image

If I turn off wsl-distrod it works.

image

Steps to reproduce

it doesn't matter, as long as wsl-distrod is open, it always enters the same error loop.

Expected behavior

It should work as below without error.

image

Windows version

22621.232

Linux kernel version

Linux winfried 5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Distro

OpenSUSE Tumbleweed

How did you install that distro?

Enabled distrod in an existing WSL2 distro

Logs

❯ sudo journalctl -b -k -t Distrod
Jul 21 09:58:50 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 09:58:50 winfried Distrod: [DEBUG] starting /init from distrod-exec
Jul 21 09:58:50 winfried Distrod: [DEBUG] WSL envs: "WSL_INTEROP" = "/run/WSL/8_interop"
Jul 21 09:58:50 winfried Distrod: [DEBUG] WSL envs: "WSL_DISTRO_NAME" = "openSUSE-Tumbleweed"
Jul 21 09:58:50 winfried Distrod: [DEBUG] WSL envs: "WSLENV" = "WT_SESSION::WT_PROFILE_ID"
Jul 21 09:58:50 winfried Distrod: [DEBUG] Container::with_mount source: Some(HostPath("/run/distrod/cmdline")), target: ContainerPath("/proc/cmdline"), fst>
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd"
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system"
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/portproxy.service"
Jul 21 09:58:50 winfried Distrod: [DEBUG] Container::with_mount source: Some(HostPath("/opt/distrod/run/systemd/system/portproxy.service")), target: Contai>
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d"
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d/exclude_wslg_soc>
Jul 21 09:58:50 winfried Distrod: [DEBUG] Container::with_mount source: Some(HostPath("/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d/exc>
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d"
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d/exclude_wslg_soc>
Jul 21 09:58:50 winfried Distrod: [DEBUG] Container::with_mount source: Some(HostPath("/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d/exc>
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/tmpfiles.d"
Jul 21 09:58:50 winfried Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/tmpfiles.d/x11.conf"
Jul 21 09:58:50 winfried Distrod: [DEBUG] Container::with_mount source: Some(HostPath("/mnt/wslg/.X11-unix")), target: ContainerPath("/tmp/.X11-unix"), fst>
Jul 21 09:58:50 winfried Distrod: [DEBUG] DistroLauncher::launch
Jul 21 09:58:50 winfried Distrod: [DEBUG] Container::with_mount source: Some(HostPath("/run/distrod/distrod_wsl_env-uid1000")), target: ContainerPath("/run>
Jul 21 09:58:50 winfried Distrod: [DEBUG] Spawning the command or the waiter.
Jul 21 09:58:50 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 09:58:50 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 09:58:50 winfried Distrod: [TRACE] mounting source: Some(
                                      ContainerPath(
                                          "/run/distrod/cmdline",
                                      ),
                                  ), mount: ContainerMount { source: Some(HostPath("/run/distrod/cmdline")), target: ContainerPath("/proc/cmdline"), fstype>
Jul 21 09:58:50 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 09:58:50 winfried Distrod: [TRACE] mounting source: Some(
                                      ContainerPath(
                                          "/opt/distrod/run/systemd/system/portproxy.service",
                                      ),
                                  ), mount: ContainerMount { source: Some(HostPath("/opt/distrod/run/systemd/system/portproxy.service")), target: Container>
Jul 21 09:58:50 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 09:58:50 winfried Distrod: [TRACE] mounting source: Some(
                                      ContainerPath(
                                          "/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d/exclude_wslg_sockets.conf",
                                      ),
                                  ), mount: ContainerMount { source: Some(HostPath("/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d/exclud>
Jul 21 09:58:50 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 09:58:50 winfried Distrod: [TRACE] mounting source: Some(
                                      ContainerPath(
                                          "/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d/exclude_wslg_sockets.conf",
                                      ),
                                  ), mount: ContainerMount { source: Some(HostPath("/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d/exclud>
Jul 21 09:58:50 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 09:58:50 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 09:58:50 winfried Distrod: [TRACE] mounting source: Some(
                                      ContainerPath(
                                          "/mnt/wslg/.X11-unix",
                                      ),
                                  ), mount: ContainerMount { source: Some(HostPath("/mnt/wslg/.X11-unix")), target: ContainerPath("/tmp/.X11-unix"), fstype>
Jul 21 09:58:50 winfried Distrod: [TRACE] skipping an identical mount: Some(
                                      ContainerPath(
                                          "/run/distrod/distrod_wsl_env-uid1000",
                                      ),
                                  ), ContainerMount {
                                      source: Some(
                                          HostPath(
                                              "/run/distrod/distrod_wsl_env-uid1000",
                                          ),
                                      ),
                                      target: ContainerPath(
                                          "/run/distrod/distrod_wsl_env-uid1000",
                                      ),
                                      fstype: None,
                                      flags: MS_BIND,
                                      data: None,
                                      is_file: true,
                                  }
Jul 21 10:00:07 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:07 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:07 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:07 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:07 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:07 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:07 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:07 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:08 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:08 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:08 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:08 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:08 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:08 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:08 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:08 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:08 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:08 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:08 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:08 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:08 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:08 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:09 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:09 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:09 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:09 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:09 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:09 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:09 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:09 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:09 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:09 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:09 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:09 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:09 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:09 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:29 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:29 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:29 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:29 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:29 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:29 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:29 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:29 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:30 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:30 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:30 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:30 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:30 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:30 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:30 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:30 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:30 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:30 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:30 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:30 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:30 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:30 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:30 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:30 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:31 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:31 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:31 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:31 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:31 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:31 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:31 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:31 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:31 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:31 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:31 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:31 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:31 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:31 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Jul 21 10:00:32 winfried Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Jul 21 10:00:32 winfried Distrod: [DEBUG] Executing a command in the distro.
Jul 21 10:00:32 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:32 winfried Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Jul 21 10:00:32 winfried Distrod: [DEBUG] Distro::exec_command.
Jul 21 10:00:32 winfried Distrod: [DEBUG] Container::exec_command.
Jul 21 10:00:32 winfried Distrod: [DEBUG] Triple fork done.
Jul 21 10:00:32 winfried Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.

additional comment

I am using WSL Preview.

cyleaf commented 2 years ago

I am having the same issue with GDB, but from vscode instead. Nothing to add, but I hope this gets some attention.

ChPu437 commented 1 year ago

I am having the same issue with GDB, but from vscode instead. Nothing to add, but I hope this gets some attention.

Same problem from vscode.Running ubuntu22.04 on wsl2. When I try to debug some cpp program using gdb in vscode, gdb just exits without any output.

Then I tried to investigate the problem and tried to run gdb mannually, and the screenshot below is the output I got from gdb: screenshot png (The Chinese error output means "no file or directory")

Disabling wsl-distrod worked for me.