nullpo-head/wsl-distrod

[Bug]: systemd not working

colemar opened this issue · 2 comments

Describe the bug

Installed Distrod (via install.sh) in an existing WSL2 distro Ubuntu 22.04.1 LTS (Jammy Jellyfish).
There is a pre-existing Debian distro with Distrod (via install.sh) that seems to work OK.

As soon as the Ubuntu distro is started vmmem process gets about 15% CPU as stated by Windows Task Manager.
Inside the distro:

  • top shows systemd at 100% CPU.
  • systemctl hangs for a while then spits: Failed to list units: Transport endpoint is not connected
  • sudo grep 'Distrod:' /dev/kmsg just hangs forever
    As soon as the Ubuntu distro is stopped (wls -t Ubuntu) vmmem process goes down to 0% CPU.
    I see nothing particularly wrong in the Distrod trace log.

I installed another Ubuntu 22.04 distro via distrod_wsl_launcher.exe and it works as expected.

Steps to reproduce

See above.

Expected behavior

systemd works

Windows version

Windows 10 21H2 19044.2006

Linux kernel version

5.10.102.1-microsoft-standard-WSL2

Distro

Ubuntu 22.04

How did you install that distro?

Enabled distrod in an existing WSL2 distro

Logs

[Distrod][DEBUG] distrod-exec: exec_command_in_distro
[Distrod][DEBUG] starting /init from distrod-exec
[Distrod][DEBUG] WSL envs: "WSL_DISTRO_NAME" = "Ubuntu"
[Distrod][DEBUG] WSL envs: "WSL_INTEROP" = "/run/WSL/12_interop"
[Distrod][DEBUG] WSL envs: "WSLENV" = "WT_SESSION::WT_PROFILE_ID"
[Distrod][DEBUG] Container::with_mount source: Some(HostPath("/run/distrod/cmdline")), target: ContainerPath("/proc/cmdline"), fstype: None, flags: MS_BIND, is_file: true
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd"
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system"
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/portproxy.service"
[Distrod][DEBUG] Container::with_mount source: Some(HostPath("/opt/distrod/run/systemd/system/portproxy.service")), target: ContainerPath("/run/systemd/system/portproxy.service"), fstype: None, flags: MS_BIND, is_file: true
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d"
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d/exclude_wslg_sockets.conf"
[Distrod][DEBUG] Container::with_mount source: Some(HostPath("/opt/distrod/run/systemd/system/systemd-tmpfiles-clean.service.d/exclude_wslg_sockets.conf")), target: ContainerPath("/run/systemd/system/systemd-tmpfiles-clean.service.d/exclude_wslg_sockets.conf"), fstype: None, flags: MS_BIND, is_file: true
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d"
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d/exclude_wslg_sockets.conf"
[Distrod][DEBUG] Container::with_mount source: Some(HostPath("/opt/distrod/run/systemd/system/systemd-tmpfiles-setup.service.d/exclude_wslg_sockets.conf")), target: ContainerPath("/run/systemd/system/systemd-tmpfiles-setup.service.d/exclude_wslg_sockets.conf"), fstype: None, flags: MS_BIND, is_file: true
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/tmpfiles.d"
[Distrod][TRACE] mount_distrod_run_files: path: "/opt/distrod/run/tmpfiles.d/x11.conf"
[Distrod][DEBUG] Container::with_mount source: Some(HostPath("/opt/distrod/run/tmpfiles.d/x11.conf")), target: ContainerPath("/run/tmpfiles.d/x11.conf"), fstype: None, flags: MS_BIND, is_file: true
[Distrod][DEBUG] DistroLauncher::launch
[Distrod][DEBUG] Container::with_mount source: Some(HostPath("/run/distrod/distrod_wsl_env-uid1000")), target: ContainerPath("/run/distrod/distrod_wsl_env-uid1000"), fstype: None, flags: MS_BIND, is_file: true
[Distrod][DEBUG] Spawning the command or the waiter.
[Distrod][DEBUG] Executing a command in the distro.
[Distrod][DEBUG] Failed to ignore signal Sys(EINVAL)
[Distrod][DEBUG] Failed to ignore signal Sys(EINVAL)
[Distrod][DEBUG] Distro::exec_command.
[Distrod][DEBUG] Container::exec_command.
[Distrod][DEBUG] Triple fork done.
[Distrod][TRACE] mounting source: Some(
ContainerPath(
"/run/distrod/cmdline",
),
), mount: ContainerMount { source: Some(HostPath("/run/distrod/cmdline")), target: ContainerPath("/proc/cmdline"), fstype: None, flags: MS_BIND, data: None, is_file: true }
[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: ContainerPath("/run/systemd/system/portproxy.service"), fstype: None, flags: MS_BIND, data: None, is_file: true }
[Distrod][DEBUG] dropping privilege. kmsg logging in the child ends here.
[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/exclude_wslg_sockets.conf")), target: ContainerPath("/run/systemd/system/systemd-tmpfiles-clean.service.d/exclude_wslg_sockets.conf"), fstype: None, flags: MS_BIND, data: None, is_file: true }
[Distrod][DEBUG] The parent of the second of three forks exits.
[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/exclude_wslg_sockets.conf")), target: ContainerPath("/run/systemd/system/systemd-tmpfiles-setup.service.d/exclude_wslg_sockets.conf"), fstype: None, flags: MS_BIND, data: None, is_file: true }
[Distrod][DEBUG] Spawning the command or the waiter.
[Distrod][TRACE] mounting source: Some(
ContainerPath(
"/opt/distrod/run/tmpfiles.d/x11.conf",
),
), mount: ContainerMount { source: Some(HostPath("/opt/distrod/run/tmpfiles.d/x11.conf")), target: ContainerPath("/run/tmpfiles.d/x11.conf"), fstype: None, flags: MS_BIND, data: None, is_file: true }
[Distrod][DEBUG] Spawning the waiter.
[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,
}
[Distrod][DEBUG] Failed to ignore signal Sys(EINVAL)
[Distrod][DEBUG] Failed to ignore signal Sys(EINVAL)

additional comment

No response

What version of the systemd package?

It seems the last one (250.*) is broken:
microsoft/WSL#8879

@psmolkin
systemd 249.11-0ubuntu3.6
And it is the same version that is working in the other ubuntu distro which was installed via distrod_wsl_launcher.exe.