1

I tried installing XUbuntu 22.04 on Hyper-V and it installs fine but after installation and reboot, the screen goes black with a flashing screen.

I was able to watch F1 output until it gets to:

Starting Hostname Service ...
tmp-sanity\x2dmount...

After which the black screen starts.

I was able to trigger Ctrl+Alt+F3 but the login only shows for a second and then goes black again.

I think this is a driver issue but I have no idea on how to resolve.

Any ideas on how to fix this?

Notes:

  • Ubuntu Desktop 22.04 works fine
  • Only have RDP access to the Hyper-V server so I'm a bit limited on control.
Timothy C. Quinn
  • 1,213
  • 1
  • 14
  • 22

8 Answers8

6

I used the Hyper-V Quick Create tool and still saw the problem with 22.04 LTS. I was able to fix it and reproduce this by toggling Enhanced Session Mode. It works 100% of the time for me when it is off. It does not work 100% when on.

An added issue solved was auto log in was not working in enhanced session (prior to the black screen I was able to log in and then it goes dark) and when I turned it off, it now auto logs in as well.

To toggle you have to have your VM window connected and at the top select VIEW and uncheck Enhanced Session.

241 it would seem.

2

The thing that worked for me (not to install this horrendous linux-azure package) was: https://superuser.com/questions/1241327/hyper-v-white-black-window

Note: My VM is Ubuntu 20.04 in V1 but I think it is also valid for V2 and Below answer from the above link:

It's a known problem between GRUB and Hyper-V during the installation. You can solve the problem with few steps.

Requirement

SSH Server on VM You need to check SSH Server at the installation to access to your VM without Hyper-V viewer.

Solve black screen issue

Before any modification, be sure that you saved the files with : cp .old

Connect to your VM through SSH (e.g. using PuTTY or WinSCP) and edit the grub file :

sudo vim /etc/default/grub

Delete "quiet splach" attribute in lines :

GRUB_CMDLINE_LINUX_DEFAULT="" GRUB_CMDLINE_LINUX="" Uncomment the line :

GRUB_TERMINAL=console Save the file before exit.

You also need to update grub to apply the new configuration :

sudo update-grub

Reboot your VM with the following command :

sudo reboot

Try to access it through Hyper-V viewer.

Tito
  • 21
1

This issue is likely caused because the VM was installed using Generation 1 virtual machine. Try installing the VM as Generation 2 instead.

Note: to install vm as generation 2, you must disable secure boot under HyperV VM Settings -> Security -> Secure Boot Enabled (uncheck).

Note: This does not seem to fix issues with XUbuntu 20.04 which still gets black screen. In this case, you will need to boot into single user mode and install linux-azure package.

Timothy C. Quinn
  • 1,213
  • 1
  • 14
  • 22
1

I just had a similar problem with ubuntu 22 running on Hyper-V however, when I tried using the pre-prepared images everything was fine, as per https://ubuntu.com/blog/optimised-ubuntu-desktop-images-available-in-microsoft-hyper-v-gallery.

  • 1
    Great solution but Hyper-V Quick create is not available on windows server which blows my mind. Do you know any way to download these prepared images? I don't use windows 10 anywhere in my dev ops stack. I am always very careful with prepared VM images as they are an easy vector to get in some nasty stuff. – Timothy C. Quinn Jul 12 '22 at 16:52
  • Yeah that is a surprise. I guess one could create the image using Windows 11 Pro or above and then copy it over to the Windows Server machine. – John Forbes Jul 13 '22 at 05:27
1

For me the problem was Windows 11 requires Secure Boot turned on. In the Settings for the virtual machine, under Security, uncheck "Enable Secure Boot", and try it again. I was able to get through to the GRUB and install the image.

1

On the Hyper-V Panel use "Enhanced Session".

enter image description here

karel
  • 114,770
0

The way to fix this is by installing linux-azure package as follows:

  1. Boot into single user mode
    • At Grub menu, select main entry and click e to edit
    • Find line that starts with linux and add single after ro remembering to add spaces before and after
    • Hit F10 to reboot
  2. At prompt, start networking: systemctl start NetworkManager.service
  3. apt update and install linux-azure
apt-get update
apt-get install linux-azure
  1. Reboot restart -r now

Your system should boot super fast and should work just fine.

Timothy C. Quinn
  • 1,213
  • 1
  • 14
  • 22
0

Most simple solution:

  • open Cmd prompt as administrator and enter: "bcdedit /set hypervisorlaunchtype auto". Close all Hyper-V related apps. Start Hyper-V, connect to the VM and when the Resolution option shows up don't press anything, just wait. The graphics will start to show up, so just exit the Resolution options window.

I found this solution here (it works on Hyper-V as well, even if in the video it is VirtualBox): https://www.youtube.com/watch?v=3_BJQLNbe_o&ab_channel=VampyreDrakul

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Apr 08 '23 at 11:00