Closed linghengqian closed 1 year ago
This is #8842 ; the quick answer is that the way wsl.exe creates Linux-side processes doesn't go through PAM, so a user login session is never set up, so a user systemd instance is never started, so a user dbus is never created.
(There are various workarounds for this. Mine is bottle-imp, which I'm mentioning here because there are also several gotchas to implementing functioning user-login-session support which it fixes, and it would take a long time to explain them all.
...WSL team, I hope it's not too bad form to advertise my own solution like this, but...)
@cerebrate: You mention that bottle-imp is a workaround. How do you use it to fix the problem? I've installed it according to the instructions on your link, but I'm not sure to do with it once it's installed - the README is a bit inscrutable to someone with my understanding of what systemd is doing. I ran "imp -i", but all the other commands just produce an error that says "imp: cannot launch command; systemd-machined is not active".
@sbroberg
Which distro are you using?
bottle-imp uses systemd-machined (apt package name: systemd-containerd for some reason) to start user sessions when you use one of the -s/-c/-l options (and thus ensure that all the PAM/systemd session initialization is done correctly). That error message is the one you get if systemd-machined is somehow not enabled - despite bottle-imp doing so at runtime - or not installed, which the (Debian/Arch) packaged versions of bottle-imp should do automatically.
You can check the state of the service with
systemctl status systemd-machined
If it's not installed/can't be found, installing it should solve your problem. If it's something weirder, please open an issue over at the bottle-imp repo, and I'll see what I can do.
vlc
and gnome-text-editor
are gone. This issue has been resolved. I'm going to close this issue, although https://github.com/microsoft/WSL/issues/8842 still hasn't closed.
Version
Microsoft Windows [版本 10.0.22621.755]
WSL Version
Kernel Version
5.15.68.1
Distro Version
Ubuntu 22.04
Other Software
vlc, version 3.0.18 . Refer to https://snapcraft.io/vlc . gnome-text-editor, version 42.2 . Refer to https://snapcraft.io/gnome-text-editor .
Repro Steps
/etc/wsl.conf
and restart the WSL instance to turn on systemd support.Expected Behavior
Actual Behavior
When executing
vlc
, I saw some warnings related to D-Bus.When executing
gnome-text-editor ~/.bashrc
, I also saw some warnings related to D-Bus.(process:1852): Gdk-WARNING **: 11:03:06.028: Settings portal not found: 无法连接:No such file or directory Gdk-Message: 11:03:06.322: Failed to get file transfer portal: 无法连接:No such file or directory