Subdomain 1.2: Device management
1.A developer has compiled a custom kernel module named custom_sensor.ko and manually copied it into the /lib/modules/$(uname -r)/kernel/drivers/ directory. Before the module can be loaded using modprobe, the system's module dependency database must be updated. Which of the following commands will accomplish this, and which file is updated as a result?(Select 2)
- A.depmod -a
- B.modprobe -a
- C.udevadm trigger
- D./lib/modules/$(uname -r)/modules.dep
- E./etc/modprobe.d/modules.conf
- F./boot/System.map
Show answer & explanation
Correct answers: A, D — depmod -a; /lib/modules/$(uname -r)/modules.dep
- A. Correct. The depmod command scans the kernel modules directories and regenerates the dependency database. The -a (all) flag instructs depmod to probe all modules listed in the configuration files for the current kernel version.
- B. Incorrect. The modprobe -a command is used to load all modules specified on the command line simultaneously, rather than updating the dependency database. modprobe relies on the database already being up to date.
- C. Incorrect. udevadm trigger is used to request the kernel to re-send device events (uevents), typically to force udev to re-apply rules to existing devices. It does not manage kernel module dependencies.
- D. Correct. The /lib/modules/$(uname -r)/modules.dep file is the primary text file created by depmod. It lists the dependencies for every module in the kernel version's directory, which modprobe uses to load prerequisite modules automatically.
- E. Incorrect. Files within /etc/modprobe.d/ are manual configuration files used to set module aliases, blacklists, and specific options. They are not the generated dependency database updated by depmod.
- F. Incorrect. The System.map file is a look-up table used by the kernel to map memory addresses to function names (symbols). It is created during the kernel compilation process and is not updated when adding new modules via depmod.