schtritoff / hyperv-vm-provisioning

Quick provisioning of Linux VM using Hyper-V on Windows
77 stars 29 forks source link

Expanding archive...WARNING: Unsupported disk image extracted. #2

Closed mathisokle closed 1 year ago

mathisokle commented 1 year ago

Hello I get this error when Im provisioning a new vm "Expanding archive...WARNING: Unsupported disk image extracted.". OS: Windows Server 2022 - Hyper-V installed.

Am I doing something wrong or am I missing something

Thanks

mathisokle commented 1 year ago

Currently this url http://cloud-images.ubuntu.com/releases/focal/release/ubuntu-20.04-server-cloudimg-amd64-azure.vhd.zip is not working. But when I change this line to: $ImageFileExtension = "vhd.zip" # or "vhd.tar.gz" on older releases $ImageFileExtension = "vhd.tar.gz" # or "vhd.tar.gz" on older releases

I get the error "Expanding archive...WARNING: Unsupported disk image extracted.".

mathisokle commented 1 year ago

Now its working but i get this error 2023/01/14 16:09:07.737378 WARNING Daemon cloud-init does not appear to be running

mathisokle commented 1 year ago

also login is not working always wrong

schtritoff commented 1 year ago

Hi

Azure images are currently not working but you can use debian 10, 11 or ubuntu generic cloud images (*.img format), for example:

New-HyperVCloudImageVM.ps1 -VMProcessorCount 2 -VMMemoryStartupBytes 1GB -VHDSizeBytes 60GB -VMName "ubuntu1804-test" -ImageVersion "18.04" -VMGeneration 2 -Verbose -Force
New-HyperVCloudImageVM.ps1 -VMProcessorCount 2 -VMMemoryStartupBytes 1GB -VHDSizeBytes 60GB -VMName "ubuntu2004-test" -ImageVersion "20.04" -VMGeneration 2 -Verbose -Force
New-HyperVCloudImageVM.ps1 -VMProcessorCount 2 -VMMemoryStartupBytes 1GB -VHDSizeBytes 60GB -VMName "ubuntu2204-test" -ImageVersion "22.04" -VMGeneration 2 -Verbose -Force

I'm working on different approach to use Azure images but for now only those generic ones work.

usrme commented 1 year ago

@schtritoff, do you know what's wrong with the Azure-specific images or a specific GitHub repository where they track the relevant efforts? I've been banging my head against the wall trying to get them working, but even logging in seems impossible.

schtritoff commented 1 year ago

Yeah, its PITA. There are many links and references in the main script in this repo. The upstream cloud-init it tracked at Ubuntu git repositories - for example https://github.com/canonical/cloud-init/blob/main/cloudinit/sources/DataSourceAzure.py has all the code relevant for Azure specifics. Some clues are in the tests https://github.com/canonical/cloud-init/blob/main/tests/unittests/sources/test_azure.py. After unsucessful provisioning you can boot the Azure cloud image with some live ISO (like sysrecsurecd) and then examine logs /var/log/cloud-init*.

The issue is that these specific sources, like Azure, are continuously evolving according to Azure infrastructure development and since classic on-prem Hyper-V is not official source, even if we fix it now it will break again in the future.

I'm working on approach to first boot Azure image with custom live ISO that will make changes to image (add support for NoCloud cloud-init source) and on second boot will insert user-data to finish provisioning. I've proof of concept and I'm sure it will work but no scripted automation for now, still work in progress. No enough free time at the moment to finish it.

usrme commented 1 year ago

Thanks for getting back to me! I'll look into other ways to achieve what I want in the meantime.

schtritoff commented 1 year ago

fixed in f42cb929c280dfe9d41b7b6922360e3101851852 but current solution requires "wsl --mount" option (available only in Windows 11 for now)