I mistakenly removed the "English" keyboard layout from the keyboard layouts list while trying to delete the keyboard layout of another language. Just afterwards, my device froze, and I decided to restart after a while. Big mistake, as I realized, that I could not login to my user account anymore, since the keyboard layout existing currently is not in English, but the password of my main user has English letters. I am using Ubuntu 17.10. Now, is there anyway I could bring back the English keyboard layout from the login screen, without typing a single latin alphabet anywhere, so that I could login again?
Basically you need to make en layout on login, then configure layouts in system settings.
You should change
etc/default/keyboard in recovery mode or from live cd/usb.
Full explanation here