Make a module setting survive a kernel update
Task
Configure a module parameter and a blacklist so both survive a reboot and a kernel update, then verify by actually rebooting. Then rebuild the initramfs and confirm the change reached the early boot stage as well -- the step whose omission produces "unable to mount root fs".
Steps
- Pick a module with a parameter you can observe.
dummytakesnumdummies. Load it withmodprobe dummy numdummies=3and confirm three interfaces appear. - Unload it and confirm the parameter did not persist -- loading it again plainly gives the default.
- Make the parameter persistent: create
/etc/modprobe.d/dummy.confcontainingoptions dummy numdummies=3, and confirm it takes effect on the nextmodprobe. - Make the module load at boot: add its name to a file under
/etc/modules-load.d/. - Blacklist a module you do not want loading automatically -- create
/etc/modprobe.d/blacklist-lab.confwithblacklist floppyor similar -- and note that an explicitmodprobewould still load it. - Learn the stronger form: replace the blacklist line with
install floppy /bin/trueand confirm an explicit modprobe now does nothing. - Rebuild the initramfs so early-boot module handling matches:
dracut -forupdate-initramfs -u. Confirm the new file is newer than the configuration you just wrote. - Reboot and verify everything held.
Verify
cat /sys/module/dummy/parameters/numdummies # 3, after reboot
ip -br link | grep -c '^dummy' # 3
systemctl status systemd-modules-load --no-pager | head -3
lsinitrd 2>/dev/null | grep -c dummy || lsinitramfs /boot/initrd.img-$(uname -r) | grep -c dummy
stat -c '%y %n' /boot/initramfs-$(uname -r).img /etc/modprobe.d/dummy.conf 2>/dev/null
The last check is the point: the initramfs timestamp must be NEWER than the configuration file. If it is older, the early boot stage is still running with the previous settings, and that is the state in which a storage driver change leaves a machine unable to find its root filesystem.
Notes
Step 6 is the distinction the exam asks about. blacklist prevents automatic loading only; install <module> /bin/true replaces the load command with a no-op, so even a deliberate modprobe achieves nothing.