clearlinux / distribution

Placeholder repository to allow filing of general bugs/issues/etc against the Clear Linux OS for Intel Architecture linux distribution
522 stars 29 forks source link

Installer doesn't boot on Hyper-V #1545

Open puneetse opened 5 years ago

puneetse commented 5 years ago

Describe the bug The live-server.iso does not boot on Hyper-V and gets stuck at "Searching for installer media, retrying...".

To Reproduce Steps to reproduce the behavior:

  1. Create Hyper-V VM
  2. Add a DVD Drive to the VM
  3. Mount live-server.iso (tested with 30210 and 29690)
  4. Try to boot from it.

Expected behavior The installer ISO should boot under Hyper-V VMs

Additional context The bootloader appears so the DVD drive is there. On a working Hyper-V VM with CL, the same device shows up as /dev/sr0 with the CLR_ISO label when the ISO is mounted.

mdhorn commented 5 years ago

@puneetse Does Hyper-V only run under windows? If so, what version? Where do we get Hyper-V? @evil-brain Do you still have a Windows system?

puneetse commented 5 years ago

Yes, Hyper-V is a Window thing. I tried server 2016 and server 2019. I'm sure the Win 10 Hyper-V client would do the same thing.

I can help source a system to debug on if needed.

evil-brain commented 5 years ago

I've done some investigation and here's where I currently am: The installer ISO is built using a kernel that currently doesn't have support for virtual hardware under Hyper-V. We do have a kernel with support - it's called 'linux-hyperv'.

I built a custom installer using this kernel, but ran into another issue - the ATA_PIIX driver is built as a module and not built into the kernel. Because of this the intird cannot work - as it can't find the CD Drive to load from.

Here's an article from Microsoft about a similar issue: https://support.microsoft.com/en-us/help/2600152/cd-rom-device-is-no-longer-accessible-after-installing-the-hyper-v-lin

Checking the kernel configs, the currently-used kernel has the ata_piix driver built in, but the hyper-v kernel builds this driver as a module. This cannot work for ISO booting.

So I think we need to change the config, rebuild and change the kernel, and build a custom installer image to support Hyper-V.

evil-brain commented 5 years ago

Found a weird solution. You'll have to build your own image:

Now you have live-server.img - but we need to convert this to a vhdx file for Hyper-V to work.

Copy live-server.vhdx to a USB drive or otherwise move to the Windows machine. Now, a weird workaround must be done. If this workaround isn't performed, you'll get this error when attempting to boot: "The version does not support this version of the file format."

Seriously. Here's an article: https://www.itexperience.net/2014/05/28/the-version-does-not-support-this-version-of-the-file-format-in-hyper-v-manager/

I don't know why it works, but it does (comparing hex dumps shows lots of changes, and the file grows by a couple hundred MB)

In Hyper-V manager, point the virtual HDD to this copy of the image file, and boot.

tristanbarcelon commented 5 years ago

@evil-brain I followed your instruction and it failed towards the latter part of image creation step with this error:

image

I am performing this step from inside a Hyper-V VM guest running clear linux 30730 which was created using the available hyper-v image. Did you by any chance perform your steps from a bare-metal install of clear linux?

I looked at the clr-installer.log file and the error appears to be caused by a missing file live-image-post-update-version.py though I can't really tell which directory it's expecting that to be at.

image

tristanbarcelon commented 5 years ago

@evil-brain , I think I have it figured out now after opening up live-desktop.yaml and copying the scripts referenced. I now need to expand the vhdx because it ran out of space :)

mdhorn commented 4 years ago

I'm going to close this due to inactivity.

mdhorn commented 4 years ago

If we want to support Hyper-V it appears that support needs to be added to kernel-native. linux-hyperv @ahkok @bryteise Is this something we should be supporting?

@miguelinux Is this reasonable to enable in our native kernel? And the LTS kernels? Or just native to allow installs and then a special kernel for hyper-v?

ahkok commented 4 years ago

We have a -hyperv specific kernel. This is likely required?

mdhorn commented 4 years ago

There is already a published Hyper-V image but I'm assuming this is meeting the needs? @puneetse

puneetse commented 4 years ago

Right, the hyperv image works. This request is to enable the ISO installer for installing a Clear Linux VMfrom scratch, like is possible for vmware/virtualbox.

mdhorn commented 4 years ago

