Tuesday 4 February 2020

Ubuntu Linux on Lenovo Yoga S940: touchpad stops working after reboot

I installed Ubuntu linux 19.10 on Lenovo Yoga S940 and it seemed that everything worked out of the box. However after a reboot touchpad stopped working. Further reboots did not fix the situation. However if I booted live version of Ubuntu linux from USB stick and did NOT do any changes on the hard drive and then rebooted and loaded Ubuntu linux installed on hard drive touchpad was working again. This was a very strange bug for me. I did not understand how booting from live cd can affect the OS on the hard drive when I did not write anything to it.

Interestingly touchpad in live version of Ubuntu linux worked only if I changed some settings in BIOS. Any, for example boot order or functional keys mode. For me it seems like a combination of bugs in BIOS and kernel module.

Second annoying problem was sleep mode. Laptop would randomly wakes up when the lid was closed. See the solution in my post.

Interestingly the solution of a sleep problem partially solves the issue with the touchpad. If we never reboot and touchpad would not stop working. However we want to be able to reboot, for example for the update of the kernel.

 I spent a lot of time trying to fix the touchpad but the issue persisted. dmesg showed message "i2c_designware some id: controller timed out". It was clear that the problem is with the driver of i2c bus.

 I found out similar problem. It suggested that somehow laptop gets to ACPI state S4 during reboot and i2c bus get's stuck and probably it has some memory. My hypothesis is that when we change BIOS settings the i2c bus get's reset and that's the reason why it works in the live version of ubuntu. I tried everything: adding kenel parameters like acpi=noacpi, acpi=force, acpi=noirq as was suggested on forums for this issue on other laptops. Nothing works and noirq also disabled the keyboard. 

I read everything about not working touchpads and found following article. Suggested solution for Lenovo Y700 was to blacklist the module pata_legacy. The issue with Y700 touchpad was completely different but I still decided to give it a try since the touchpad in my laptop was also from Elan. I edited the file 

/etc/modprobe.d/blacklist 

and added the line blacklist pata_legacy Surprisingly it solved the problem with touchpad. I have no idea how pata_legacy might interact with i2c modules but happy that it works now.  

Alternatively to editing /etc/modprobe.d/blacklist one can add modprobe.blacklist=pata_legacy to kernel parameters in grub config file.

Update: I noticed that when I reboot using the button in the unity top bar everything works fine, but if I do sudo  reboot in the terminal touchpad stops working again, but I can reset it using poweroff command from unity UI. Interestingly poweroff button in KDE does not switch the computer off. Perhaps they use slightly different commands which interacts with bugs in BIOS.

No comments: