EC2 Windows server 2022 not able to install WSL2

0

Hi All, I am trying to install WSL2 on EC2 instance ( instance type: c5.xlarge and Windows server 2022 base AMI). I am getting following error: Downloading: Ubuntu 22.04 LTS Installing: Ubuntu 22.04 LTS Ubuntu 22.04 LTS has been installed. Launching Ubuntu 22.04 LTS... Installing, this may take a few minutes... WslRegisterDistribution failed with error: 0x80370102 Please enable the Virtual Machine Platform Windows feature and ensure virtualization is enabled in the BIOS. For information please visit https://aka.ms/enablevirtualization Press any key to continue... As per the error and the issues I saw it seems I need to enabled nested virtualization in parent HyperV. How do I enable this since I dont have access to parent Hypervisor for my EC2 machine? Does EC2 support installing WSL2 for other than .metal instances?

asked 2 months ago300 views
1 Answer
1
Accepted Answer

Hello Sameer,

You can't install WSL2 on most EC2 instances.

WSL2 requires nested virtualization, which is not supported on regular EC2 instances. You can only use WSL1.

If you need WSL2, you might need a special type of EC2 instance called ".metal".

1.How do I enable this since I dont have access to parent Hypervisor for my EC2 machine?

You cannot enable nested virtualization on a standard EC2 instance.  

  • Nested virtualization requires direct access to the hardware, which isn't possible in a regular EC2 environment.

2.Does EC2 support installing WSL2 for other than .metal instances?

No, EC2 does not support installing WSL2 on instances other than .metal instances.

WSL2 requires nested virtualization, which is only available on .metal instances that provide direct hardware access.

Try to Do:

  • Try WSL1: It's a simpler version and might work on your EC2 instance.
  • Consider using a different Linux environment: There are other options like SSH-ing into a Linux EC2 instance.

Refer to the official AWS documentation for details on WSL on EC2: https://docs.aws.amazon.com/simspaceweaver/1.15/userguide/setting-up_local_wsl.html

profile picture
EXPERT
answered 2 months ago
profile picture
EXPERT
reviewed 2 months ago
profile picture
EXPERT
reviewed 2 months ago
profile picture
EXPERT
Sandeep
reviewed 2 months ago
profile picture
EXPERT
reviewed 2 months ago
  • I encounter another issue when I use WSL1. I want to start the EC2 instance using a userdata script which will start a Linux process inside WSL Ubuntu. The userdata script uses System user and the System user gets "Access is denied" when it starts WSL. I tried many things but System user is not able to start wsl if its WSL1. Is there any way I can give access to WSL1 for System user?

  • Unfortunately, there's no direct way to grant specific access to WSL1 for a system user.

    WSL1 is typically designed for interactive use by individual users. Running it as a system service or under a system user often encounters limitations.

    Alternative Approaches:

    1. Create a dedicated user: Create a standard user with necessary permissions to run WSL1 and execute your script under this user's context.
    2. Use a scheduled task: Schedule the script to run as an administrator, but be cautious about security implications.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions