From 3fa5bf8360472a2f8605a4b67900f0f2d7dbe0e4 Mon Sep 17 00:00:00 2001 From: Andreas Weyer Date: Sun, 30 Nov 2025 22:07:29 +0000 Subject: [PATCH] Update readmes regarding wsl2 devcontainer setup --- docs/README.dev-notes.md | 19 ++++++++++--------- docs/README.devcontainer.md | 17 ++++++++++------- 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/docs/README.dev-notes.md b/docs/README.dev-notes.md index 2d22804..d54a360 100644 --- a/docs/README.dev-notes.md +++ b/docs/README.dev-notes.md @@ -144,6 +144,9 @@ First get the WSL IP address by running the following command in WSL: ```sh hostname -I + +# Or from Windows Command Prompt / PowerShell: +wsl hostname -I ``` Then use the WSL IP address (in my case `172.20.39.187`) in the following command to set up permanent port forwarding. @@ -152,8 +155,8 @@ Then use the WSL IP address (in my case `172.20.39.187`) in the following comman # Add port forwarding rule netsh interface portproxy add v4tov4 listenport=3000 listenaddress=127.0.0.1 connectport=3000 connectaddress=172.20.39.187 -# In case you need to delete the rule later, use: -netsh interface portproxy delete v4tov4 listenport=3000 listenaddress=127.0.0.1 +# Just in case you need to delete the rule later, use: +#netsh interface portproxy delete v4tov4 listenport=3000 listenaddress=127.0.0.1 ``` You should now be able to access the React dev server via `http://localhost:3000` on Windows host, instead of having to use the WSL IP address. @@ -165,14 +168,12 @@ In case you have trouble with your Windows Firewall blocking access to the forwa Run the following PowerShell commands to open the necessary port (just an example, ensure that the settings fit your security requirements): ```powershell -# Open port 3000 for inbound TCP traffic on all network interfaces -New-NetFirewallRule -DisplayName "WSL React Dev Server" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3000 - -# Do the same but only for the WSL virtual network interface -New-NetFirewallRule -DisplayName "Allow WSL Inbound Port 3000" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3000 -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))" +# Open port 3000 for inbound TCP traffic on WSL virtual network interface +New-NetFirewallRule -DisplayName "Allow WSL Inbound Port 3000" ` + -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3000 ` + -InterfaceAlias "vEthernet (WSL (Hyper-V firewall))" ``` - -Just to rule out potential firewall issues, it is always an option to temporarily disable the firewall all together. +In case the above does not resolve your issues, just to rule out potential firewall issues, it is always an option to temporarily disable the firewall all together. > WARNING: IF YOU DO THIS, DO NOT FORGET TO RE-ENABLE THE FIREWALL AFTER TESTING! diff --git a/docs/README.devcontainer.md b/docs/README.devcontainer.md index 09156f2..f885934 100644 --- a/docs/README.devcontainer.md +++ b/docs/README.devcontainer.md @@ -14,6 +14,9 @@ sudo apt install -y podman # Ensure Podman version is ≥ 4.9.3: podman --version + +# Add current user to uucp group for Podman socket access +#sudo usermod -a -G uucp $(whoami) ``` ## ⚙️ 2. Enable systemd and Podman socket @@ -34,6 +37,10 @@ wsl --shutdown Enable Podman socket: ```bash +# Enable linger to allow user services to run without active login +# Without this, the command below may return: Failed to connect to bus: No such file or directory +loginctl enable-linger $USER + systemctl --user enable --now podman.socket ``` @@ -41,12 +48,7 @@ If `podman.socket` is masked or fails to start, create a custom service: ```bash mkdir -p ~/.config/systemd/user -vim ~/.config/systemd/user/podman.service -``` - -Paste: - -```ini +cat > ~/.config/systemd/user/podman.service <