Kernel Module Configuration

Kernel module i2c-dev must be loaded. On some distributions, it is built into the Linux kernel. If not, it must be loaded explicitly.

Note that module "i2c-dev" can also be referred to as "i2c_dev". The two are interchangable.

To see if i2c-dev is built into the kernel, issue the following command:

grep i2c[-_]dev.ko  /lib/modules/`uname -r`/modules.builtin

If i2c-dev is not built in, it may already have been configured to load automatically. To check if it is already loaded:

lsmod | grep i2c[-_]dev

If it is not built-in and not already loaded add a file containing the single line

i2c-dev

to directory /etc/modules-load.d. The file name must end with ".conf", e.g. i2c-dev.conf, my-i2c-dev.conf

Details on Kernel Module Loading

For reference, systemd-modules-load.service(8) reads files from the following directories which contain names of the kernel modules to load during boot:

  • /etc/modules-load.d/*.conf
  • /run/modules-load.d/*.conf
  • /usr/lib/modules-load.d/*.conf

Each configuration file is named in the style of /etc/modules-load.d/program.conf.