debugfs - Linux
Overview
debugfs is a powerful tool used for debugging Linux kernel modules. It allows users to inspect and modify the internal state of loaded modules. It is primarily used by kernel developers and system administrators for diagnosing and resolving kernel issues.
Syntax
debugfs [-hV] [module] [command [args]]
Options/Flags
- -h, –help: Display usage information.
- -V, –version: Print version information.
Examples
Inspect a module’s symbol table:
debugfs -w /sys/kernel/debug/bluetooth/btusb
lsmod
Modify a module’s parameter:
debugfs -w /sys/kernel/debug/cpuidle/cpuidle
write enable true
Dump a module’s debug messages:
debugfs -w /sys/kernel/debug/usbcore/usbcore
read msg_level
Common Issues
- Module not loaded: Ensure that the target module is loaded and accessible before using debugfs.
- Permission denied: You may need root privileges to access certain debugfs filesystems.
Integration
debugfs can be integrated with other commands for advanced troubleshooting. For example:
grep -r "target_string" /sys/kernel/debug/