To enable the default installer would first require that the native-kernel needs to have the linux-hyperv enabled. If this is approved and enabled, we could next look at adding the hyper-v kernel to the installer. If there a method to detect that the VM is hyper-v we could auto-select that kernel similar to how we select the kernel-lts for VirtualBox.

@ahkok Is there a reason we have a one-off kernel for hyper-v instead of enabling it in the native-kernel and lts-kernels? If it were supported in native and LTS kernels, this would just work. Given there is a unique kernel currently for hyper-v, want to make sure we are following a reasonable enablement path.

tristanbarcelon commented 4 years ago

I think the same issue be true for the live-desktop iso as well. I'd very much like to install try this distro out in a hyper-v guest vm.

mdhorn commented 4 years ago

I think the same issue be true for the live-desktop iso as well. I'd very much like to install try this distro out in a hyper-v guest vm.

Correct, the problem is in the kernel which is the same for all of the installer images.

You can try Clear Linux OS in Hyper-v right now using the prebuilt Hyper-V image: https://clearlinux.org/downloads#hyperv

dorileo commented 4 years ago

If you're enabling hyper-v on the installer image make sure to also add hyper-v kernel to the list of available kernels.

mdhorn commented 4 years ago

@ahkok Is there a reason we have a one-off kernel for hyper-v instead of enabling it in the native-kernel and lts-kernels? If it were supported in native and LTS kernels, this would just work. Given there is a unique kernel currently for hyper-v, want to make sure we are following a reasonable enablement path.

@ahkok Is there a reason we have a one-off kernel for hyper-v instead of enabling it in the native-kernel and lts-kernels? If it were supported in native and LTS kernels, this would just work. Given there is a unique kernel currently for hyper-v, want to make sure we are following a reasonable enablement path. Thoughts?

ahkok commented 4 years ago

All the virtualization kernels are small because they do not need to support lots of legacy hardware.

It's entirely fine to make the -native kernel also support booting in HyperV, permitted that it doesn't impose a significant cost to others (e.g. we don't enable Xen support unless it's the AWS kernel). But other than that, this is likely OK if it doesn't impose.

So, AWS, HyperV, etc. kernels are "expressly optimized for" their purpose.

We should always recommend and install the optimized kernels for the VM where possible (yes, I realize that is likely a feature that isn't present).

mdhorn commented 4 years ago

All the virtualization kernels are small because they do not need to support lots of legacy hardware.

It's entirely fine to make the -native kernel also support booting in HyperV, permitted that it doesn't impose a significant cost to others (e.g. we don't enable Xen support unless it's the AWS kernel). But other than that, this is likely OK if it doesn't impose.

So, AWS, HyperV, etc. kernels are "expressly optimized for" their purpose.

We should always recommend and install the optimized kernels for the VM where possible (yes, I realize that is likely a feature that isn't present).

@miguelinux Could we get your help with enabling this in the native kernel?

ahkok commented 4 years ago

https://github.com/clearlinux-pkgs/linux/blob/master/config#L320

It is enabled already. The problem is more likely some HyperV specific virtual device driver.

ahkok commented 4 years ago

Scratch that remark:

https://github.com/clearlinux-pkgs/linux/blob/master/config#L6712

tristanbarcelon commented 4 years ago

@ahkok I tried using the hyper-v image as instructed since I'm unable to boot the desktop iso under hyper-v. So far it works but when I add the desktop-autostart bundle using swupd, I am observing 2 unexpected behaviors:

Is the hyper-v image not supportive of the desktop bundle due to other drivers being left off of the kernel?

puneetse commented 4 years ago

The virtual disk is limited by design and needs to be increased manually through Hyper-V and in the OS. See https://docs.01.org/clearlinux/latest/guides/maintenance/increase-virtual-disk-size.html for how to increase the virtual disk size.

Graphics should work after the bundles are installed but last I checked there were open known issues regarding general Hyper-V + Linux graphics slowness.

@tristanbarcelon since these are separate problems, if you need more help please create another thread on GitHub or the forums to keep this one on focused.

miguelinux commented 4 years ago

The missing modules are already in the -native kernel clearlinux-pkgs/linux@7fa5785

tristanbarcelon commented 4 years ago

Thanks @miguelinux I'm able to install linux-desktop iso build 32600 in HyperV now. Is there anything else I need to do to boot straight to a desktop ui? I specified the desktop bundle during the install process and I can confirm that desktop and desktop-autostart bundles are installed. Each time I start the VM, I'm just booted straight to a console.