WSL2 Logon type problem SOLVED

About one year ago I wrote a small blog piece in Swedish regarding my problem with using WSL2 on my laptop and how to work around it by restarting the VMMS (Virtual Machine Management Service). I have been following the WSL GITHUB Issue 5401, to see if somebody would find a better solution/workaround.

After christmas (one year later) I got ”fed up” with constantly restarting the VMMS service, so I revisited the problem AND FOUND A PERMANENT SOLUTION!

The problem and solution is described in this Microsoft article for Hyper-V (I used method #3).

The solution is that your domain administrator has to add the special identity group ”NT VIRTUAL MACHINE\Virtual Machines” (SID S-1-5-83-0) to the Group Policy that modifies the ”Logon as a service” names and groups.
In my case it was the ”Default Domain Policy” that needed to be modified.

The operation (to add the special group to the GPO) has to be performed from a computer which has Hyper-V installed in some form, as the special group is local and only created when the Hyper-V functionality is enabled on the computer.

If you inspect the (fixed) Logon as service properties for the GPO from a computer without Hyper-V enabled, you will only see the Well Known SID S-1-5-83-0 in place of the group name.

This is what the group entry looks like from our domain controller

When the updated GPO has been applied to your computer, the problem is gone and you can consistently start WSL!

WSL2 inloggningsfel

Ofta när jag ska starta en WSL2-container (t.ex. Ubuntu) får jag felmeddelandet:

Inloggningsfel: Användaren har inte beviljats begärd inloggningstyp på den här datorn.
Press any key to continue...

tldr;
Workaround: kör detta/dessa kommandon i kommandotolken:
sc stop vmms && sc start vmms
/tldr;

Den lite längre versionen:
Väldigt irriterande när det händer, och det verkar som det är ett generellt Hyper-V-problem egentligen.

För att lösa problemet så brukar jag starta om servicen ”vmms” som beskrivs som ”Hyper-V Virtual Machine Management”.

Jag gör det oftast via aktivitetshanteraren, väljer fliken ”Tjänster” och scrollar ner till ”vmms”, högerklicka på den och välja ”Starta om”.

Om man kommer ihåg vad tjänsten heter (vilket jag sällan gör) så kan man ju även starta en Kommandotolk (som administratör?) och köra kommandona sc stop vmms följt av sc start vmms.

Problemet uppstår tillräckligt sällan för att man ska hinna glömma detta, men tillräckligt ofta för att det ska irritera mig…