Score:2

Multiple UtilTranslatePathList errors when restarting Ubuntu on WSL after a shutdown

vn flag

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?

Score:2
vn flag

Short answer:

  • You still shouldn't use Linux shutdown methods on a WSL2 distribution.
  • You are ultimately going to need to 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
  • Choosing any of the related Power-off or restart options in a Desktop Manager (Gnome, Xfce4, and others).

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 (via wsl.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" by systemd-shutdown (or perhaps because systemd isn't there to call it).

$ ps -fp 1
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  1 22:23 ?        00:00:00 /lib/systemd/systemd-shutdown halt --timeout 90000000us --log-level 6 --log-target console

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" of binfmt_misc will actually extend to all WSL2 distributions running on your system until a wsl --shutdown.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.