Ubuntu 22.04.2 mouse and keyboard does not work after login screen in Hyper-V

LL 40 Reputation points
2023-05-28T12:19:13.8+00:00

Ubuntu 22.04.2 - mouse and keyboard inputs do not work after Ubuntu login screen in Hyper-V. These work on boot and during the login screen when typing account password but not after. Started happening today (28-May-2023), I never had this problem before. Running Win11 22H2. No idea wtf is going on. I read elsewhere to turn off "Enhanced Mode" but this option is grayed out for my VM + unchecking "allow enhanced mode" in Hyper-V server setting does not help.

Happens even on a fresh setup of the VM (new virtual disk, new VM)

Windows for business | Windows Client for IT Pros | Storage high availability | Virtualization and Hyper-V
{count} votes

3 answers

Sort by: Most helpful
  1. Steven Kusters 10 Reputation points
    2023-06-21T08:28:41.4966667+00:00

    Because I have not enough reputation points on stackoverflow to provide the proper answer, but can answer here. Here we go.

    The problem itself lies in the fact that after an update/upgrade, the kernel version Ubuntu picks is a generic one, while the Hyper-V VM now expects there to be an Azure Linux kernel.

    To fix this, you will notice you can switch to the terminal (as mentioned in the other answer) via Control + Alt + F3.

    Log in, do a sudo apt update && sudo apt upgrade, but make sure you do not do an apt autoremove so you do not accidentally remove potential required previous kernels you might need.

    After updating, you will have the latest generic ubuntu kernel as the active kernel in grub that will be booted up, which will cause the darkgray/black screen with hanging cursor issue if you reboot.

    Now, perform a sudo reboot and switch to the terminal again with Control + Alt + F3.

    Open /etc/default/grub with your favorite text editor (vi/vim/nano) with sudo and make the following changes:

    Comment out and add the lines like this:

    #GRUB_DEFAULT=0
    GRUB_DEFAULT=saved
    #GRUB_TIMEOUT=0
    GRUB_TIMEOUT=20
    GRUB_SAVEDEFAULT=true

    Save the file and close the editor.
    (nano: Control + O, Control + X)
    (vi: Escape, :, W, X)

    The option you activated by choosing saved, means the kernel you are going to select will be remembered over reboots.

    Update the grub list, execute: sudo update-grub

    Reboot again, hold shift on boot or press escape during the boot to open the grub bootloader and choose the most up-to-date version of the Linux-5.15.x-xxxx-azure kernel.

    After doing this, the system works again.

    If you want to set the timeout to 0 again, reopen the grub file and change which of the GRUB_TIMEOUT lines you commented out, then perform the sudo update-grub again.

    2 people found this answer helpful.
    0 comments No comments

  2. Anonymous
    2023-05-28T23:20:23.9866667+00:00

    You can still use control + alt + f3 to activate command line.

    Then use sudo nano /etc/default/grub

    And follow steps from answer here: https://serverfault.com/questions/1131814/ubuntu-in-hyper-v-stuck

    This solved it for me.

    0 comments No comments

  3. Tom Stevens 0 Reputation points
    2023-07-15T00:54:57.69+00:00
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.