On my Intel NUC, I was trying to install the intel drivers in order to make sure that the hdmi is fully operational.
So I installed xserver-xorg-video-intel which was supposed to install all the video related packages including the relevant drivers for HDMI support.
Unfortunately, after doing this, the keyboard and the mouse stopped working. No clue what the hell is happening.
Seems that there is a dependency issue in the package since many xserver-xorg-* packages have been removed.
Ubuntu installed on my system is 16.04.5 LTS.
In order to recover from this situation, I followed these steps : ( in case someone is stuck in the same situation )
1- reboot and hit escape during boot time , in order to get the grub menu.
2- choose the ( recovery ) option in order to boot in safe mode.
3- while booting , the recovery menu show up. Choose the option "failsafeX".
4- a new window will show up asking what do you want to do: use the mouse to select the option "Exit to console login" then resume the boot till the login prompt appears.
5- uninstall the following package : xserver-xorg-video-intel
6- install back the following packages : ubuntu-desktop, xserver-xorg
7- for some reason, on my home directory, ~/.Xauthority changed the ownership to root:root which was not expected. Due to this permission change, I was not able to login after rebooting, but the mouse and the keyboard were back. To fix this issue, make sure that ~/.Xauthority is owned by you.
8- reboot
Hope that helps !