Score:4

Ubuntu in Hyper-V stuck

jp flag

so I tried to install Ubuntu 22.04.2 in Hyper-V on my Windows Server 2012. Installation goes fine but the first boot stops on black screen and a mouse cursor which doesn't move. I found some guide to change grub config which seems to help a bit

Now it boots into login screen, I login and see the desktop, but it takes about 8 seconds before image freezes and mouse stops moving! Then I can only switch to text console via ctrl+alt+F3 for example, but switching back to F1 shows just black screen and cursor again. Any ideas?

Jaromanda X avatar
ru flag
*Then I can only switch to text console via ctrl+alt+F3 for example* at which point you should try some troubleshooting
in flag
Start with checking recent installed updates. On the VM and on the Hypervisor.
Vitas avatar
jp flag
it's a fresh install and I have checked "install updates during setup" or something like that checkbox...so what should I be checking there? The host machine w2k12r2 is being updated regularly.
Vitas avatar
jp flag
Jaromanda that's great, so do you have some idea what and how should I troubleshoot? :) I am not a linux admin and this freezing image issue I have never seen although I have worked with several linux machines before. But they were physical...
Vitas avatar
jp flag
I can actually make the graphical console work when I switch back to it from text, but as I said - only for few seconds before it freezes again :-\
Score:4
br flag

Try using the instructions here to update your kernel: https://davejansen.com/install-a-linux-kernel-of-choice-under-ubuntu/

I'm not sure which is the best for hyper-v, but the latest right now (6.3.5) has eliminated the freezing for me. I had to constantly go back and forth with the ctrl+alt+F3 and F1, but it eventually installed and I was able to reboot and get things going. Best of luck!


Rather than use ctrl-alt-F3 and ctrl-alt-f1 back and forth (screen would freeze after about 10 secs and mouse stopped working) I just rain the kernal update in the terminal and rebooted.

sudo mainline --install-latest

reboot

Robert N avatar
br flag
Thanks Michael! As a linux noob, I just learned something new. Glad there are multiple ways to get this done!
rufo avatar
in flag
So, just to have all the commands, login to console/terminal and: `sudo add-apt-repository ppa:cappelikan/ppa` `sudo apt install mainline` `sudo mainline --install-latest` `reboot`
Score:2
cx flag

My Ubuntu virtual machine in Hyper-V worked fine for some time until symptoms you described appear. The problem was with the update from the kernel 5.19.0-41 to 5.19.0-42. Now I choose older 5.19.0-41 kernel in the grub menu and have no problems so far.

To access the grub menu I have to edit the /etc/default/grub file The line GRUB_TIMEOUT_STYLE=hidden should read GRUB_TIMEOUT_STYLE=menu Also make sure you have GRUB_TIMEOUT=10 and then run sudo update-grub after updating the /etc/default/grub file. This was explained in https://askubuntu.com/questions/1083904/how-can-i-display-the-grub-during-boot

Vitas avatar
jp flag
So I did it, but upon reboot it was stuck on Hyper-V logo for maybe 10 minutes and then it booted right into the login screen, so I never saw the GRUB menu unfortunately. When I do reboot, it is stuck on Status: stopping and last message is "Reached target System Reboot". After about 3 minutes it went through and in GRUB menu I could choose Kernel 5.19.0-32. Now it is stuck on Loading initial ramdisk...after maybe 15minutes the system booted and yes it works and doesn't freeze! But if the shutdown / reboot / poweron will take so super long, then I don't know if it will be much usable...
Vitas avatar
jp flag
from some reason every time I power on the VM it doesn't show the GRUB menu. Only after reboot. You should edit your answer and include this solution to make the older kernel choice start by default https://askubuntu.com/questions/216398/set-older-kernel-as-default-grub-entry that's what I have done and it seems to be a good solution
Score:-1
jp flag

Another workaround which I found is to use Windows 10 machine Hyper-V because there is a Hyper-V gallery which you can use via "quick create" button. I chose the latest available Ubuntu 22.04 LTS, created the VM, it was working fine. Then I deleted all the snapshots so there is only one VHDX file and no AVHDX. I shutdown the VM, copied this file onto my w2k12r2 machine and created new VM with this attached as hard disk. After disabling secure boot this machine with Ubuntu 22.04 works fine because it uses older kernel 5.15

Vitas avatar
jp flag
why is this not useful? :o
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.