You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WSL2 + Ubuntu 22.04.1: xdg-open: no method available for opening "https://www...." #8892
result
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'https://microsoft.com'
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'https://microsoft.com'
Diagnostic Logs
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'https://microsoft.com'
Reacted by Alex Kuretz, Paolo, Reilly Wood, Marco Lackovic, Artem Filipenko, Shaun Hamilton, Yuta Nakajima, James Daniels, Somraj Saha, Clémence Lesné and 10 more
I have the same issue, just installed a fresh Ubuntu 22.04 with service and GUI enabled, and the interop with browser is not working anymore on this version, there is something wired going on when using systemd with new WSL and GUI
Came accros this one: #8795
It seems like on eariler versions there was a package installed by default wslu which is not available by default on 22.04.
It had a wslview shell command which did the work, so by installing it, you can have the functionality back, but not sure of the drawbacks.
Reacted by chavankiran62, Ghirozzo, berazo29, Yuta Nakajima, gueyenono, Somraj Saha and Eyal Lapid - LimitlessCnc
wslu works. This really feels like a problem WSL should own -- installing the component, ensuring that the user knows the component could be installed, or forcing it to be installed due to some dependency.
Try to add an web browser path with BROWSER environment variable before launching xdg-open. For example, let assume Firefox is installed in Windows as C:\Firefox\firefox.exe. Then set the environment variable as export BROWSER=/mnt/c/Firefox/firefox.exe and run xdg-open as usual.
I had to create a symlink with ln -s /mnt/c/path/to/browser.exe and then set export BROWSER=~/path/to/symlink as my browser is installed in a directory with spaces (Program Files (86)), which xdg-open can't handle. https://unix.stackexchange.com/a/715404/571729
Reacted by Erik Cervin Edin and Jonathan A. M
Reacted by Konstantin Milchev, ebc-conscia, Hayden, Paolo, Ryan Bajno-Atkinson, Luan van Pletsen, aisng, Mark and Jonathan A. M
Reacted by Luciano Agustin Crocco, ebc-conscia, Mark, Sonja Goerlich, Jonathan A. M and Séverin Beauvais
I had to create a symlink with ln -s /mnt/c/path/to/browser.exe and then set export BROWSER=~/path/to/symlink as my browser is installed in a directory with spaces (Program Files (86)), which xdg-open can't handle. https://unix.stackexchange.com/a/715404/571729
Because of this change, Python's built-in module webbrowser stops working on Ubuntu 22.04 in WSL:
$ python -c "import webbrowser; print(webbrowser.open('https://login.microsoftonline.com/'))"
True
(py310) user2@DESKTOP-A79F1:~$ /usr/bin/xdg-open: 882: x-www-browser: not found
/usr/bin/xdg-open: 882: firefox: not found
/usr/bin/xdg-open: 882: iceweasel: not found
/usr/bin/xdg-open: 882: seamonkey: not found
/usr/bin/xdg-open: 882: mozilla: not found
/usr/bin/xdg-open: 882: epiphany: not found
/usr/bin/xdg-open: 882: konqueror: not found
/usr/bin/xdg-open: 882: chromium: not found
/usr/bin/xdg-open: 882: chromium-browser: not found
/usr/bin/xdg-open: 882: google-chrome: not found
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'https://login.microsoftonline.com/'
kierzorz thanks but that's not the point. WSL is configured and install by MS, az CLI is packaged by MS. Can't we expect either a fix upstream or a built-in workaround. For instance, WSL is installed on Windows where edge is here by default (even if not default browser), so for me, the env could be setup to point to edge install path. it would be sufficient to open a web page for auth
I just installed Ubuntu 22.04. I had to do 2 things:
install xdg utilities (sudo apt install xdg-utils) and
install wslu following the instructions here: https://wslutiliti.es/wslu/install.html (Scroll down to **Ubuntu Warning**. Follow the steps for PPA version: sudo add-apt-repository ppa:wslutilities/wslu sudo apt update sudo apt install wslu
Reacted by nazrul, stanyzra, Reilly Wood, Yuan Tian, Brian Zhou, Sai Prasad Majji, Shaun Hamilton, ouzmno, Zdbzde, Luan Nguyen Duy and 12 more
Reacted by Zhazha_JiaYiZhen, stanyzra, Reilly Wood, Josh Duffney, Duflow89 and Xavi Mabras
Reacted by cianemibs, Josep Moltó García, Zhazha_JiaYiZhen, Mohammadreza Yadegari, Hz Mei, pechanuda, Cristhian Melo, Markus Mroß, stanyzra, Sunny Wong and 13 more
Reacted by cianemibs, Zhazha_JiaYiZhen, Markus Mroß, stanyzra, Pedro Junqueira, Reilly Wood, Duflow89 and Xavi Mabras
Leslie Klein (@leslie-corbalt) I had a lot of issues because of xdg-open not really working. Thanks to you and to the other people who mentioned about WSLU. It worked for me. I followed the steps you mentioned above.
I'm using this on WSL2 Ubuntu with default Windows integrations (such as ability to run .exe from Linux) enabled:
$ sudo apt install xdg-utils
$ export BROWSER="cmd.exe /c start"# add to ~/.profile to make permanent
$ xdg-open https://www.microsoft.com/
'\\wsl.localhost\Ubuntu\home\<username_redacted>'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
This opens https://www.microsoft.com/ in whatever happens to be my default Windows web browser.
The 'UNC paths are not spported' message seems to be harmless.
Reacted by BetsuNo, Alex Pavlenko, Swadhin Patel, nikhilLyricFind, Nasonov V, Gili Tzabari, Costa and Gwendhal CLAUDEL
I just installed Ubuntu 22.04. I had to do 2 things:
install xdg utilities (sudo apt install xdg-utils) and
install wslu following the instructions here: https://wslutiliti.es/wslu/install.html (Scroll down to **Ubuntu Warning**. Follow the steps for PPA version: sudo add-apt-repository ppa:wslutilities/wslu sudo apt update sudo apt install wslu
I'm using WSL2 on Windows using Ubuntu v22.04.5 LTS. --> I just execute $ sudo apt install xdg-utils and the call to a browser was solved and the "gio warning" dissapears
I had to create a symlink with ln -s /mnt/c/path/to/browser.exe and then set export BROWSER=~/path/to/symlink as my browser is installed in a directory with spaces (Program Files (86)), which xdg-open can't handle. https://unix.stackexchange.com/a/715404/571729
you can do it like this, with quotes around the part having spaces, but not the full path
For those who are lazy, just copy the displayed link in command line and open it in the browser, the command can still receive feedback after you finish working in the browser.
same problem in WSL1 + Ubuntu 24.04. It would be nice if somehow WSL provided some help in this
What worked: export BROWSER=/mnt/c/Progra~1/Google/Chrome/Application/chrome.exe
In Ubuntu 24.04, somehow workarounds like export BROWSER=/mnt/c/'Program Files'/Google/Chrome/Application/chrome.exe stopped working - maybe because of some recent changes to the /usr/bin/xdg-open shell script
TL;DR The xdg-utils aren't the only program that makes use of the BROWSER variable, so xdg-open tries to stay compatible resulting in what looks like ignoring the problem.
The official xdg-utils workaround is creating a shell script that opens your favorite browser and put that into the BROWSER variable. (Will be in the manpage on the next release too)
In case anyone from the WSL project is reading this: I'd be great to have someone I can ping to get WSL knowledge and who can test changes to avoid/prevent breakages like this in the future.
Reacted by Songpol Anannetikul, Rohan Power, Miha77777, Christoffer and v-au
I can at least confirm xdg-open (after installing it with sudo apt install xdg-utils) works out of the box in WSL2 with Ubuntu-26.06 without installing any additional packages like wslu .
Activity
benhillis commentedon Sep 26, 2022
I think you may have to configure xdg-open to do this, we don't do this by default.
sabbour commentedon Oct 13, 2022
az loginwas working for me before, but now I'm facing this issue.fghamsary commentedon Oct 30, 2022
I have the same issue, just installed a fresh Ubuntu 22.04 with service and GUI enabled, and the interop with browser is not working anymore on this version, there is something wired going on when using systemd with new WSL and GUI
fghamsary commentedon Oct 30, 2022
Came accros this one: #8795
It seems like on eariler versions there was a package installed by default wslu which is not available by default on 22.04.
It had a wslview shell command which did the work, so by installing it, you can have the functionality back, but not sure of the drawbacks.
AdamGlass commentedon Jan 24, 2023
wslu works. This really feels like a problem WSL should own -- installing the component, ensuring that the user knows the component could be installed, or forcing it to be installed due to some dependency.
it's not even mentioned here: https://learn.microsoft.com/en-us/windows/wsl/install.
(AdamGlassMS too)
lgmorand commentedon Feb 13, 2023
Same issue here. the WSL 22.04 was working fine this morning. I did a apt-upgrade and then, the console is now broken when trying to do "az login"
I did "sudo apt install wslu" like mentioned and it seems to fix it. pretty weird what broke it
belainehi commentedon Feb 27, 2023
I had a similar issue, considering if installing one of the "not found" packages would help. Haven't found a solution yet.
Biswa96 commentedon Feb 27, 2023
Try to add an web browser path with
BROWSERenvironment variable before launching xdg-open. For example, let assume Firefox is installed in Windows asC:\Firefox\firefox.exe. Then set the environment variable asexport BROWSER=/mnt/c/Firefox/firefox.exeand run xdg-open as usual.wslpath can also help to covert the path style.
Source: https://cgit.freedesktop.org/xdg/xdg-utils/tree/scripts/xdg-open.in
AndreasNasman commentedon May 9, 2023
Biswapriyo Nath (@Biswa96) Thanks for the workaround! 👍
I had to create a symlink with
ln -s /mnt/c/path/to/browser.exeand then setexport BROWSER=~/path/to/symlinkas my browser is installed in a directory with spaces (Program Files (86)), whichxdg-opencan't handle.https://unix.stackexchange.com/a/715404/571729
LucianoCrocco commentedon May 16, 2023
Thanks both of you, it worked having 401 error.
Provide jump option, but this dont work in WSL2
Provide jump option, but this dont work in WSL2
Provide jump option, but this dont work in WSL2
jiasli commentedon Jul 31, 2023
I am the developer of Azure CLI authentication.
Because of this change, Python's built-in module
webbrowserstops working on Ubuntu 22.04 in WSL:This affects MSAL's
PublicClientApplication.acquire_token_interactive: https://github.com/AzureAD/microsoft-authentication-library-for-python/blob/64141cacdb4ea3a02a2b3cb45bc8fb3be4f93f36/msal/oauth2cli/authcode.py#L58Then affects Azure CLI's
az login: https://github.com/Azure/azure-cli/blob/f0c87ca820e0bd3f9dd403ef96c21ed49b734d16/src/azure-cli-core/azure/cli/core/auth/identity.py#L153lgmorand commentedon Jul 31, 2023
Jiashuo Li (@jiasli) what does that mean ? that we should consider az cli not working properly anymore on WSL 22.04 ?
kierzorz commentedon Aug 7, 2023
Louis-Guillaume MORAND (@lgmorand)
If you are using powershell on WSL then set the BROWSER ENV variable like so....
$Env:BROWSER = '/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'
For bash on wsl to open with your default browser use:
export BROWSER 'explorer.exe'
and set this line in your bash profile to make it permanent:
nano ~/.profile
lgmorand commentedon Aug 7, 2023
kierzorz thanks but that's not the point. WSL is configured and install by MS, az CLI is packaged by MS. Can't we expect either a fix upstream or a built-in workaround. For instance, WSL is installed on Windows where edge is here by default (even if not default browser), so for me, the env could be setup to point to edge install path. it would be sufficient to open a web page for auth
leslie-corbalt commentedon Oct 20, 2023
I just installed Ubuntu 22.04. I had to do 2 things:
sudo apt install xdg-utils) and**Ubuntu Warning**. Follow the steps for PPA version:sudo add-apt-repository ppa:wslutilities/wslusudo apt updatesudo apt install wslucianetech commentedon Oct 25, 2023
Leslie Klein (@leslie-corbalt) I had a lot of issues because of
xdg-opennot really working. Thanks to you and to the other people who mentioned about WSLU. It worked for me. I followed the steps you mentioned above.jiasli commentedon Dec 1, 2023
Without
xdg-utilsinstalled,webbrowserfrom Python 3.11 now reports a different error:$ sudo apt remove xdg-utils $ sudo apt install python3.11 $ python3.11 -c "import webbrowser; print(webbrowser.open('https://login.microsoftonline.com/'))" True gio: https://login.microsoftonline.com/: Operation not supportedackalker commentedon Feb 26, 2024
I'm using this on WSL2 Ubuntu with default Windows integrations (such as ability to run .exe from Linux) enabled:
This opens https://www.microsoft.com/ in whatever happens to be my default Windows web browser.
The 'UNC paths are not spported' message seems to be harmless.
leandiazz commentedon Aug 30, 2024
This work for me. Thanks!
tgiacaman commentedon Oct 8, 2024
I'm using WSL2 on Windows using Ubuntu v22.04.5 LTS. --> I just execute $ sudo apt install xdg-utils and the call to a browser was solved and the "gio warning" dissapears
copdips commentedon Oct 11, 2024
you can do it like this, with quotes around the part having spaces, but not the full path
khacnha commentedon Feb 7, 2025
For those who are lazy, just copy the displayed link in command line and open it in the browser, the command can still receive feedback after you finish working in the browser.
vadimkantorov commentedon May 17, 2025
same problem in WSL1 + Ubuntu 24.04. It would be nice if somehow WSL provided some help in this
What worked:
export BROWSER=/mnt/c/Progra~1/Google/Chrome/Application/chrome.exeIn Ubuntu 24.04, somehow workarounds like
export BROWSER=/mnt/c/'Program Files'/Google/Chrome/Application/chrome.exestopped working - maybe because of some recent changes to the/usr/bin/xdg-openshell scriptslatian commentedon May 20, 2025
xdg-utils maintianer here:
Thanks to Vadim Kantorov (@vadimkantorov) for opening an upstream bug
TL;DR The xdg-utils aren't the only program that makes use of the
BROWSERvariable, so xdg-open tries to stay compatible resulting in what looks like ignoring the problem.The official xdg-utils workaround is creating a shell script that opens your favorite browser and put that into the
BROWSERvariable. (Will be in the manpage on the next release too)Example shell script:
In case anyone from the WSL project is reading this: I'd be great to have someone I can ping to get WSL knowledge and who can test changes to avoid/prevent breakages like this in the future.
trallnag commentedon Jul 2, 2025
Note that https://github.com/wslutilities/wslu has been discontinued.
And note that https://launchpad.net/ubuntu/+source/wslu is outdated and the latest version of wslu is only available in the aforementioned GitHub repo or as PPA https://launchpad.net/~wslutilities/+archive/ubuntu/wslu
gabriellaXL commentedon Aug 4, 2025
It worked after I downloaded wslu.
sudo add-apt-repository ppa:wslutilities/wslu
sudo apt update
sudo apt install wslu
dellch commentedon Jun 27, 2026
I can at least confirm
xdg-open(after installing it withsudo apt install xdg-utils) works out of the box in WSL2 with Ubuntu-26.06 without installing any additional packages likewslu.