microsoft / wslg

Enabling the Windows Subsystem for Linux to include support for Wayland and X server related scenarios
MIT License
9.91k stars 296 forks source link

Postman as Snap does not work (due to system-distro isolation) #856

Open felipecrs opened 1 year ago

felipecrs commented 1 year ago

Windows build number:

22621.608

Your Distribution version:

Ubuntu 22.04.1

Your WSL versions:

WSL version: 0.70.0.0 Kernel version: 5.15.68.1 WSLg version: 1.0.45 MSRDC version: 1.2.3575 Direct3D version: 1.606.4 DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp Windows version: 10.0.22621.608

Steps to reproduce:

  1. Install a clean WSL Ubuntu distro
  2. Enable Systemd
  3. Upgrade all packages
  4. sudo snap install postman
  5. snap run postman

WSL logs:

WslLogs-2022-10-11_20-44-43.zip

WSL dumps:

No response

Expected behavior:

To at least open the Postman window, I guess.

Actual behavior:

$ snap run postman
The disableGPU setting is set to undefined
Not disabling GPU
[1129:1011/204457.140013:ERROR:browser_main_loop.cc(1400)] Unable to open X display.
Failed to generate minidump.Segmentation fault

# In another distro I found:
❯ snap run postman
The disableGPU setting is set to undefined
Not disabling GPU
[2927:1011/204107.769083:ERROR:browser_main_loop.cc(1400)] Unable to open X display.
The futex facility returned an unexpected error code.[1]    2927 IOT instruction  snap run postman
hideyukn88 commented 1 year ago

@felipecrs, thanks for reporting the issue. I am able to reproduce the issue at my end, and did a bit of research on this. This seems to be caused by WSLg's system-distro isolation from user-distro, as postman can run if no isolation (means run all WSLg components directly on user distro), see below screenshot. I think the isolation impose some unusuality for postman to connect X server (as it does run as X11 app, not as Wayland app), I will need to investigate further, or seek help from postman developers, thanks!

image

elsaco commented 1 year ago

@felipecrs IMO snap is not broken, it installs/updates/removes as intended since WSL team made systemd operational. The issue is with postman

You probably pulled in from v9/stable channel by running snap install postman. It defaults to the latest postman snap on snapcraft.io

For me running sudo snap install --channel=latest/stable postman launches a working postman on Ubuntu-22.04 after installation.

Here's sample log output:

elsaco@THINKZEN:~$ POSTMAN_DISABLE_GPU=true postman
(electron) 'getName function' is deprecated and will be removed. Please use 'name property' instead.
Disabling GPU
ProtocolHandler~setDefaultProtocolClient: Command failed: xdg-mime default Postman.desktop x-scheme-handler/postman
/bin/sh: 1: xdg-mime: not found

Error org.freedesktop.DBus.Error.Failed: cannot set "default-url-scheme-handler" setting to invalid value "postman"
1665719302119 main info "Booting Postman 7.36.5, linux-5.15.68.1-microsoft-standard-WSL2 on x64"
1665719302120 main info "EventBus~initialize - Success"
1665719302223 main warn "CloudProxyManager~init: Error while reading proxy configuration from user data - ",{"errno":-2,"code":"ENOENT","syscall":"open","path":"/home/elsaco/snap/postman/133/.config/Postman/Postman_Config/proxy","name":"Error","message":"ENOENT: no such file or directory, open '/home/elsaco/snap/postman/133/.config/Postman/Postman_Config/proxy'","stack":"Error: ENOENT: no such file or directory, open '/home/elsaco/snap/postman/133/.config/Postman/Postman_Config/proxy'"}
1665719302225 main info "CloudProxyManager~init - Success"
1665719302251 main info "UpdateHandler~init - Success"
1665719302997 main info "RuntimeIPCAgent~started: Success"
1665719303670 main info "LinuxAutoUpdater~Cleanup - Initial cleanup successful"
1665719303694 main warn "main~populateInstallationId: Failed to get installationId from appSettings but with no error"
1665719303757 main info "Bootstrap-models~bootstrap - Success"
1665719305514 main info "window-manager~newSharedWindow: Shell loaded"
1665719313228 main info "Main~AppEvents - Received booted event for process shared"
INTERCEPTOR CONNECTIVITY: Connecting to Interceptor Bridge
InterceptorBridge: Trying to connect Native App IPC~Interceptor Bridge
1665719317063 main info "Main~AppEvents - Received booted event for process requester"
IPCClient ~ WindowHandler: New event is received { type: 'window-opened' }
1665719366195 main info "Quitting app"

However latest/stable pulls version 7.36.5. Please run snap info postman to see all available channels/versions.

hideyukn88 commented 1 year ago

@elsaco, thanks for info, but it looks sudo snap install --channel=latest/stable postman installs much older version of postman, which is version 7.36.5, and the latest version is 9.31.0 from snap install postman. Also, I think some encapsulation by snap plays some factor to this issue, because Postman 9.31.0 works correctly if it's run outside of snap, for example, you can download Postman from https://www.postman.com/downloads/, then extract and launch it, this case, snap is not involved. @felipecrs, please try out this and you can confirm installed version from Files -> Settings -> About tab. Thus, I think there are 2 factors; one is WSLg's system-distro isolation, and 2) installed/launched via snap, when it meets both 1) and 2) conditions, Postman seems doesn't work, thanks!

felipecrs commented 1 year ago

Yeah, it works fine outside of Snap:

image

bergerst commented 1 year ago

latest/stable is now version 10.13.0 and I'm still experiencing this issue

KyteProject commented 1 year ago

+1, I'm also running into this frequently with snap installations on WSL 2.

❯ sudo snap run postman
The disableGPU setting is set to undefined
Not disabling GPU
[40859:0628/105549.090307:ERROR:ozone_platform_x11.cc(248)] Missing X server or $DISPLAY
[40859:0628/105549.090352:ERROR:env.cc(225)] The platform failed to initialize.  Exiting.
[0628/105549.095643:ERROR:scoped_ptrace_attach.cc(27)] ptrace: Operation not permitted (1)
zsh: segmentation fault  sudo snap run postman

Uninstalling and using @elasco's method above has resolved it for me for now.

karan51ngh commented 10 months ago

Hey could you let me know if you are still able to run postman? I'm not able to use postman on my wsl using @elsaco 's method.

yerycs commented 9 months ago

Installing v7/stable works for me