pep-dortmund / homepage-toolbox

Website for the PeP et al. Toolbox Workshop at TU Dortmund
http://toolbox.pep-dortmund.org
3 stars 1 forks source link

An issue with the wsl2 and the Xserver setup #118

Closed LuckyJosh closed 2 years ago

LuckyJosh commented 3 years ago

If we should ever decide to change from the WSL1 to the WSL2, we have to fix the DISPLAY config.

Currently we use

echo "export DISPLAY=localhost:0.0" >> ~/.bashrc

to setup the connection to the XDisplay. Since the WSL2 <superficial knowledge> has its own kernel and is not just a layer of some kind it has its own IP address and </superficial knowledge> we cant use localhost anymore.

I found this neat grep command to get the IP address from a file in the WSL2 filesystem:

grep -oP "(?<=nameserver ).+" /etc/resolv.conf

This localhost in the above settings can be substituted by this grep command to fix the problem:

echo "export DISPLAY='$(grep -oP "(?<=nameserver ).+" /etc/resolv.conf):0.0'" >> ~/.bashrc

I had to look up this grep command so here is a small summary of the full story if someone is interested as well:

⇒ the result of the grep command is 123.45.678.9

LuckyJosh commented 2 years ago

See #135 for the right solution