yggdrasil-network / yggdrasil-go

An experiment in scalable routing as an encrypted IPv6 overlay network
https://yggdrasil-network.github.io
Other
3.47k stars 238 forks source link

"Failed to set up TUN address: Element not found." Win10 ltsb x64 #836

Closed accsh closed 2 years ago

accsh commented 3 years ago

Yggdrasil network (WireGuard tunnel) state: Not connected.

yggdrasil.log: 2021/09/03 13:49:41 Build name: yggdrasil 2021/09/03 13:49:41 Build version: 0.4.0 2021/09/03 13:49:41 Starting up... 2021/09/03 13:49:41 Startup complete 2021/09/03 13:49:41 Starting multicast module 2021/09/03 13:49:42 TCP admin socket listening on 127.0.0.1:9001 2021/09/03 13:49:43 Failed to set up TUN address: Element not found. 2021/09/03 13:49:43 An error occurred starting TUN/TAP: Element not found. 2021/09/03 13:49:43 Your public key is ...

setupapi.dev.log:

[SetupCopyOEMInf - C:\Windows\Temp\b1f18e34f2c6f8f435c94cf177e04e6033d6d31b7e198a139d9dd0f33cc194b8\wintun.inf] Section start 2021/09/03 02:58:50.455 cmd: "C:\Program Files\Yggdrasil\yggdrasil.exe" -useconffile "C:\ProgramData\Yggdrasil\yggdrasil.conf" -logto "C:\ProgramData\Yggdrasil\yggdrasil.log" inf: Copy style: 0x00000000 sto: {Setup Import Driver Package: C:\Windows\Temp\b1f18e34f2c6f8f435c94cf177e04e6033d6d31b7e198a139d9dd0f33cc194b8\wintun.inf} 02:58:50.459 inf: Provider: WireGuard LLC inf: Class GUID: {4D36E972-E325-11CE-BFC1-08002BE10318} inf: Driver Version: 05/10/2021,0.11.0.0 inf: Catalog File: wintun.cat pol: {Driver package policy check} 02:58:50.491 pol: {Driver package policy check - exit(0x00000000)} 02:58:50.491 sto: {Stage Driver Package: C:\Windows\Temp\b1f18e34f2c6f8f435c94cf177e04e6033d6d31b7e198a139d9dd0f33cc194b8\wintun.inf} 02:58:50.496 inf: {Query Configurability: C:\Windows\Temp\b1f18e34f2c6f8f435c94cf177e04e6033d6d31b7e198a139d9dd0f33cc194b8\wintun.inf} 02:58:50.503 inf: Driver package 'wintun.inf' is configurable. inf: {Query Configurability: exit(0x00000000)} 02:58:50.506 flq: Copying 'C:\Windows\Temp\b1f18e34f2c6f8f435c94cf177e04e6033d6d31b7e198a139d9dd0f33cc194b8\wintun.cat' to 'C:\Windows\System32\DriverStore\Temp{0e68c269-0f2f-1c41-8e40-4a2163bea92b}\wintun.cat'. flq: Copying 'C:\Windows\Temp\b1f18e34f2c6f8f435c94cf177e04e6033d6d31b7e198a139d9dd0f33cc194b8\wintun.inf' to 'C:\Windows\System32\DriverStore\Temp{0e68c269-0f2f-1c41-8e40-4a2163bea92b}\wintun.inf'. flq: Copying 'C:\Windows\Temp\b1f18e34f2c6f8f435c94cf177e04e6033d6d31b7e198a139d9dd0f33cc194b8\wintun.sys' to 'C:\Windows\System32\DriverStore\Temp{0e68c269-0f2f-1c41-8e40-4a2163bea92b}\wintun.sys'. sto: {DRIVERSTORE IMPORT VALIDATE} 02:58:50.515 sig: {_VERIFY_FILE_SIGNATURE} 02:58:50.534 sig: Key = wintun.inf sig: FilePath = C:\Windows\System32\DriverStore\Temp{0e68c269-0f2f-1c41-8e40-4a2163bea92b}\wintun.inf sig: Catalog = C:\Windows\System32\DriverStore\Temp{0e68c269-0f2f-1c41-8e40-4a2163bea92b}\wintun.cat sig: Success: File is signed in catalog. sig: {_VERIFY_FILE_SIGNATURE exit(0x00000000)} 02:58:50.541 sto: {DRIVERSTORE IMPORT VALIDATE: exit(0x00000000)} 02:58:50.543 sig: Signer Score = 0x0D000005 sig: Signer Name = Microsoft Windows Hardware Compatibility Publisher sto: {DRIVERSTORE IMPORT BEGIN} 02:58:50.544 sto: {DRIVERSTORE IMPORT BEGIN: exit(0x00000000)} 02:58:50.544 cpy: {Copy Directory: C:\Windows\System32\DriverStore\Temp{0e68c269-0f2f-1c41-8e40-4a2163bea92b}} 02:58:50.545 cpy: Target Path = C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_41596df3c5abb4c7 cpy: {Copy Directory: exit(0x00000000)} 02:58:50.546 idb: {Register Driver Package: C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_41596df3c5abb4c7\wintun.inf} 02:58:50.547 idb: Created driver package object 'wintun.inf_amd64_41596df3c5abb4c7' in DRIVERS database node. idb: Created driver INF file object 'oem18.inf' in DRIVERS database node. idb: Registered driver package 'wintun.inf_amd64_41596df3c5abb4c7' with 'oem18.inf'. idb: {Register Driver Package: exit(0x00000000)} 02:58:50.548 idb: {Publish Driver Package: C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_41596df3c5abb4c7\wintun.inf} 02:58:50.548 idb: Activating driver package 'wintun.inf_amd64_41596df3c5abb4c7'. cpy: Published 'wintun.inf_amd64_41596df3c5abb4c7\wintun.inf' to 'oem18.inf'. idb: Indexed 2 device IDs for 'wintun.inf_amd64_41596df3c5abb4c7'. sto: Flushed driver database node 'DRIVERS'. Time = 15 ms sto: Flushed driver database node 'SYSTEM'. Time = 0 ms idb: {Publish Driver Package: exit(0x00000000)} 02:58:50.559 sto: {DRIVERSTORE IMPORT END} 02:58:50.559 dvi: Flushed all driver package files to disk. Time = 0 ms sig: Installed catalog 'wintun.cat' as 'oem18.cat'. sto: {DRIVERSTORE IMPORT END: exit(0x00000000)} 02:58:50.641 sto: {Stage Driver Package: exit(0x00000000)} 02:58:50.641 ! ndv: Unable to mark devices that match new INF - (00000490)! sto: {Setup Import Driver Package - exit (0x00000000)} 02:58:50.657 inf: Driver Store Path: C:\Windows\System32\DriverStore\FileRepository\wintun.inf_amd64_41596df3c5abb4c7\wintun.inf inf: Published Inf Path: C:\Windows\INF\oem18.inf <<< Section end 2021/09/03 02:58:50.657 <<< [Exit status: SUCCESS]

