create zip file in script and add documentation
Catalin-Emil Fetoiu committed
Aug 21, 2023 at 17:11 UTC
1643267e47dea8d9f4d79e01d68e58017deb4203
2 files changed
+49
-5
CONTRIBUTING.md
+26
-1
@@ -119,7 +119,32 @@ Availability Capabilities CapabilityDescriptions
119
120
#### Networking issues
121
122
-If the issue is about networking, run [networking.bat](https://github.com/Microsoft/WSL/blob/master/diagnostics/networking.bat) in an administrative command prompt:
122
+Install tcpdump in your WSL distribution using the following commands.
123
+Note: This might not work if WSL has Internet connectivity issues.
124
+
125
+```
126
+# sudo apt-get update
127
+# sudo apt-get -y install tcpdump
128
+```
129
+
130
+Run [networking_diagnostics.bat](https://github.com/Microsoft/WSL/blob/master/diagnostics/networking_diagnostics.bat) in an administrative command prompt:
131
+
132
+```
133
+$ git clone https://github.com/microsoft/WSL --depth=1 %tmp%\WSL
134
+$ cd %tmp%\WSL\diagnostics
135
+$ networking_diagnostics.bat
136
+```
137
+
138
+Note:
139
+If tcpdump is installed, the script will open 2 more shells, one of which will ask for your sudo password.
140
+If tcpdump is not installed, only 1 additional shell will be opened
141
+Wait for those shells to be opened before reproducing the issue
142
+
143
+After reproducing the issue, in the shell that asked for your sudo password, hit Ctrl + C. In the other shells, press any key.
144
+
145
+Collect `WslNetworkingLogs.zip`
146
+
147
+Run [networking.bat](https://github.com/Microsoft/WSL/blob/master/diagnostics/networking.bat) in an administrative command prompt:
148
149
```
150
$ git clone https://github.com/microsoft/WSL --depth=1 %tmp%\WSL
diagnostics/networking_diagnostics.bat
+23
-4
@@ -1,6 +1,12 @@
1
+set networking_folder=".\networking_logs"
2
+set neworking_logs_zip=".\WslNetworkingLogs.zip"
3
+
4
+mkdir %networking_folder%
5
+
6
+wsl.exe tr -d "\r" ^| bash < ./networking.sh > %networking_folder%\wsl_network_configuration_before.log
7
+powershell Get-NetRoute > %networking_folder%\get_netroute.log
8
+
9
powershell invoke-expression 'cmd /c start powershell -Command { .\collect-wsl-logs.ps1 }'
2
-wsl.exe tr -d "\r" ^| bash < ./networking.sh > wsl_network_configuration_before.log
3
-powershell Get-NetRoute > get_netroute.log
10
powershell invoke-expression 'cmd /c start powershell -Command { "wsl.exe sudo tcpdump -n -i any > tcpdump.log" }'
11
12
wpr -start .\wsl_networking.wprp -filemode -instanceName wpr_networking
@@ -9,10 +15,23 @@ netsh wfp capture start
15
16
pause
17
18
+:: allow some time for the user to stop logs in all the spawned shells
19
+:: (particularly the shell running collect-wsl-logs.ps1 will take a bit to stop)
20
+timeout 20
21
+
22
netsh wfp capture stop
23
pktmon stop
14
-wpr -stop wsl_networking.etl -instanceName wpr_networking
24
+wpr -stop %networking_folder%\wsl_networking.etl -instanceName wpr_networking
25
+
26
+wsl.exe tr -d "\r" ^| bash < ./networking.sh > %networking_folder%\wsl_network_configuration_after.log
27
+
28
+move tcpdump.log %networking_folder%
29
+move PktMon.etl %networking_folder%
30
+move wfpdiag.cab %networking_folder%
31
+move "*zip" %networking_folder%
32
+
33
+powershell Compress-Archive -Path %networking_folder% -DestinationPath %neworking_logs_zip%
34
16
-wsl.exe tr -d "\r" ^| bash < ./networking.sh > wsl_network_configuration_after.log
35
+rmdir /s /q %networking_folder%
36
37
echo "Finished log collection"
\ No newline at end of file