Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start Systemd and cannot start firefox #838

Closed
qyw233 opened this issue Sep 23, 2022 · 10 comments
Closed

start Systemd and cannot start firefox #838

qyw233 opened this issue Sep 23, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@qyw233
Copy link

qyw233 commented Sep 23, 2022

Windows build number:

22622.0

Your Distribution version:

20.04

Your WSL versions:

WSL 版本: 0.67.6.0
内核版本: 5.15.62.1
WSLg 版本: 1.0.44
MSRDC 版本: 1.2.3401
Direct3D 版本: 1.606.4
DXCore 版本: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows版本: 10.0.22622.601

Steps to reproduce:

1.start Systemd https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/
2.start firefox then show unable to init server: could not connect: connection refused error cannot open display: :0

WSL logs:

No response

WSL dumps:

No response

Expected behavior:

No response

Actual behavior:

as I start Systemd following https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/,then I can not start firefox and other application with sudo such as sudo geany
it says unable to init server: could not connect: connection refused error cannot open display: :0

@qyw233 qyw233 added the bug Something isn't working label Sep 23, 2022
@tusharsnx
Copy link

I am guessing it might be related to permissions, does it work without sudo?

@YuziO2
Copy link

YuziO2 commented Sep 23, 2022

same!!

@qyw233
Copy link
Author

qyw233 commented Sep 23, 2022

I am guessing it might be related to permissions, does it work without sudo?

firefox without sudo did not work,the same as sudo .Other program work without sudo but can not run with sudo

@elsaco
Copy link

elsaco commented Sep 24, 2022

@qyw233 what is the output of systemctl status user.slice? Here's output of Firefox on Ubuntu, Firefox was installed as a snap:

wsl_ubuntu_snap_firefox

@tusharsnx
Copy link

firefox without sudo did not work,the same as sudo .Other program work without sudo but can not run with sudo

@qyw233 By default sudo does not preserve user env vars set by wsl. In order to preserve env while running the command with sudo you need to add -E flag:

-E, --preserve-env
Indicates to the security policy that the user wishes to preserve their existing environment variables. The security policy may return an error if the user does not have permission to preserve the environment.

try running apps with:

$ sudo -E <comm>

@qyw233
Copy link
Author

qyw233 commented Sep 24, 2022

@qyw233输出是什么?以下是火狐在Ubuntu上的输出,火狐是作为快照安装的:systemctl status user.slice

wsl_ubuntu_snap_firefox

 Loaded: loaded (/lib/systemd/system/user.slice; static; vendor preset: enabled)
 Active: active since Sat 2022-09-24 12:54:33 CST; 2min 54s ago
   Docs: man:systemd.special(7)
  Tasks: 57
 Memory: 109.4M
 CGroup: /user.slice
         └─user-1000.slice
           ├─session-c1.scope
           │ ├─723 /bin/login -f
           │ └─898 -bash
           └─[email protected]
             ├─at-spi-dbus-bus.service
             │ ├─1078 /usr/libexec/at-spi-bus-launcher
             │ ├─1083 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
             │ └─1086 /usr/libexec/at-spi2-registryd --use-gnome-session
             ├─dbus.service
             │ ├─904 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
             │ ├─961 /usr/libexec/goa-daemon
             │ └─984 /usr/libexec/goa-identity-service
             ├─gvfs-afc-volume-monitor.service
             │ └─993 /usr/libexec/gvfs-afc-volume-monitor
             ├─gvfs-daemon.service
             │ ├─924 /usr/libexec/gvfsd
             │ └─939 /usr/libexec/gvfsd-fuse /run/user/1000/gvfs -f -o big_writes
             ├─gvfs-goa-volume-monitor.service
             │ └─957 /usr/libexec/gvfs-goa-volume-monitor
             ├─gvfs-gphoto2-volume-monitor.service
             │ └─1006 /usr/libexec/gvfs-gphoto2-volume-monitor
             ├─gvfs-metadata.service
             │ └─1043 /usr/libexec/gvfsd-metadata
             ├─gvfs-mtp-volume-monitor.service
             │ └─999 /usr/libexec/gvfs-mtp-volume-monitor
             ├─gvfs-udisks2-volume-monitor.service
             │ └─945 /usr/libexec/gvfs-udisks2-volume-monitor
             ├─init.scope
             │ ├─887 /lib/systemd/systemd --user
             │ └─888 (sd-pam)
             ├─pulseaudio.service
             │ └─895 /usr/bin/pulseaudio --daemonize=no --log-target=journal
             └─tracker-miner-fs.service
               └─897 /usr/libexec/tracker-miner-fs

Warning: journal has been rotated since unit was started, output may be incomplete.
~
@elsaco I install firefox by atp

@qyw233
Copy link
Author

qyw233 commented Sep 24, 2022

@tusharsnn Oh!I can use sudo -E geany to open geany.But firefox cannot open with or without sudo.

john@ThinkPad-E480:~$ firefox Unable to init server: Could not connect: Connection refused Error: cannot open display: :0 john@ThinkPad-E480:~$ sudo -E firefox Running Firefox as root in a regular user's session is not supported. ($HOME is /home/john which is owned by john.)

firefox cannot use sudo

@hideyukn88
Copy link
Member

Currently we are aware of systemd and WSLg is not working along on Ubuntu 20.04. You can try Ubuntu 22.04 or 18.04, or Debian as workaround, we will look into the root cause with 20.04, thanks!

@roblatham00
Copy link

systemd and WSLg does not work on my Ubuntu 22.04 installation .. Could be related to #844

@hideyukn88
Copy link
Member

Hi all, WSL 0.70.0 is just released and it addresses various issues with systemd, including the problem like this, please update by wsl --update, and if it still doesn't address, please let us know by reopening this issue, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants