8

I just installed Ubuntu 20.04 on my new ASUS Zenbook 13 OLED UM325S.

Keyboard is not working after a cold boot. Keyboard will start working on the next boot, if the device is rebooted at Cryptsetup stage or later. Cryptsetup is affected as well, so encrypted installations are impossible to enter without an external keyboard.

My grub entry; GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Discoveries made

  1. serio_raw kernel module does not load when you do a cold boot. Discovery made in this gist.
  2. AT Translated Set 2 keyboard is the laptop keyboard. This is not visible after a cold boot, but is after a reboot. Gist here.
  3. I am unable to use xinput to manage the properties of the device as suggested by @Sancho.s in his answer below. Sometimes xinput does not show any of the keyboards attached, it only shows virtual devices. libinput on the other hand, shows all devices properly.
  4. WMI ASUS Hotkeys are working, so occasionally I see that brightness adjustments work, sound, etc when F1-F12 is used in combination with the fn key.

Attempts to make it work

  1. I have force loaded serio_raw both using initramfs and load-modules.d without success. Module loads, but does not affect keyboard problem.
  2. Tried running xinput set-prop "AT Translated Set 2 keyboard" "Device Enabled" 1 however, xinput fails that the device is not found.

Workaround at the moment is to connect an external keyboard, wait for Cryptsetup to start, and then press CTRL+ALT+DEL and then boot normally. If I do reboot from GRUB, it has no effect.

Thanks

denNorske
  • 975
Nirav
  • 116
  • 2
    Just to chip in here, I have the exact same issue as you on a brand new laptop bought today. exact same model. For reference, I do have my keyboard working in GRUB during boot, but it immediately after doesn't work when the cryptsetup is asking for my password on my encrypted drive. I am literally unable to boot the system without an external keyboard. Keyboard does not work in TTY consoles or anywhere else, but occasionally I do see the hotkeys for brightness are working, and sometimes not – denNorske Sep 11 '21 at 17:10
  • 2
    I have done some investigation, I listed all kernel modules loaded after reboot and after cold boot - and there is in fact one module that is not loaded on cold boot: "serio_raw" - https://cateee.net/lkddb/web-lkddb/SERIO_RAW.html (not sure if it is related but seems likely!) Here is my gist. I have uploaded alphabetically listed LSMOD here. First revision is with keyboard working, last revision is without keyboard working. https://gist.github.com/dennorske/ae5f96d36b367f3bc874889c8a8a6c5b/revisions#diff-9025194bc67b0b297fd6bd585ea504ec71c275c9d94654d14bc3c30115b010fb – denNorske Sep 11 '21 at 19:14
  • 2
    Sorry to triple comment, but here is more commands run both after cold boot and after a reboot, to show the states of lspci, lsmod, xinput list, dmesg. https://gist.github.com/dennorske/f9ed4abbd435f7cdda09133c25d1ac63

    I am also adding a bounty here to get some attention, I hope this can be my coming daily driver.

    – denNorske Sep 11 '21 at 20:02
  • 2
    Until the edits I provided are accepted, my grub entry is as follows: GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" – denNorske Sep 13 '21 at 21:02
  • So it takes a long time between each edit and it getting approved - so to not let anything out from passing readers; "New error message discovered (as of september 14th 2021:) Can't read CTR while initializing i8042". So what is mentioned in one of the answers below are that some devices do not have the self testing built in, and hence this fails. I've also found similar topics here: https://bbs.archlinux.org/viewtopic.php?id=264868 and https://forums.linuxmint.com/viewtopic.php?f=46&t=355162. – denNorske Sep 15 '21 at 22:18

6 Answers6

3

I will build on your good work identifying differences between "working-conditions" (WKC) and "non-working-conditions" (NWC).
Note: I am surprised you have to do any of what is suggested below, but if it works... good for you.


You may need to explicitly force loading of module serio_raw by systemd at boot time. Try adding it to /etc/modules (source). Or create file /etc/modules-load.d/serio_raw.conf containing serio_raw. Cold boot and post feedback (how did this affect the differences you found before? see this to check for module insertion).

If you need to load the module earlier on (you mention "cryptsetup is asking for my password on my encrypted drive"), during boot load with initrd, you can use initramfs-tools or dracut. This and this may help. See also official info, or this.


If that alone doesn't work, assuming when you executed xinput list under WKC there was no external keyboard, AT Translated Set 2 keyboard is the internal keyboard (source).

Add automatic execution of command

$ xinput list-props "AT Translated Set 2 keyboard"

upon boot to see if you get something like

Device 'AT Translated Set 2 keyboard':
    Device Enabled (124):   0
    ...

when cold booting. If so, add automatic execution of command

$ xinput set-prop "AT Translated Set 2 keyboard" "Device Enabled" 1

and cold boot again. Please post feedback.


You could also inspect the state of your system in NWC by sshing into it. Perhaps this is "less invasive" than using an external keyboard in terms of keyboard configuration.


Related:

  1. https://unix.stackexchange.com/questions/89538/how-to-tell-which-keyboard-was-used-to-press-a-key
  • Thank you for providing such a good detailed answer. I forced module serio_raw both on initramfs and on the modules-load.d, and the module loads every boot, but the kyeboard was still not working. Further on, when checking xinput list now, I just get a subset of devices, and I don't know what has changed. Trying to do it on "AT Translated Set 2 keyboard" as suggested therefore fails me. AVailable devices are only under Virtual Core Pointer and under Virtual Core keyboard such as xwayland-keyboard and Virtual core XTEST pointer. I will try SSH to see what it returns. – denNorske Sep 13 '21 at 10:35
  • A little update, using libinput it shows up when it is in WKC. – denNorske Sep 13 '21 at 10:40
  • Update #2: AT Translated Set 2 Keyboard is not showing up in NWC with libinput either (from SSH) – denNorske Sep 13 '21 at 10:49
  • 2
    @Denny - Even if you did not write the original OP, I suggest you edit it to add whatever you find. I also suggest you keep editing the gists, etc., with the exact commands you type, the exact output you get, and under which conditions you did that (sure, it takes longer, but the savings in the long run are well worth it). You will significantly increase your chances of getting the problem solved. "Narrating" the actions and results blurs the picture. – sancho.s ReinstateMonicaCellio Sep 13 '21 at 11:13
2

Your question indicates that the keyboard is not detected by the Linux kernel at all. It does not seem to be related to only the X-Server. Otherwise you would be able to type a password to decrypt the disks or on a virtual terminal.

While desktop keyboards are usually connected via USB nowadays, laptop keyboards can be special. The keyboard of my DELL Precision 5520 keyboard for example is connected to the i8042 Keyboard controller of the SuperIO chip. This is usually the case for standard AT- as well as PS/2 keyboards. If it was compiled as a module, the module would be called "i8042". Ubuntu however compiles serio_i8042 directly into the kernel (see: https://kernel.ubuntu.com/~kernel-ppa/config/hirsute/linux/5.10.0-14.15/amd64-config.flavour.generic ).

If you search for i8042 and "Zenbook", there seem to be known issues with the driver and Zenbooks which is related to the fact that the Zenbooks have i8042 selftest disabled. This used to cause issues with the keyboard after suspend/resume. The first time this was patched with commit 77b425399f6d in 2016 and there is a recent patch to fix this issue for the Zenbook Flip with Kernel 5.4.243 (see: https://lore.kernel.org/lkml/20210301161100.251732170@linuxfoundation.org/ ). It also looks like the Convertible patch broke something before Kernel 5.11.057 which was fixed back in March 2021. ( https://lore.kernel.org/lkml/20210419130532.123205886@linuxfoundation.org/ ). My Ubuntu is currently running Kernel 5.11.0-34 which means, that it still has this issue - so might your kernel. I would suggest that you try to update to a later kernel and see if this fixes your issue.

You can either download the .deb packages for a later kernel from: https://kernel.ubuntu.com/~kernel-ppa/mainline/?C=N;O=D - or you can use the mainline tool to install a more recent kernel:

sudo add-apt-repository ppa:cappelikan/ppa
sudo apt update
sudo apt install mainline
sudo mainline --install-latest

You then have to reboot and pick the most recent Kernel from your bootloader (usually grub).

If the issue related to the kernelbug, your keyboard should now work. you can also have a look at /proc/bus/input/devices to see if your keyboard shows up there.

  • Hi Marcel and thanks for the information. It sure looks to be a kernel issue, hence I digged into loaded modules and such. I tried to use mainline to upgrade my kernel, but anything beyond 5.12.x fails, as the libc6 dependency is 2.34 and upwards. Ubuntu 21.04 has 2.33, so can't get the headers installed. Do you have any insight to what one could do to get it worked around? I believe one way would be to compile own kernels from source? Also a lot of the info is not in the OP as I have a pretty big pending edit to be approved :) Sorry about that – denNorske Sep 13 '21 at 22:44
  • 1
    If I was in that situation, I would compile the kernel myself. You could use the Ubuntu/Debian kernel build environment but this might be a lot of overhead. A fast solution would be to download the kernel source from kernel.org and use the ubuntu kernel config as input. You can find the config in /boot, e.g. /boot/config-5.4.0-84-generic . Download the kernel source from kerne.org and extract to /usr/src/linux-{version}. CD into dir, copy config from /boot to .config. Run make oldconfig; make; make modules_install; make bzImage; copy bzImage to /boot. Add kernel to grub & reboot. – Marcel Noe Sep 14 '21 at 08:49
  • 1
    This answer provides a more exhaustive instruction to properly compile the kernel the 'ubuntu way': https://askubuntu.com/questions/718381/how-to-compile-and-install-custom-mainline-kernel/718662#718662 - I guess you can adapt it to compile Kernel 5.8.X – Marcel Noe Sep 14 '21 at 08:51
  • 1
    Thank you! According to Arch Linux forum a guy had same issues and compiled with some flags modified; https://bbs.archlinux.org/viewtopic.php?id=264868 I would like to try the same, any chance you would know how? – denNorske Sep 15 '21 at 22:23
  • 1
    Yes. Just edit .config with a text-editor and look for the options specified in the arch linux post. Alternatively, run "make menuconfig" instead of "make oldconfig" and you get a curses based frontend - it will ask you a lot of questions however, so the texteditor option might be faster. – Marcel Noe Sep 16 '21 at 06:35
  • I guess this is the closest I get to a solution from my end, so happy +100 points and I will revert back once there are any news. I have not yet been able to succeed, tho. – denNorske Sep 19 '21 at 19:35
  • I'm sorry to hear that. If you want, we can continue with trying to debug. Have you been able to compile the kernel? And thanks for the +100! – Marcel Noe Sep 22 '21 at 20:01
2

Finally, this solution works for me.

I am using ASUS Zenbook 13 OLED UM325S with Kubuntu 20.04

Edit file: /etc/default/grub

Replace bellow line

GRUB_CMDLINE_LINUX=""

WITH

GRUB_CMDLINE_LINUX="i8042.reset i8042.nomux i8042.nopnp i8042.noloop"

Update bootloader

sudo update-grub
Nirav
  • 116
1

There was a kernel bug a few versions back that would affect some notebook keyboards. While a fix was released for 5.8.0-20, this may be an avenue to explore.

Try this:

  1. Open Terminal (if it's not already open)
  2. Determine the chassis type of your machine:
    cat /sys/class/dmi/id/chassis_type
    
    If the value is 31 or 32, disregard the rest of this answer.
  3. Check to see if intel_vbtn is loaded:
    sudo dmesg | grep intel-vbtn
    
    If there is no output, disregard the rest of this answer.
  4. In the event you've made it this far, the solution may be to block intel_vbtn from being loaded:
    1. Create a new file in /etc/modprobe.d:

      sudo vi /etc/modprobe.d/intel-vbtn.conf
      

      Note: Feel free to use a text editor of your choosing. The use of vi in the example is more muscle memory than an endorsement.

    2. Copy the following into the file:

      # This module breaks the keyboard, so don't load it
      blacklist intel_vbtn
      
    3. Save the file and exit:

      If you're using vi, this would be Esc, then :wqEnter to write and quit the editor.

  5. Shut down and restart to verify that the keyboard works after a cold boot
matigo
  • 22,138
  • 7
  • 45
  • 75
  • Thank you! I did check with lsmod and also checked dmesg as well as journalctl to see if there was, if any, mentions of such a module. In my case I am running an AMD based system (Ryzen 7 5700U), and not sure what OP has. Unfortunately I found nothing on that name, but since you suggested it I gave it a try. Did not work, sadly. My chassis type reported 10. – denNorske Sep 14 '21 at 15:56
1

I had the same issue on my ASUS Zenbook UM325UA.

A post at linux.org pointed to an entry in the Arch wiki that contained the same issue for a different ASUS ZenBook with a vague but working solution.

After some trial and error I found out that loading the i8042 module is required in order for the keyboard to work at boot time. As for why it works without it after a reboot, I still have no idea.

On Arch Linux, the following module has to be included in /etc/mkinitcpio.conf:

# For early (initramfs) keyboard
# In the MODULES section
MODULES=(i8042)

After which the initramfs image has to be recreated.

On Ubuntu, according to the initramfs-tools manpage, the i8042 module should be listed in the /etc/initramfs-tools/modules file, then the image has to be recreated with update-initramfs -u.

I don't use Ubuntu, so I haven't tested it, tell me if it works for you.

tamasfe
  • 248
  • 2
  • 12
0

Open a virtual console with, e.g. Ctrl+Alt+F3

Does the keyboard work there?
Then try the install from there:

sudo apt install xserver-xorg-input-all

and try an update:

sudo apt update
sudo apt upgrade

Then try terminating X with

sudo /etc/init.d/gdm stop

After that, try reconfiguring X

sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
sudo dpkg-reconfigure xserver-xorg

Finally, restart X with

sudo /etc/init.d/gdm start
zx485
  • 2,426
CBTTJM
  • 1
  • 1
    Keyboard does not respond anywhere after grub, same thing here with same laptop. I tried your instructions without any luck. – denNorske Sep 11 '21 at 17:11