6

I've seen related questions, but none offer the answer to my question. I ask because, whenever I invoke xdg-open from the command line, I get the following error instructing me to enable WSL Interoperability. I tried opening a PNG file and a PDF file. Both present me with the same message.

I'm on Ubuntu 22.04.

$ xdg-open IMG_20220629_131736841.jpg 
$ grep: /proc/sys/fs/binfmt_misc/WSLInterop: No such file or directory
WSL Interopability is disabled. Please enable it before using WSL.
grep: /proc/sys/fs/binfmt_misc/WSLInterop: No such file or directory
[error] WSL Interoperability is disabled. Please enable it before using WSL.
/usr/bin/wslview: line 216: /mnt/c/Windows/System32/reg.exe: No such file or directory
/usr/bin/wslview: line 308: [: -ge: unary operator expected
[error] This protocol is not supported before version 1903.
11
  • 2
    ehm you can use xdg-open on WSL2? Not xdg-open-wsl? Do you have a desktop in WSL2?
    – Rinzwind
    Aug 10, 2022 at 15:57
  • @Rinzwind Apparently, with the wslu package installed (which requires the PPA in 22.04), yes. It's not something I've experimented with much myself, but apparently installing the wslu package registers wslview as the handler for xdg-open. Aug 10, 2022 at 16:51
  • Interop should be enabled by default, unless you specifically turn it off in a /etc/wsl.conf. However, Systemd enabled scripts can often interfere with Interop. Are you using anything to try to run Systemd under Ubuntu in WSL? Aug 10, 2022 at 17:23
  • Rinzwind: My system is a laptop with only Ubuntu as OS.
    – TheGeeko61
    Aug 12, 2022 at 22:51
  • 1
    Does this answer your question? Ubuntu 22.04 (fresh install) desktop entries do not open Sep 26, 2022 at 14:29

2 Answers 2

7

Running the following command worked on Kubuntu 22.04 with a newly upgraded Plasma version 5.25.5:

sudo apt purge wslu
0

Delete the file /usr/share/applications/wslview.desktop.

I hit this too on a fresh Ubuntu 22.04.1 LTS release.

I deleted the file /usr/share/applications/wslview.desktop and xdg-open started to work as expected.

I don't know what exactly happens but it seems that the wslview.desktop launcher is meant for using Ubuntu in Windows WSL. But for some reason it's launched for every xdg-open invocation. When it's removed, xdg-open will use another launcher associated with the URL, the correct one.

1
  • 1
    Probably better to properly get rid of it via sudo apt purge wslu. See this question for details. Sep 26, 2022 at 14:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .