After performing a sudo systemctl poweroff
in Ubuntu in WSL and restarting, I'm seeing:
<3>WSL (814) ERROR: UtilTranslatePathList:2671: Failed to translate C:\Program Files\PowerShell\7
<3>WSL (814) ERROR: UtilTranslatePathList:2671: Failed to translate C:\Windows\System32\OpenSSH\
<3>WSL (814) ERROR: UtilTranslatePathList:2671: Failed to translate C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
<3>WSL (814) ERROR: UtilTranslatePathList:2671: Failed to translate C:\Program Files\dotnet\
...
Ubuntu starts, but no Windows drives are mounted into WSL. In addition, Ubuntu exits a short while later. After restarting, everything seems fine.
What's going on, and how can I resolve this?
Short answer:
wsl --shutdown
and restart in order to fully recover.More details:
Under the updated WSL that provides Systemd support, you can now run certain "shutdown" commands, but that doesn't mean you should. This includes:
sudo systemctl poweroff
sudo systemctl halt
sudo systemctl reboot
In all of these cases, Systemd replaces itself with the
systemd-shutdown
(see man page for more details), which continues running even after WSL reports that the distribution is no longer running (viawsl.exe -l -v
).I'm taking a bit of a guess here, but when WSL attempts to restart Ubuntu, it seems that it can't load its own
init
because PID1 is still "occupied" bysystemd-shutdown
(or perhaps becausesystemd
isn't there to call it).As a result, much of the "normal" WSL startup does not occur. This includes the Windows drive mounts as well as the
binfmt_misc
registration that allows WSL to run Windows commands. But not, apparently, the attempt to append the Windows path to the Linux path in the base environment.After the timeout (90 seconds) that you see in the command arguments above,
systemd-shutdown
will terminate, and the WSL distribution will terminate (again) with it.You could also terminate with
wsl --terminate <distro_name>
from PowerShell.In either case, the newly restarted Ubuntu will not exhibit the error messages listed in the question.
However, you will still need to
wsl --shutdown
and restart before you will regain access to the ability to run Windows commands. The "corruption" ofbinfmt_misc
will actually extend to all WSL2 distributions running on your system until awsl --shutdown
.