Ubuntu on wsl is inaccessible and prompts "data invalid"

Viewed 1601

After my windows inside previewer got expired, I can't access to my wsl and the terminal shows "Data invalid, [process exits with code 4294967295]". I've tried to restart it from windows powershell by "wsl --restart" but it also prompted "Data invalid". I've also tried to reboot my PC but it's still useless. How could I recover my wsl or migrate my data from it?

PS: My PC runs on win10 Pro with version 21354.co_release.210401-1630, my wsl has installed with ubuntu20.04.

4 Answers

According to https://github.com/microsoft/WSL/issues/6509

FINAL Build Expiration Reminder: We have updated the build expiration for Dev Channel builds to be 9/15/2022. Previous Dev Channel builds from the RS_PRERELEASE branch will expire on 10/31/2021. To avoid hitting this expiration, please be sure to update to the latest Dev Channel build today.

As mentioned, your build for WSL has expired. You can either update your system or change the system date to a date before October 31. If you go with the later option, here is a batch script that will expedite the process.

@ECHO OFF
FOR /F "tokens=*" %%g IN ('DATE /t') do (SET CURRENT_DATE=%%g)
DATE 10/20/2021
SET DATE_CUT=%CURRENT_DATE:~4,13%
START wsl
DATE %DATE_CUT%

It works as follows.

  1. Read the current system date into CURRENT_DATE
  2. Change the date to October 20, 2021 (before the date of expiration)
  3. Start WSL
  4. Change the system date back to CURRENT_DATE

You can save this file to your desktop with a .bat extension. Make sure to run this as administrator. Hopefully, this saves you some time.

it work。3q。 nvcc -V nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2020 NVIDIA Corporation Built on Tue_Sep_15_19:10:02_PDT_2020 Cuda compilation tools, release 11.1, V11.1.74 Build cuda_11.1.TC455_06.29069683_0

@sharkk22's .bat did not work for me initially. I had to run > netsh winsock reset in cmd.exe first, and then running the .bat works. Otherwise, the .bat starts wsl, but wsl terminates immediately. If the .bat still doesn't work for you, try rebooting after running that netsh command.

It is very important to be aware that your Linux distro in WSL will be using the falsified date, which will cause issues with package managers (e.g. apt update) as well as cause git to use incorrect timestamps. I have worked around this by setting the date and time explicitly in Linux with e.g. $ date -s "9 NOV 2021 15:30:00", it is probably worth investigating if the date/time can be corrected in WSL automatically e.g. using $ hwclock but for the moment this makes WSL fully functional again. Thanks @sharkk22.

Related