Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add instructions for WSL2 #3

Closed
6 tasks
hubisan opened this issue Feb 10, 2020 · 7 comments · Fixed by #37
Closed
6 tasks

add instructions for WSL2 #3

hubisan opened this issue Feb 10, 2020 · 7 comments · Fixed by #37
Assignees
Labels
new feature New feature or request waiting No action possible at the moment

Comments

@hubisan
Copy link
Owner

hubisan commented Feb 10, 2020

Will adapt README.org once WSL2 it for non-insiders as well
(Update 25.09.2020: got access WSL2 on one computer, will have a go and try to get this working)

TODOs from everything in here so far:

Helpful links to set up up WSL2:

@hubisan hubisan self-assigned this Feb 10, 2020
@hubisan hubisan added new feature New feature or request documentation labels Feb 10, 2020
@psmith1303
Copy link

I forgot where I found this solution for the IP address under WSL2, but it works for me.

#
# Set up the DISPLAY for emacs
#
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0
#
# Setup HOME for emacs
#
export HOME=/mnt/c/Users/psmith/
cd $HOME

That said, one also need to run the X server so it accepts non-local connections, and change Windows Defender firewall to. I did a gross 'hack' and just turned it off the Public firewall.

@hubisan
Copy link
Owner Author

hubisan commented Apr 7, 2020

Thanks for the input. Don't have the need and time to try WSL2 atm.

Here is a link to setup the firewall it seems to make it secure:
microsoft/WSL#4106 (comment)

@hubisan
Copy link
Owner Author

hubisan commented Apr 21, 2020

Another link that helps with WSL2 setup:
post on reddit > Installing emacs on WSL2 with Windows, but it works

To properly connect the access control in VcXsrv is diabled (option -ac) so you don't have to touch the firewall settings. As mentionned this is not super safe:

Let's download VcXsrv to provide the GUI, install it ; launch it and accept the default setup, upon reaching the extra settings, complete it with the last box ticked as well, like this. I know it's not super safe. This allows WSL2 to connect properly though, per this issue and this github.

Looks like WSL makes a user for you now the first time it is started and probably sets it as default user:

Once WSL is installed, I launch it and it prompts for a username and password, I oblige.

  • TODO Have to go through the installation with WSL and WSL2 to see if it does setup a user for you and adapt the documentation accordingly.
  • TODO The post touches a few problems that might occur. Could add them to the FAQ or make a new section for problems you might encounter and the solution for it. Following problems and solutions are mentioned: blurry screen or blurred images, fragmented disk error.

@hubisan hubisan closed this as completed Apr 21, 2020
@hubisan hubisan reopened this Apr 21, 2020
@Adriankhl
Copy link

I am trying to use emacs in WSL2. A few comments about this page:

  1. Why do you recommend installing lxde desktop? You don't need a desktop environment to run emacs.

  2. Instructing how to move the storage in WSL2 to another disk (how to move the vhdx of wsl2 to other disk MicrosoftDocs/WSL#412) is very useful (for me).

  3. The solution of the memory issue (WSL 2 consumes massive amounts of RAM and doesn't return it microsoft/WSL#4166) is critical.

  4. I realized that everyone is recommending vcxsrv, and almost no discussion about Cygwin/X which (I believe) the vcxsrv is based on. However, XWin could provide some advantages (https://github.com/mviereck/runx), note that the script there doesn't work for me. It is not hard to setup, just install Cygwin (I use scoop) and run the setup again to install xinit. Then run something like cygwin.exe -c "XWin :0 -listen tcp -retro -lesspointer -multiwindow -clipboard -ac -wgl"& to start the XWindows. At first glance, emacs feels equally smooth. Maybe a benchmark is useful to distinguish between the two.

@hubisan
Copy link
Owner Author

hubisan commented May 11, 2020

@Adriankhl Thanks for your inputs.

Will be adding instructions for cygwin/x and remove the desktop installation part (made two new issues).

Will be adding WSL2 instructions once it is available to non-insiders. Hopefully the memory leakage will be fix by then. If not I will be adding it.

@ianyepan
Copy link

I had some trouble setting up X server for WSL2. Now that I solved it, thought I might contribute to this thread.
So this is the reddit thread that helped me: microsoft/WSL#4106
The TL;DR is, set DISPLAY to include the IP address of the host, and don't forget to pass -ac flag/argument when launching Vcxsrv.

@hubisan hubisan added the waiting No action possible at the moment label Aug 5, 2020
@lgrosz
Copy link

lgrosz commented Aug 20, 2020

The stuff I had to do to get it working on WSL2 was

  • Install vcxsrv, run with the -ac command
  • Run export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 on WSL2
  • Run the "Incoming Connections" trouble shooter on Windows after trying to run something graphical on WSL2

That last bit was the last hurdle for me, and I can't believe a Windows trouble shooter worked for once.

@hubisan hubisan linked a pull request Jan 12, 2021 that will close this issue
@hubisan hubisan mentioned this issue Jan 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request waiting No action possible at the moment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants