WSL: Can't open wsl possibly after update "the data is invalid"

Version

Microsoft Windows [Version 10.0.22579.100]

WSL Version

  • WSL 2
  • WSL 1

Kernel Version

No response

Distro Version

Ubuntu 20.04

Other Software

No response

Repro Steps

wsl.exe ->

Expected Behavior

Open a wsl console

Actual Behavior

The data is invalid.
Error code: Wsl/Service/CreateInstance/CreateVm/0x8007000d

Diagnostic Logs

No response

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (1 by maintainers)

Most upvoted comments

Ok, solve to me:

1 - Travel to 14/09/2022 in my windows 2 - Open powersheel and execute: wsl update 3 - Travel back today

Here’s my “fix”:

I wrote a PowerShell script that grabs the date/time, sets it back to Sept 13, launches WSL, then sets the date back to today. In WSL, I have a script that runs in my .bashrc that ensures some necessary startup tasks are running (Redis, PostgreSQL, corn, etc) and then calls ntpdate to reset its own time/date. Opening the usual WSL window after that works just fine, at which point I “exit” the WSL that PowerShell launched, and “exit” the PowerShell script.

The first part of the script relaunches itself in Administrator mode if you don’t already run it in Administrator mode.

param([switch]$Elevated)

function Test-Admin {
    $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
    $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}

if ((Test-Admin) -eq $false)  {
    if ($elevated) {
        # tried to elevate, did not work, aborting
    } else {
        Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
    }
    exit
}

'running with full privileges'

# get current date
$date = Get-Date -Format g
$time = Get-Date -Format t

# set date to Sept 13, 2022
Set-Date -Date "09/13/2022 $time"
Get-Date

# sleep for 1 seconds
Start-Sleep -s 1
Start-Process c:\windows\system32\wsl.exe
Start-Sleep -s 10

Set-Date -Date "$date"
Get-Date

This is also happening to me. Setting the date back in time fixed it.

Why I think this is happening

I wasn’t able to update my system for months. Today, every action I take regarding the system configuration / administration now shows an UAC prompt (opening task manager, changing settings). Checking their exes, they all have one thing in common: the certificate they were signed with (Microsoft Windows) is valid until 2022-09-15. I think some WSL-related binary was signed with that certificate and some check is failing because of that.

This won’t happen if your machine is properly updated

This is happening because you are stuck on a very old Windows Insiders build (from March). Fix is to make sure you install a more recent version of Windows.