[ArchLinux] 内核启动参数设置

这几天笔记本触控板失灵了,虽然可以移动,但没法点选,所以开始排查了问题。

问题

笔者的电脑前几天重装了一下系统,只安装了必要的软件。目前笔者的Archlinux使用的是linux-lts内核,以往使用的都是最新的linux内核。安装完毕之后发现触控板失灵了。

在网络上查找了一圈,大部分的文章说的是,触控板的问题可能是缺少xf86-input-synaptics包。安装完之后确实有效果,但重启之后问题又复现。于是问题有很多天都没有进展。包括 arch wiki 上也没有很好的办法。

转机

偶然想到,会不会是我的笔记本特有的问题,于是搜索时加入了我的笔记本型号:Xiaomi notebook pro。在 arch wiki 上有相应词条。然后发现了下面这一段话:

You may face a problem when the kernel sees 2 touchpad devices if you have multiple touchpad devices displayed in libinput list-devices Try to add i8042.noaux kernel param

然后使用libinput list-devices指令之后,确实发现了两个触控板,大概就是这个问题了。也难怪在网上搜不到(

修改 linux 启动参数

这一部分是在grub中修改的,直接修改 /boot/grub/grub.cfg 并不能长久储存。

grub的生成模板储存在/etc/grub.d/当中,找了一下并没有发现参数该放哪,然后又去看了一下 /etc/default/grub,发现了参数对应的变量,有两个,GRUB_CMDLINE_LINUX_DEFAULTGRUB_CMDLINE_LINUX。第一个存放 linux 内核启动的默认参数,第二个就是自定义参数了,然后修改为 GRUB_CMDLINE_LINUX="i8042.noaux=1"。最后使用update-grub指令更新grub。

更新为:

1
2
3
4
5
echo	'加载 Linux linux-lts ...'
linux /boot/vmlinuz-linux-lts root=UUID=5918f557-8640-4c61-a62d-b7df69ff9c0d
rw i8042.noaux=1 loglevel=3 quiet
echo '加载初始化内存盘...'
initrd /boot/intel-ucode.img /boot/initramfs-linux-lts.img

i8042.noaux

linux 内核对于这个参数的解释是这样的1

i8042.noaux [HW] Don’t check for auxiliary (== mouse) port

i8042.noaux 参数使得驱动不会检查控制器是否支持多路复用。在 stackexchange 上找到了这个回答2

This is an arcane option, only necessary on some rare devices (one of which you have). The only documentation is one line in the kernel parameters list.

The i8042 controller controls PS/2 keyboards and mice in PCs. It seems that on your laptop, both the keyboard and the touchpad are connected through that chip.
From what I understand from the option name and a brief skim of the source code (don’t rely on this to write an i8042 driver!), some i8042 chips are capable of multiplexing data coming from multiple pointing devices. The traditional PS/2 interface only provides for one keyboard and one mouse; modern laptops often have a two or more of a touchpad, a trackstick and an external PS/2 plug. Some controllers follow the active PS/2 multiplexing specification, which permit up to 4 devices; the data sent by each device carries an indication of which device it comes from.

The Linux driver tries to find out whether the i8042 controller supports multiplexing, but sometimes guessing wrongly. With the i8042.nomux=1 parameter, the driver does not try to detect whether the controller supports multiplexing and assumes that it doesn’t. With the i8042.reset parameter, the driver resets the controller when starting, which may be useful to disable multiplexing mode if the controller does support it but in a buggy way.

也算是个历史遗留问题了吧。


1. https://www.kernel.org/doc/Documentation/admin-guide/kernel-parameters.txt
2. https://unix.stackexchange.com/questions/28736/what-does-the-i8042-nomux-1-kernel-option-do-during-booting-of-ubuntu