The essentials
Quick reference
One focused task per row. Jump to the related section for complete, working examples.
| Use | Syntax | Examples |
|---|---|---|
| Show running kernel | uname -r | View examples |
| List loaded modules | lsmod | View examples |
| Inspect module metadata | modinfo e1000e | View examples |
| Simulate module load | sudo modprobe --dry-run --verbose e1000e | View examples |
| Load a module | sudo modprobe e1000e | View examples |
| Remove a module safely | sudo modprobe --remove e1000e | View examples |
| Inspect effective modprobe config | modprobe --show-config | View examples |
| List boot-load entries | systemd-analyze cat-config modules-load.d | View examples |
| Read one sysctl | sysctl vm.swappiness | View examples |
| Change a runtime sysctl | sudo sysctl -w vm.swappiness=10 | View examples |
| Check a staged sysctl file | systemd-analyze cat-config sysctl.d | View examples |
| Apply system sysctl files | sudo sysctl --system | View examples |
| Inspect kernel messages | journalctl --dmesg --boot --no-pager | View examples |
| Read live module parameters | find /sys/module/e1000e/parameters -maxdepth 1 -type f \
-print | View examples |
Kernel modules extend a running kernel, while sysctl exposes selected runtime parameters through /proc/sys. Treat both as host-wide configuration: identify the exact kernel and parameter, inspect effective state, stage persistent files under configuration management, and keep a tested rollback path. Never force an incompatible module or copy tuning values between workloads without measuring their effect.
Step by step
Detailed examples
Match modules to the running kernel before changing state
Modules are normally installed below /lib/modules for a specific kernel release. lsmod shows live state; modinfo reads packaged metadata and may describe a module that is not loaded. Confirm the running release, module filename, dependencies, license, signature, aliases, and supported parameters. A present device or alias does not prove that unloading its driver is safe.
uname -r
lsmod | head
modinfo e1000e
modprobe --show-depends e1000e Use modprobe for dependency-aware loading
modprobe resolves aliases and dependencies using the installed module database; insmod accepts a file directly and is rarely the right administrative interface. Start with --dry-run --verbose, then load normally and inspect the kernel log. Do not use --force, --force-vermagic, or --force-modversion to bypass compatibility checks on production systems.
sudo modprobe --dry-run --verbose e1000e
sudo modprobe e1000e
lsmod | grep '^e1000e '
journalctl --dmesg --boot --no-pager | tail -n 40 Unload only after proving every consumer can tolerate it
Removing a storage, network, filesystem, cryptographic, or console driver can immediately disrupt the host. Stop dependent workloads, confirm the device is not carrying root storage or management connectivity, and use modprobe --remove without force. A nonzero use count is a safety signal, not an obstacle to override. Schedule a reboot when clean unload is uncertain.
lsmod | grep '^e1000e '
modinfo -F depends e1000e
sudo modprobe --dry-run --verbose --remove e1000e
# Run the real --remove only from resilient out-of-band access. Persist module policy with small, attributable configuration files
Place module options and aliases in /etc/modprobe.d/*.conf. Use /etc/modules-load.d/*.conf only for modules that must be loaded unconditionally at boot; hardware aliases usually trigger automatic loading. A blacklist affects alias-based loading but is not a universal security boundary because explicit or dependency-driven loading may still occur. Rebuild the initramfs when early-boot policy must change, using the distribution's supported tool.
# /etc/modprobe.d/90-storage-policy.conf
options nvme_core io_timeout=60
# /etc/modules-load.d/90-observability.conf
# Load only when automatic device/module discovery cannot do so.
msr Change one measured runtime parameter at a time
sysctl translates dotted names to files beneath /proc/sys. Read the current value and relevant kernel documentation, record a baseline, then apply a reversible runtime change. Availability and semantics depend on kernel configuration and version. A permission error may reflect namespaces, lockdown, or an intentionally read-only interface; do not weaken those controls merely to force a setting.
previous=$(sysctl -n vm.swappiness)
printf 'baseline vm.swappiness=%s\n' "$previous"
sudo sysctl -w vm.swappiness=10
# Observe workload behavior, then restore the recorded baseline.
sudo sysctl -w "vm.swappiness=$previous" Persist validated settings with explicit ownership and rollback
Use a late, purpose-named file such as /etc/sysctl.d/90-application.conf, and include only settings justified for that host role. systemd-sysctl and sysctl --system process multiple directories with precedence rules; inspect the merged configuration before applying it. Applying all files changes the running host immediately, so use a maintenance window for networking, memory, or security-sensitive values.
# /etc/sysctl.d/90-application.conf
# Owner: platform team; rollback: remove this file and reload.
vm.swappiness = 10
fs.inotify.max_user_watches = 524288
# Review with: systemd-analyze cat-config sysctl.d
# Apply only after change approval: sudo sysctl --system Correlate configuration, live sysfs state, and kernel messages
A load can fail because the module is missing for the running kernel, its dependencies are unavailable, its signature is rejected, parameters are invalid, or hardware probing failed. Compare modprobe's effective configuration with /sys/module and the current boot's kernel messages. Some module parameters are read-only or load-time-only; changing a config file does not retroactively change an already-loaded module.
modprobe --show-config | grep -E '(^options|^blacklist).*e1000e'
modinfo e1000e
find /sys/module/e1000e/parameters -maxdepth 1 -type f -print 2>/dev/null
journalctl --dmesg --boot --no-pager | grep -i e1000e Sources and further reading
References
Authoritative documentation used to verify and expand this cheat sheet.
Help us improve
Found a typo or missing example?
Tell us what would make this cheat sheet clearer, more complete, or more useful.