And there is some errors/warnings in Windows Event Viewer but in Russian)). Hope it was helpful.

vikulin commented 3 years ago

Confirmed bug:

2021/09/15 14:23:45 TCP admin socket listening on 127.0.0.1:9001                                                                                                                                                  

2021/09/15 14:23:46 Failed to set up TUN address: Element not found.                                                                                                                                               

2021/09/15 14:23:46 An error occurred starting TUN/TAP: Element not found.
vikulin commented 3 years ago

This causes #807

Rubikoid commented 2 years ago

I faced the same error and wasted about 4 hours of debugging but the reason was on the surface. The problem was in registry key DisabledComponents = 0xFF at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\, i.e. ipv6 was totally disabled on system. Setting DisabledComponents = 0x0 and reboot solved problem. msdn ref about this thing

Idk, why windows works normally in this "disabled" ipv6 state, but everything, except wireguard's wrapper over winapi func CreateUnicastIpAddressEntry (winipcfg.luid.AddIPAddress) works normally

accsh commented 2 years ago

Great, Thanks, it works!

vikulin commented 2 years ago

I faced the same error and wasted about 4 hours of debugging but the reason was on the surface. The problem was in registry key DisabledComponents = 0xFF at HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip6\Parameters\, i.e. ipv6 was totally disabled on system. Setting DisabledComponents = 0x0 and reboot solved problem. msdn ref about this thing

Idk, why windows works normally in this "disabled" ipv6 state, but everything, except wireguard's wrapper over winapi func CreateUnicastIpAddressEntry (winipcfg.luid.AddIPAddress) works normally

The solution did not work for me: issue is still reproducing. I noticed that interface is starting after Windows boot and take some time to become it ready. This is the root cause: yggdrasil service is trying to configure not-ready interface.

vikulin commented 2 years ago

Fixed it by adding backoff period: https://github.com/RiV-chain/RiV-mesh/commit/ecbd6e8cde640c5cff6f3f2fb4714dd90dec8104