Skip to content

Instantly share code, notes, and snippets.

@ausec-it
Forked from tdcosta100/WSL2GUIXvnc-en.md
Created August 4, 2020 02:10
Show Gist options
  • Select an option

  • Save ausec-it/eda8f82602dbf4078c6387e809c45938 to your computer and use it in GitHub Desktop.

Select an option

Save ausec-it/eda8f82602dbf4078c6387e809c45938 to your computer and use it in GitHub Desktop.

Revisions

  1. @tdcosta100 tdcosta100 revised this gist Jul 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIXvnc-en.md
    Original file line number Diff line number Diff line change
    @@ -217,7 +217,7 @@ After logging in, the screen will be blank. This is because a new instance of Xv


    ### Budgie Desktop
    ![Budgie Desktop](https://user-images.githubusercontent.com/708549/86651902-729b3380-bfd3-11ea-8aab-7f4ad14099c1.png)
    ![Budgie Desktop](https://user-images.githubusercontent.com/708549/86843363-f9184980-c095-11ea-986d-9466cf54a035.png)


    ## Contributors
  2. @tdcosta100 tdcosta100 renamed this gist Jul 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md → WSL2GUIXvnc-en.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # WSL2 with GUI using VNC
    # WSL2 with GUI using Xvnc

    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer ([RealVNC](https://www.realvnc.com/pt/connect/download/viewer/), [TightVNC](https://www.tightvnc.com/download.php), [TigerVNC](https://bintray.com/tigervnc/stable/tigervnc/1.10.1), [UVNC](https://www.uvnc.com/downloads/ultravnc.html), etc, all of them might work flawlessly).

  3. @tdcosta100 tdcosta100 revised this gist Jul 7, 2020. No changes.
  4. @tdcosta100 tdcosta100 revised this gist Jul 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ $ sudo apt install dotnet-runtime-3.1

    ### Installing systemd-genie

    Now we will install systemd-genie, which is responsible for turning the minimalist WSL into a more complete Linux instance, with systemd and other related stuff. This is necessary to run GDM (GNOME Display Manager) properly, giving the user a full graphic interface experience, with login and everything. Here are the [install instructions](https://packagecloud.io/arkane-systems/wsl-translinux/install). As of July 2nd, 2020, these following commands are needed to install it:
    Now we will install systemd-genie, which is responsible for turning the minimalist WSL into a more complete Linux instance, with systemd and other related stuff. This is necessary to run GDM (GNOME Display Manager) and LightDM properly, giving the user a full graphic interface experience, with login and everything. Here are the [install instructions](https://packagecloud.io/arkane-systems/wsl-translinux/install). As of July 2nd, 2020, these following commands are needed to install it:
    ```
    $ curl -s https://packagecloud.io/install/repositories/arkane-systems/wsl-translinux/script.deb.sh | sudo bash
    $ sudo apt install systemd-genie
  5. @tdcosta100 tdcosta100 revised this gist Jul 7, 2020. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -183,6 +183,8 @@ After logging in, the screen will be blank. This is because a new instance of Xv

    In the output, you must see what command line was generated for Xvnc, and which error messages appear. Of course, even if it works correctly, you can check the logs just to see what is happening, or for debugging.

    1. If you are using LightDM, you also need to check logs at /var/log/lightdm (you will need to use sudo to cat files in that directory). The Xvnc output will be in the file /var/log/lightdm/x-0.log.

    1. If you can connect to 59XX ports, but receive an error like ```Authentication failure: No password configured for VNC Auth```, the file $HOME/.vnc/passwd is missing for that particular user (on port 5900, the user is gdm). Try to repeat the steps described in section [Creating VNC Server passwords](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#creating-vnc-server-passwords) and try to connect again.

    1. If it still doesn't work, you can try to restart WSL. Open a Windows PowerShell command prompt, and execute the following command (don't forget to save everything that is unsaved before, because WSL will shut down completely):
  6. @tdcosta100 tdcosta100 revised this gist Jul 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -97,7 +97,7 @@ By default, the display manager call multiple X instances, one for each user ses
    $ sudo nano /usr/bin/Xorg
    ```

    3. Paste the following content in the editor:
    3. Paste the following content in the editor (remember, WSL shell uses CTRL + SHIFT + V for pasting, instead our traditional CTRL + V key combination):

    ```
    #!/bin/bash
  7. @tdcosta100 tdcosta100 revised this gist Jul 7, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -168,7 +168,7 @@ Doing this is like booting Linux again, this time with systemd. Because of syste

    After a while (usually 30 seconds), you can test if it's working properly. Use your favorite VNC Viewer to connect to your localhost port 5900. Use the VNC password set for user gdm. The login screen must appear.

    After logging in, the screen will be blank. This is because a new instance of Xvnc was created for user desktop, listening to port 5901. Connect to this screen now. The logged user's desktop must appear. When you log out, the screen at port 5900 will show the login interface again.
    After logging in, the screen will be blank. This is because a new instance of Xvnc was created for user desktop, listening to port 5901. Connect to this screen now. The logged user's desktop must appear. When you log out, the screen at port 5900 will show the login interface again. This applies to GDM (which is the case if you installed Ubuntu Desktop). If you are using LightDM, the desktop screen will appear in port 5900, so there's no need to connect to port 5901.

    ## Tips and tricks

  8. @tdcosta100 tdcosta100 revised this gist Jul 6, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additio

    The key components we need to install are `tigervnc-standalone-server` and [`systemd-genie`](https://github.com/arkane-systems/genie).

    For this setup, I will use Ubuntu 20.04 LTS (Focal Fossa), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI.
    For this setup, I will use Ubuntu 20.04 LTS (Focal Fossa), and install GNOME Desktop. Since the key components aren't bound to Ubuntu or GNOME, you can use your favorite distro and GUI. Check the [Sample screenshots](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#sample-screenshots) section for examples.

    So let's go. First, we need a working [WSL2](https://docs.microsoft.com/pt-br/windows/wsl/wsl2-index) installation.

  9. @tdcosta100 tdcosta100 revised this gist Jul 6, 2020. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -195,27 +195,27 @@ After logging in, the screen will be blank. This is because a new instance of Xv
    ## Sample screenshots

    ### GDM
    [GDM](https://user-images.githubusercontent.com/708549/86651126-cce7c480-bfd2-11ea-8f74-b1127bc36a77.png)
    ![GDM](https://user-images.githubusercontent.com/708549/86651126-cce7c480-bfd2-11ea-8f74-b1127bc36a77.png)


    ### LightDM
    [LightDM](https://user-images.githubusercontent.com/708549/86651404-06203480-bfd3-11ea-8275-e7914f80b1b2.png)
    ![LightDM](https://user-images.githubusercontent.com/708549/86651404-06203480-bfd3-11ea-8275-e7914f80b1b2.png)


    ### GNOME
    [GNOME](https://user-images.githubusercontent.com/708549/86651633-37990000-bfd3-11ea-9b06-f48c6dce22a9.png)
    ![GNOME](https://user-images.githubusercontent.com/708549/86651633-37990000-bfd3-11ea-9b06-f48c6dce22a9.png)


    ### KDE
    [KDE](https://user-images.githubusercontent.com/708549/86651717-4a133980-bfd3-11ea-8c67-7349351e5bba.png)
    ![KDE](https://user-images.githubusercontent.com/708549/86651717-4a133980-bfd3-11ea-8c67-7349351e5bba.png)


    ### Xfce
    [Xfce](https://user-images.githubusercontent.com/708549/86651798-5ac3af80-bfd3-11ea-993e-d8ed938f7262.png)
    ![Xfce](https://user-images.githubusercontent.com/708549/86651798-5ac3af80-bfd3-11ea-993e-d8ed938f7262.png)


    ### Budgie Desktop
    [Budgie Desktop](https://user-images.githubusercontent.com/708549/86651902-729b3380-bfd3-11ea-8aab-7f4ad14099c1.png)
    ![Budgie Desktop](https://user-images.githubusercontent.com/708549/86651902-729b3380-bfd3-11ea-8aab-7f4ad14099c1.png)


    ## Contributors
  10. @tdcosta100 tdcosta100 revised this gist Jul 6, 2020. 1 changed file with 26 additions and 0 deletions.
    26 changes: 26 additions & 0 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -192,6 +192,32 @@ After logging in, the screen will be blank. This is because a new instance of Xv

    After that, open your distro shell again and repeat the steps of section [Running systemd-genie](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#running-systemd-genie).

    ## Sample screenshots

    ### GDM
    [GDM](https://user-images.githubusercontent.com/708549/86651126-cce7c480-bfd2-11ea-8f74-b1127bc36a77.png)


    ### LightDM
    [LightDM](https://user-images.githubusercontent.com/708549/86651404-06203480-bfd3-11ea-8275-e7914f80b1b2.png)


    ### GNOME
    [GNOME](https://user-images.githubusercontent.com/708549/86651633-37990000-bfd3-11ea-9b06-f48c6dce22a9.png)


    ### KDE
    [KDE](https://user-images.githubusercontent.com/708549/86651717-4a133980-bfd3-11ea-8c67-7349351e5bba.png)


    ### Xfce
    [Xfce](https://user-images.githubusercontent.com/708549/86651798-5ac3af80-bfd3-11ea-993e-d8ed938f7262.png)


    ### Budgie Desktop
    [Budgie Desktop](https://user-images.githubusercontent.com/708549/86651902-729b3380-bfd3-11ea-8aab-7f4ad14099c1.png)


    ## Contributors

    Thanks to this guys, whose feedback made this tutorial reach the current level of quality and completeness (and it will be more and more complete as more feedback is given).
  11. @tdcosta100 tdcosta100 revised this gist Jul 6, 2020. 1 changed file with 7 additions and 2 deletions.
    9 changes: 7 additions & 2 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -66,12 +66,17 @@ The installation process is finally done.

    ### Creating VNC Server passwords

    1. In this setup, each user has a different VNC password. So you have to configure at least two passwords, one for the current user, and other for gdm, who whill present the login screen. If you don't configure the password, you won't able to access the login screen, or the user's desktop. First, let's configure the VNC password current user:
    1. In this setup, each user has a different VNC password. So you have to configure at least three passwords, one for the current user, other for root, and other for gdm, who whill present the login screen. If you don't configure the password, you won't able to access the login screen, or the user's desktop. First, let's configure the VNC password current user:
    ```
    $ vncpasswd
    ```

    1. Now, let's configure the VNC password for gdm:
    1. Now, let's configure the VNC password for root (nedded if you use LightDM instead GDM):
    ```
    $ sudo vncpasswd
    ```

    1. Finally, let's configure the VNC password for gdm:
    ```
    $ sudo -u gdm vncpasswd
    ```
  12. @tdcosta100 tdcosta100 revised this gist Jul 6, 2020. 1 changed file with 4 additions and 1 deletion.
    5 changes: 4 additions & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -106,6 +106,9 @@ By default, the display manager call multiple X instances, one for each user ses
    # -keeptty is not supported at all by Xvnc
    -keeptty)
    ;;
    # -novtswitch is not supported at all by Xvnc
    -novtswitch)
    ;;
    # other arguments are kept intact
    *)
    set -- "$@" "$arg"
    @@ -114,7 +117,7 @@ By default, the display manager call multiple X instances, one for each user ses
    done
    # Here you can change or add options to fit your needs
    command=("/usr/bin/Xvnc" "-geometry" "1024x768" "-PasswordFile" "$HOME/.vnc/passwd" "$@")
    command=("/usr/bin/Xvnc" "-geometry" "1024x768" "-PasswordFile" "${HOME:-/root}/.vnc/passwd" "$@")
    systemd-cat -t /usr/bin/Xorg echo "Starting Xvnc:" "${command[@]}"
  13. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -186,7 +186,7 @@ After logging in, the screen will be blank. This is because a new instance of Xv

    ## Contributors

    Thanks to this guys, whose feedback made this tutorial reach the current level of completeness (and it will be more and more complete as more feedback is given).
    Thanks to this guys, whose feedback made this tutorial reach the current level of quality and completeness (and it will be more and more complete as more feedback is given).

    - [nselimis](https://www.reddit.com/user/nselimis/)
    - [rkzdota](https://www.reddit.com/user/rkzdota/)
  14. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # WSL2 with GUI using VNC

    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer ([RealVNC](https://www.realvnc.com/pt/connect/download/viewer/), [TightVNC](https://www.tightvnc.com/download.php), [TigerVNC](https://bintray.com/tigervnc/stable/tigervnc/1.10.1), [UVNC] (https://www.uvnc.com/downloads/ultravnc.html), etc, all of them might work flawlessly).
    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer ([RealVNC](https://www.realvnc.com/pt/connect/download/viewer/), [TightVNC](https://www.tightvnc.com/download.php), [TigerVNC](https://bintray.com/tigervnc/stable/tigervnc/1.10.1), [UVNC](https://www.uvnc.com/downloads/ultravnc.html), etc, all of them might work flawlessly).

    The key components we need to install are `tigervnc-standalone-server` and [`systemd-genie`](https://github.com/arkane-systems/genie).

  15. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # WSL2 with GUI using VNC

    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer ([RealVNC](https://www.realvnc.com/pt/connect/download/viewer/), [TightVNC](https://www.tightvnc.com/download.php), [TigerVNC](https://bintray.com/tigervnc/stable/tigervnc/1.10.1), UVNC (https://www.uvnc.com/downloads/ultravnc.html), etc, all of them might work flawlessly).
    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer ([RealVNC](https://www.realvnc.com/pt/connect/download/viewer/), [TightVNC](https://www.tightvnc.com/download.php), [TigerVNC](https://bintray.com/tigervnc/stable/tigervnc/1.10.1), [UVNC] (https://www.uvnc.com/downloads/ultravnc.html), etc, all of them might work flawlessly).

    The key components we need to install are `tigervnc-standalone-server` and [`systemd-genie`](https://github.com/arkane-systems/genie).

  16. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 10 additions and 2 deletions.
    12 changes: 10 additions & 2 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # WSL2 with GUI using VNC

    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, all of them might work flawlessly).
    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer ([RealVNC](https://www.realvnc.com/pt/connect/download/viewer/), [TightVNC](https://www.tightvnc.com/download.php), [TigerVNC](https://bintray.com/tigervnc/stable/tigervnc/1.10.1), UVNC (https://www.uvnc.com/downloads/ultravnc.html), etc, all of them might work flawlessly).

    The key components we need to install are `tigervnc-standalone-server` and [`systemd-genie`](https://github.com/arkane-systems/genie).

    @@ -182,4 +182,12 @@ After logging in, the screen will be blank. This is because a new instance of Xv
    PS > wsl --terminate <your distro name>
    ```

    After that, open your distro shell again and repeat the steps of section [Running systemd-genie](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#running-systemd-genie).
    After that, open your distro shell again and repeat the steps of section [Running systemd-genie](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#running-systemd-genie).

    ## Contributors

    Thanks to this guys, whose feedback made this tutorial reach the current level of completeness (and it will be more and more complete as more feedback is given).

    - [nselimis](https://www.reddit.com/user/nselimis/)
    - [rkzdota](https://www.reddit.com/user/rkzdota/)
    - [WSL_subreddit_mod](https://www.reddit.com/user/WSL_subreddit_mod/)
  17. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # WSL2 with GUI using VNC

    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, all of them might work flawlessly).
    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, UVNC, all of them might work flawlessly).

    The key components we need to install are `tigervnc-standalone-server` and [`systemd-genie`](https://github.com/arkane-systems/genie).

  18. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # WSL2 with GUI using VNC

    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, all of them must work flawlessly).
    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, all of them might work flawlessly).

    The key components we need to install are `tigervnc-standalone-server` and [`systemd-genie`](https://github.com/arkane-systems/genie).

  19. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    # WSL2 with GUI using VNC

    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required.
    In this tutorial, we will setup GUI in WSL2, and access it using VNC. No additional software outside WSL (like VcXsrv) is required, except, of course, a VNC Viewer (RealVNC, TightVNC, TigerVNC, all of them must work flawlessly).

    The key components we need to install are `tigervnc-standalone-server` and [`systemd-genie`](https://github.com/arkane-systems/genie).

  20. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -164,7 +164,7 @@ After logging in, the screen will be blank. This is because a new instance of Xv

    ## Tips and tricks

    - VNC is a very adaptive protocol, and by default tries to use the most aggressive compression available, for better networking performance. But in our case, doing this only adds unnecessary CPU extra load, since you are connecting to localhost ("infinite" bandwith, near zero ping). To remove all compression algorithms and reduce lagging, force your VNC client to connect using RAW encoding. The performance gain is noticeable, specially when playing videos (not a spectacular performance in this particular scenario, though).
    - VNC is a very adaptive protocol, and by default tries to use the most aggressive compression available, for better networking performance. But in our case, doing this only adds unnecessary CPU extra load, since you are connecting to localhost ("infinite" bandwith, near zero ping). To remove all compression algorithms and reduce lagging, force your VNC Viewer to connect using RAW encoding. The performance gain is noticeable, specially when playing videos (not a spectacular performance in this particular scenario, though).

    ## Troubleshooting

  21. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -173,7 +173,7 @@ After logging in, the screen will be blank. This is because a new instance of Xv
    $ journalctl -t /usr/lib/gdm3/gdm-x-session -t /usr/bin/Xorg
    ```

    There you must see what command line was generated for Xvnc, and which error messages appear. Of course, even if it works correctly, you can check the logs just to see what is happening, or for debugging.
    In the output, you must see what command line was generated for Xvnc, and which error messages appear. Of course, even if it works correctly, you can check the logs just to see what is happening, or for debugging.

    1. If you can connect to 59XX ports, but receive an error like ```Authentication failure: No password configured for VNC Auth```, the file $HOME/.vnc/passwd is missing for that particular user (on port 5900, the user is gdm). Try to repeat the steps described in section [Creating VNC Server passwords](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#creating-vnc-server-passwords) and try to connect again.

  22. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -169,17 +169,17 @@ After logging in, the screen will be blank. This is because a new instance of Xv
    ## Troubleshooting

    1. If it doesn't work at first, try to check your journalctl logs:
    ```
    $ journalctl -t /usr/lib/gdm3/gdm-x-session -t /usr/bin/Xorg
    ```
    ```
    $ journalctl -t /usr/lib/gdm3/gdm-x-session -t /usr/bin/Xorg
    ```

    There you must see what command line was generated for Xvnc, and which error messages appear. Of course, even if it works correctly, you can check the logs just to see what is happening, or for debugging.
    There you must see what command line was generated for Xvnc, and which error messages appear. Of course, even if it works correctly, you can check the logs just to see what is happening, or for debugging.

    1. If you can connect to 59XX ports, but receive an error like ```Authentication failure: No password configured for VNC Auth```, the file $HOME/.vnc/passwd is missing for that particular user (on port 5900, the user is gdm). Try to repeat the steps described in section [Creating VNC Server passwords](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#creating-vnc-server-passwords) and try to connect again.

    1. If it still doesn't work, you can try to restart WSL. Open a Windows PowerShell command prompt, and execute the following command (don't forget to save everything that is unsaved before, because WSL will shut down completely):
    ```
    PS > wsl --terminate <your distro name>
    ```
    ```
    PS > wsl --terminate <your distro name>
    ```

    After that, open your distro shell again and repeat the steps of section [Running systemd-genie](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#running-systemd-genie).
    After that, open your distro shell again and repeat the steps of section [Running systemd-genie](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#running-systemd-genie).
  23. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 20 additions and 4 deletions.
    24 changes: 20 additions & 4 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -73,9 +73,7 @@ The installation process is finally done.

    1. Now, let's configure the VNC password for gdm:
    ```
    $ sudo -u gdm bash
    $ vncpasswd
    $ exit
    $ sudo -u gdm vncpasswd
    ```

    You can repeat the process for other existing users.
    @@ -166,4 +164,22 @@ After logging in, the screen will be blank. This is because a new instance of Xv

    ## Tips and tricks

    - VNC is a very adaptive protocol, and by default tries to use the most aggressive compression available, for better networking performance. But in our case, doing this only adds unnecessary CPU extra load, since you are connecting to localhost ("infinite" bandwith, near zero ping). To remove all compression algorithms and reduce lagging, force your VNC client to connect using RAW encoding. The performance gain is noticeable, specially when playing videos (not a spectacular performance in this particular scenario, though).
    - VNC is a very adaptive protocol, and by default tries to use the most aggressive compression available, for better networking performance. But in our case, doing this only adds unnecessary CPU extra load, since you are connecting to localhost ("infinite" bandwith, near zero ping). To remove all compression algorithms and reduce lagging, force your VNC client to connect using RAW encoding. The performance gain is noticeable, specially when playing videos (not a spectacular performance in this particular scenario, though).

    ## Troubleshooting

    1. If it doesn't work at first, try to check your journalctl logs:
    ```
    $ journalctl -t /usr/lib/gdm3/gdm-x-session -t /usr/bin/Xorg
    ```

    There you must see what command line was generated for Xvnc, and which error messages appear. Of course, even if it works correctly, you can check the logs just to see what is happening, or for debugging.

    1. If you can connect to 59XX ports, but receive an error like ```Authentication failure: No password configured for VNC Auth```, the file $HOME/.vnc/passwd is missing for that particular user (on port 5900, the user is gdm). Try to repeat the steps described in section [Creating VNC Server passwords](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#creating-vnc-server-passwords) and try to connect again.

    1. If it still doesn't work, you can try to restart WSL. Open a Windows PowerShell command prompt, and execute the following command (don't forget to save everything that is unsaved before, because WSL will shut down completely):
    ```
    PS > wsl --terminate <your distro name>
    ```

    After that, open your distro shell again and repeat the steps of section [Running systemd-genie](https://gist.github.com/tdcosta100/385636cbae39fc8cd0937139e87b1c74#running-systemd-genie).
  24. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -116,14 +116,14 @@ By default, the display manager call multiple X instances, one for each user ses
    done
    # Here you can change or add options to fit your needs
    command=("/usr/bin/Xvnc" "-geometry" "1920x1080" "-PasswordFile" "$HOME/.vnc/passwd" "$@")
    command=("/usr/bin/Xvnc" "-geometry" "1024x768" "-PasswordFile" "$HOME/.vnc/passwd" "$@")
    systemd-cat -t /usr/bin/Xorg echo "Starting Xvnc:" "${command[@]}"
    exec "${command[@]}"
    ```

    Please note the resolution of the virtual screen. You can change that to fit your needs (1366x768, 1920x1080, etc).
    Please note the resolution of the virtual screen. You can change that to fit your needs (1366x768, 1920x1080, etc). Also, you can change the ```-PasswordFile``` option to point to a fixed location instead the home of current user, so you don't need to have a password for each user.

    4. Finally, we set the correct permissions for the file.
    ```
  25. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -116,7 +116,11 @@ By default, the display manager call multiple X instances, one for each user ses
    done
    # Here you can change or add options to fit your needs
    exec "/usr/bin/Xvnc" -geometry 1024x768 -PasswordFile $HOME/.vnc/passwd "$@"
    command=("/usr/bin/Xvnc" "-geometry" "1920x1080" "-PasswordFile" "$HOME/.vnc/passwd" "$@")
    systemd-cat -t /usr/bin/Xorg echo "Starting Xvnc:" "${command[@]}"
    exec "${command[@]}"
    ```

    Please note the resolution of the virtual screen. You can change that to fit your needs (1366x768, 1920x1080, etc).
  26. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -156,7 +156,7 @@ Doing this is like booting Linux again, this time with systemd. Because of syste

    ## Accessing the VNC screen

    After a while (usually 30 seconds), you can test if it's working properly. Use your favorite VNC Viewer to connect to port 5900. Use the VNC password set for user gdm. The login screen must appear.
    After a while (usually 30 seconds), you can test if it's working properly. Use your favorite VNC Viewer to connect to your localhost port 5900. Use the VNC password set for user gdm. The login screen must appear.

    After logging in, the screen will be blank. This is because a new instance of Xvnc was created for user desktop, listening to port 5901. Connect to this screen now. The logged user's desktop must appear. When you log out, the screen at port 5900 will show the login interface again.

  27. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -156,7 +156,7 @@ Doing this is like booting Linux again, this time with systemd. Because of syste

    ## Accessing the VNC screen

    After a while (usually 30 seconds), you can test if it's working properly. Use your favorite VNC client to connect to port 5900. Use the VNC password set for user gdm. The login screen must appear.
    After a while (usually 30 seconds), you can test if it's working properly. Use your favorite VNC Viewer to connect to port 5900. Use the VNC password set for user gdm. The login screen must appear.

    After logging in, the screen will be blank. This is because a new instance of Xvnc was created for user desktop, listening to port 5901. Connect to this screen now. The logged user's desktop must appear. When you log out, the screen at port 5900 will show the login interface again.

  28. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -162,4 +162,4 @@ After logging in, the screen will be blank. This is because a new instance of Xv

    ## Tips and tricks

    - VNC is a very adaptive protocol, and by default tries to use the most aggressive compression available, for better networking performance. But in our case, doing this only adds unnecessary CPU extra load, since you are connecting to localhost ("infinite" bandwith, near zero ping). To remove all compression algorithms and reduce lagging, force your VNC client to connect using RAW protocol. The performance gain is noticeable, specially when playing videos (not a spectacular performance in this particular scenario, though).
    - VNC is a very adaptive protocol, and by default tries to use the most aggressive compression available, for better networking performance. But in our case, doing this only adds unnecessary CPU extra load, since you are connecting to localhost ("infinite" bandwith, near zero ping). To remove all compression algorithms and reduce lagging, force your VNC client to connect using RAW encoding. The performance gain is noticeable, specially when playing videos (not a spectacular performance in this particular scenario, though).
  29. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 5 additions and 1 deletion.
    6 changes: 5 additions & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -158,4 +158,8 @@ Doing this is like booting Linux again, this time with systemd. Because of syste

    After a while (usually 30 seconds), you can test if it's working properly. Use your favorite VNC client to connect to port 5900. Use the VNC password set for user gdm. The login screen must appear.

    After logging in, the screen will be blank. This is because a new instance of Xvnc was created for user desktop, listening to port 5901. Connect to this screen now. The logged user's desktop must appear. When you log out, the screen at port 5900 will show the login interface again.
    After logging in, the screen will be blank. This is because a new instance of Xvnc was created for user desktop, listening to port 5901. Connect to this screen now. The logged user's desktop must appear. When you log out, the screen at port 5900 will show the login interface again.

    ## Tips and tricks

    - VNC is a very adaptive protocol, and by default tries to use the most aggressive compression available, for better networking performance. But in our case, doing this only adds unnecessary CPU extra load, since you are connecting to localhost ("infinite" bandwith, near zero ping). To remove all compression algorithms and reduce lagging, force your VNC client to connect using RAW protocol. The performance gain is noticeable, specially when playing videos (not a spectacular performance in this particular scenario, though).
  30. @tdcosta100 tdcosta100 revised this gist Jul 5, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion WSL2GUIVNC-en.md
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,7 @@ $ sudo apt install dotnet-runtime-3.1

    ### Installing systemd-genie

    Now we will install systemd-genie, which is responsible for turning the minimalist WSL into a more complete Linux instance, with systemd and other related stuff. This is necessary to run GDM (GNOME Display Manager) properly, giving the user a full graphic interface experience, with login and everything. Here are the [install instructions](https://packagecloud.io/arkane-systems/wsl-translinux/install). As of september 2nd, 2020, these following commands are needed to install it:
    Now we will install systemd-genie, which is responsible for turning the minimalist WSL into a more complete Linux instance, with systemd and other related stuff. This is necessary to run GDM (GNOME Display Manager) properly, giving the user a full graphic interface experience, with login and everything. Here are the [install instructions](https://packagecloud.io/arkane-systems/wsl-translinux/install). As of July 2nd, 2020, these following commands are needed to install it:
    ```
    $ curl -s https://packagecloud.io/install/repositories/arkane-systems/wsl-translinux/script.deb.sh | sudo bash
    $ sudo apt install systemd-genie