microsoft / wslg

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

wslg didn't install usefully in Windows 11 #415

Open deborahgu opened 3 years ago

deborahgu commented 3 years ago

Environment

Windows build number: [Version 10.0.22000.132]
Your Distribution version: Ubuntu 20.04.2 LTS
Your WSLg version: Windows subsystem for linux WSLg Preview 1.0.26

Steps to reproduce

WSL logs:

Expected behavior

  1. start on the dev preview channel
  2. upgrade the computer
  3. run all windows updates and reboot a lot
  4. do wsl --update and wsl --shutdown from powershell
  5. do sudo apt update and sudo apt upgrade from Ubuntu
  6. Add the following to my [wsl2] section in .wslconfig: guiApplications = true
  7. be able to run an X app or see the /mnt/wslg directory

Actual behavior

  1. do steps 1-6 above
  2. the /mnt/wslg directory doesn't exist
  3. running any X apps returns Error: Can't open display: :0
PS C:\Users\deborah> wsl --list -v
  NAME                   STATE           VERSION
* Ubuntu                 Running         2
  docker-desktop-data    Running         2
  docker-desktop         Running         2

504$ ls -al /mnt
total 16
drwxr-xr-x  4 root root 4096 Mar  9 20:14 .
drwxr-xr-x 23 root root 4096 Aug 17 13:22 ..
drwxrwxrwx  2 root root 4096 Mar  9 20:14 c
drwxr-xr-x  2 root root 4096 Mar  9 20:14 wsl  
benhillis commented 3 years ago

Any interesting errors in dmesg? Could you install a fresh distro from the store, for example Debian, and try there?

bernhardkaindl commented 3 years ago

@deborahgu The install howto does not stress that you must update WSL as well (at least after upgrading to Win11 21H2 (OS Build 22000.282).

You are on Win10, but I expect this to be needed in any such case:

The general Issue likely is that wsl --update, when not run from an elevated command prompt, does not tell the user that it must be run from an elevated command prompt to download and install the updates which enable /mnt/wslg.

And the README.md's section label should start with the imparative "Update" rather than "Updating":

Instead of "Updating WSL + WSLg" it should be titled "Install WSLg by updating WSL as Administrator".

from README.md:

Updating WSL + WSLg

To update to the latest version of WSL and WSLg released for preview, simply run wsl --update from an elevated command prompt or powershell.

You'll need to restart WSL for the changes to take effect. You can restart WSL by running wsl --shutdown from an elevated command prompt. If WSL was currently running, it will shutdown, make sure to first save any in progress work! WSL will be automatically restarted the next time you launch a WSL application or terminal.

ryantheleach commented 2 years ago

+1. this hit me as well I think on retail. Spent several hours debugging just to find out I didn't run the update as admin, even though I hadn't even USED WSL previously afaik, as I had to enable virtualization etc.