-
Notifications
You must be signed in to change notification settings - Fork 0
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
-NoNewLine not supported #5
Comments
Hi! Thank you for your report, I will correct this issue in the near future :) |
Need some info with this issue:
In my case, on POSH 5.1, the script is spreading errors at every step. I will look into this problem, but I need to know the answers to these questions :) |
Hey @widersky (Adrian), I was just using a regular POSH admin command prompt NOT from Windows Terminal. By other problems, if you mean with running other Powershell scripts, then 'No', not that I am aware of. Interestingly I just tried this again using a POSH admin command prompt AND a POSH tab in Windows Terminal (started as Admin) and got a slightly different outcome than earlier (and exactly the same in both terminals). This was from the POSH command-line:
This from Windows Terminal:
The hosts file was NOT updated. The config.json file was updated the first time I ran it ... then the second time, that change was removed. The change was (I think) the lastKnownIP array had the correct WSL IP (172.21.204.97) but concaternated with 172.17.0.1 ?? ... on the second run, all of that was removed (and so it is for all subsequent runs) ... it now looks like this:
|
@goffinf Thanks for the information, I'll focus on this problem while working on the next release. |
Hey @widersky (Adrian), I have been playing around with a variety of scripts for getting the WSL distro IP address and updating the Windows hosts file. A couple of observations which may be of use to you when you get to working on your next release (or not - but figured its worth sharing). I based my experiments on Michael Belgium's simple script, but they could apply to your more sophisticated solution also IMHO.
I have found this approach to be reliable (shown from with Powershell because the call syntax is critical .. specifically using -- instead of -e .... also note $selectedDistro - more on that below):
a. I used a specific naming convention in the hosts file, where each entry carries the name of the distribution it belongs to. For example ... these belong to my distro called 'Ubuntu-20.04'
and these to another distro configured for systemd and k8s called 'Ubuntu-20.04-systemd-k8s'
b. In the Powershell script, I prompt the user for the name of the distribution they want to work with (using a Out-GridView populated from wsl --list), .. that sets the $selectedDistro variable mentioned above ... I use that variable to select the list of domains to update, then foreach around those and update just those entries in the hosts file using the Carbon module:
Anyway, not sure if any of this is of use to you, but hopefully it is. Kind Regards Fraser. |
Hmmm, a bit more reading about network namespaces with WSL2 ... it appears that currently ALL WSL instances share the SAME network namespace because they also share the same virtual machine which has a single network interface. Therefore the IP address for all instances will also be the same ! It is possible to add another virtual ip to eth0 but AFAIK that wont be reachable from the Windows side. It is possible to create an additional network namespaces within each WSL distro and have processes attach to that ... but that isn't available OOTB and I'm not sure its worth the effort ... back to the drawing board (sigh) The tip around getting the WSL IP might still be useful though |
Thak you for your helpful knowledge @goffinf ! For now, the most important problem with WSL2 is that you cannot work with web applications on node servers: microsoft/WSL#4204 . There are a lot of similar issues on WSL github. In my case, applications based on - for example - reactjs simply do not load. None of the tricks given on the github are working. I saw that this problem disappeared and appeared back several times after Windows updates. |
You are welcome. I waited for quite a while before deciding to move from WSL1 to WSL2 (I didn’t really want to run an insiders build on my main laptop), but I too have found it to be quite a frustrating experience. I spin up a lot of Kubernetes clusters and was really hoping that multi-node and multi-cluster setup would be easier as well as configuring Ingress and LoadBalancer services, but the constantly changing IP and all WSL instances sharing the same IP have been a massive distraction rather than a step forwards. I’ll keep plugging away though, I’m a massive DevSecOps advocate and local WSL environments have a part to play. Thanks so much for adding to body of capability and knowledge. |
Hey,
Thanks for recognising this issue and putting something out there that can help.
I appreciate this script is provided with a '.. use at your own risk' caveat, but, I found the following when trying to run reset ... which you probably already know about but could consider documenting ?
... then later ...
I am running this version of POSH from an Administrator prompt on WIndows 10 Pro (build 2004):
Neither the config.json nor hosts file were actually changed.
Kind Regards
Fraser.
The text was updated successfully, but these errors were encountered: