7

While trying to fix an obscure hardware bug, it was suggested that adding a couple of parameters to the kernel might resolve the issue.

I can of course do that, but I was wondering whether I can make these changes to a running kernel. In particular, I know that procfs and sysfs provide a way to make changes to the running kernel, but I am unsure how to map kernel parameter names to file paths. (I also presume that not all settings are changable at runtime, and these particular parameters might well not be configurable once the system is booted.)

The specific parameters I'm interested in are

i8042.nomux=1 i8042.reset

I'm particularly unsure as to whether it's possible to issue the reset command on a running system.

If these parameters are tweakable at runtime, where would I find them?

14

There are three kinds of things that can be called kernel parameters.

Core kernel parameters are options passed on the kernel command line. They can only be passed at boot time. They are documented in kernel-parameters.txt (this file also lists module parameters; core kernel parameters are the ones without a .). Some of these parameters only matter at boot time (e.g. root). For the ones that are used throughout the lifetime of the system, there may or may not be a mechanism to change them at runtime, there's no general rule.

Module parameters are like kernel parameters, but they specify a particular component of the kernel, usually a specific driver. Despite the name, these parameters apply whether the corresponding driver is compiled directly in the kernel or as a module. When the component is included in the main kernel image, you need to pass COMPONENT_NAME.PARAMETER_NAME=VALUE on the kernel command line. When the component is loaded as a module, you need to pass PARAMETER_NAME=VALUE to insmod.

Some module parameters are visible through sysfs. The directory /sys/module/MODULE_NAME/parameters contains one file per parameter; reading that file gives you the current value of the parameter. Writing to that file sets the parameter, if it can be modified; most parameters cannot be modified (and so the file is read-only). The directory /sys/module/kernel/parameters lists some of the core kernel parameters.

Module parameters are documented haphazardly; some of them are listed in kernel-parameters.txt, and the file contains references for some modules. If you can't find the documentation, search the source. Module parameters are declared by the module_param macro or one of its companions module_param_named, module_param_cb, etc. The last parameter of these macros determines the file permission (e.g. 0600 or S_IRUSR | S_IWUSR would rw------- i.e. readable and writable by root and inaccessible by anyone else). When the permission is 0, the entry in sysfs doesn't appear at all.

i8042.nomux and i8042.reset are parameters of the i8042 driver. Looking at the source code, both have the permission 0, so these two parameters are not modifiable or even queryable at runtime. You can set the parameters only when the driver is started. If the driver is compiled as a module, then unloading the module and loading it again allows you to supply different parameters when you reload it. If the driver is directly in the kernel or if your system's configuration makes it effectively impossible to unload the module, you need to reboot.

Finally, another kind of parameters in the kernel is sysctl. These settings can be viewed and changed with the sysctl command or via /proc/sys. I think the separation between sysctl and kernel parameters is mostly historical; hardware-related settings are traditionally kernel parameters while software-releated settings are traditionally sysctl but the distinction can be fuzzy at times.

  • I did take a look in /sys/module/i8042/parameters, but the only file present is debug. – MathematicalOrchid Apr 4 '14 at 7:34
  • 2
    @MathematicalOrchid Oh, right. I've corrected my answer, I have no idea why I believed 0 meant read-only. 0 actually means no entry, which is what you're observing. The applicable conclusion is the same, the parameter can only be set when the driver is loaded. – Gilles Apr 4 '14 at 8:41
2

I think the list of parameters which can be changed in runtime can be found using " sudo sysctl -a " command. I didn't see i8042.nomux in my system. Not sure why. May be you can check it in yours, if you see the parameter then you can modify it runtime.

  • I don't see it in the list either - which probably just means it's not changable dynamically. (Who really needs to reconfigure PS/2 once the system is already booted?) But that answers my question, so thanks! – MathematicalOrchid Apr 3 '14 at 10:30
  • It's more complicated: there are several kinds of parameters. The sysctl settings are actually not “kernel parameters” in the Linux sense (even though they are parameters of the kernel. This question is about driver parameters, which are kernel parameters (specifically module parameters). See my answer for details. – Gilles Apr 4 '14 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.