启用内核内存泄漏检测器后无法触发扫描的问题求助
Hey there, let's work through this kmemleak issue you're facing. First off, that "Device or resource busy" error almost never boils down to root permissions—root has full access to /sys/kernel/debug nodes once debugfs is mounted correctly. The problem is usually that kmemleak is already in a busy state. Here's how to fix it:
Check if kmemleak is already running a scan
Runcat /sys/kernel/debug/kmemleakfirst. If the output mentions an ongoing scan (like "Scanning..."), that's why your manual scan is being blocked. Kmemleak can only handle one scan operation at a time.Disable automatic scanning temporarily
Kmemleak might be running periodic auto-scans by default. Check its configuration with:cat /sys/kernel/debug/kmemleak/parametersIf you see
autoscan = on, turn it off before trying your manual scan:echo off > /sys/kernel/debug/kmemleak/autoscanThen trigger your scan again:
echo scan > /sys/kernel/debug/kmemleakDouble-check the debugfs mount
Even though you said debugfs is mounted, verify there are no oddities:mount | grep debugfsMake sure the mount point is
/sys/kernel/debugand it's not mounted as read-only (look forrwin the mount options). If it's read-only, remount it with write access:mount -o remount,rw /sys/kernel/debugCheck kernel logs for kmemleak errors
Rundmesg | grep kmemleakto see if there are initialization issues or unexpected behavior. Look for messages like "kmemleak: Initialization failed" which could point to deeper kernel-side problems.Force stop and restart kmemleak
If none of the above works, try stopping kmemleak completely before scanning:echo stop > /sys/kernel/debug/kmemleak echo scan > /sys/kernel/debug/kmemleakIf you need auto-scanning later, re-enable it with
echo on > /sys/kernel/debug/kmemleak/autoscan.
内容的提问来源于stack exchange,提问作者Boooooo

