microsoft / devhome

The new Dev Home experience for Windows!
https://aka.ms/devhomedocs
MIT License
3.48k stars 306 forks source link

Hyper-V in environments throwing error #3351

Open crutkas opened 1 week ago

crutkas commented 1 week ago

Dev Home version

0.1501.547.0

Windows build number

10.0.22631.3874

Other software

OS Build Version: 10.0.22631.3874.amd64fre.ni_release.220506-1250 .NET Version: .NET 8.0.6

Steps to reproduce the bug

  1. Updated Dev Home to latest
  2. Click environment
  3. Get hyper-v error

Expected result

Just works cause Hyper-V Manager just works.

Actual result

hyper-v manager works yet dev home doesn't

Included System Information

CPU: Intel(R) Core(TM) Ultra 7 165H Physical Memory: 31.64GB (12.65GB free) Processor Architecture: x64

Included Extensions Information

Extensions: Microsoft.Windows.DevHomeGitHubExtension.Canary_0.1500.530.0_x648wekyb3d8bbwe (Dev Home GitHub Extension (Canary)) Microsoft.Windows.DevHomeAzureExtension.Canary_0.1000.530.0_x648wekyb3d8bbwe (Dev Home Azure Extension (Canary)) Microsoft.Windows.DevHome_0.1501.533.0_x648wekyb3d8bbwe (Core Widget Extension) Microsoft.Windows.DevHome_0.1501.533.0_x648wekyb3d8bbwe (Hyper-V Extension) Microsoft.Windows.DevHomeGitHubExtension_0.1500.533.0_x648wekyb3d8bbwe (Dev Home GitHub Extension (Preview)) Microsoft.Windows.DevHome.Canary_0.1501.547.0_x648wekyb3d8bbwe (Core Widget Extension) Microsoft.Windows.DevHome.Canary_0.1501.547.0_x64__8wekyb3d8bbwe (Hyper-V Extension)

Widget Service: MicrosoftWindows.Client.WebExperience_524.18000.0.0_x64__cw5n1h2txyewy

github-actions[bot] commented 1 week ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

bbonaby commented 1 week ago

Hey @crutkas, Which error are you talking about exactly? If you mean the request to add the user to the Hyper-v group: I explain why its needed here: https://github.com/microsoft/devhome/issues/2995#issuecomment-2130223379

crutkas commented 1 week ago

Sorry looks like the screenshot didn’t paste in.

This is adding user to hyper-v group

If hyperv manager lets me create / launch / delete without this, dev home should too

bbonaby commented 1 week ago

We can talk offline about it but we actually can't as the Hyper-V extension would need to run elevated in order to do that. The comment I linked above explains it. But under the hood Hyper-V manager is elevating (without a UAC prompt), by means we can't use in Dev Home. The only other way to allow users to interact with Hyper-V is if they are in the Hyper-V admin group. Once added to this group the users would need to log off/on again or reboot. It's a local users and groups account which is a bit of a special case, as even after being added/removed from the group the users access token that was given to them at logon, does not get updated. The Hyper-v apis are checking the users access token to confirm if they're in the group, which is why we can't just add them and have it all just work as they still won't be able to see/interact with their VMs until they've logged off/rebooted unfortunately:

Heres an excerp from a MS learn doc: How Access Tokens Work | Microsoft Learn which states

If you add a user to a group after the user’s access token has been issued, or modify privileges assigned to the user account, the user must log off and then log on again before the access token will be updated.