[Bug]: snap GUI applications not working on Ubuntu WSL2 win 11
tomasz-gac opened this issue · 4 comments
Describe the bug
I cannot run GUI apps installed via snap.
Installing and running snap-store yields:
update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/tmp/.X11-unix /tmp/.X11-unix none bind,ro 0 0): cannot use "/var/lib/snapd/hostfs/tmp/.X11-unix" as bind-mount source: not a directory
mkdir: cannot create directory ‘/run/user/1000’: Permission denied
Unable to init server: Could not connect: Connection refused
22:17:06:0160 Gtk cannot open display: :0
The same final Gtk error exists for Chromium
Steps to reproduce
- Install Ubuntu from Microsoft app store on Windows 11
- Install distrod, option 2 on already installed distro
- sudo snap install snap-store
- snap-store
Expected behavior
Snap store GUI opens
Windows version
11
Linux kernel version
Linux DESKTOP-HUAWEI 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
Distro
Ubuntu 20.04
How did you install that distro?
Enabled distrod
in an existing WSL2 distro
Logs
-- Logs begin at Sat 2021-12-25 20:12:34 CET, end at Sun 2021-12-26 23:22:21 CET. --
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] starting /init from distrod-exec
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] WSL envs: "WSLENV" = "BASH_ENV/u"
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] WSL envs: "WSL_DISTRO_NAME" = "Ubuntu"
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] WSL envs: "WSL_INTEROP" = "/run/WSL/14_interop"
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Container::with_mount source: Some(HostPath("/run/distrod/cmdline")), target: ContainerPath("/proc/cmdline"), fstype: None, flags: MS_BIND, is_file: true
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd"
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system"
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/systemd/system/portproxy.service"
Dec 26 23:21:36 DESKTOP-HUAWEI 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
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/tmpfiles.d"
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [TRACE] mount_distrod_run_files: path: "/opt/distrod/run/tmpfiles.d/x11.conf"
Dec 26 23:21:36 DESKTOP-HUAWEI 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
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] DistroLauncher::launch
Dec 26 23:21:36 DESKTOP-HUAWEI 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
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Spawning the command or the waiter.
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Executing a command in the distro.
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Distro::exec_command.
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Container::exec_command.
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] Triple fork done.
Dec 26 23:21:36 DESKTOP-HUAWEI 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 }
Dec 26 23:21:36 DESKTOP-HUAWEI Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
Dec 26 23:21:36 DESKTOP-HUAWEI 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 }
Dec 26 23:21:36 DESKTOP-HUAWEI 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 }
Dec 26 23:21:36 DESKTOP-HUAWEI 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,
}
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] distrod-exec: exec_command_in_distro
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] Executing a command in the distro.
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] Failed to ignore signal Sys(EINVAL)
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] Distro::exec_command.
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] Container::exec_command.
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] Triple fork done.
Dec 26 23:21:35 DESKTOP-HUAWEI Distrod: [DEBUG] dropping privilege. kmsg logging in the child ends here.
additional comment
No response
I made a symbolic link from $XDG_RUNTIME_DIR to /run/user/1000 and it works
@dingdang66686 just attempted this, now the error is:
update.go:85: cannot change mount namespace according to change mount (/var/lib/snapd/hostfs/tmp/.X11-unix /tmp/.X11-unix none bind,ro 0 0): cannot use "/var/lib/snapd/hostfs/tmp/.X11-unix" as bind-mount source: not a directory error: access denied ERROR: not connected to the gnome-3-28-1804 content interface.
Wayland application works in this way.
For x11 apps, you should delete /tmp/.X11-unix and make a bind mount to wslg's .X11 dir.