jdmartin86
jdmartin86

Reputation: 297

Oprofile Error: Failed to open profile device: Device or resource busy

I'm struggling to run oprofile on my system because of an annoying error:

$ sudo opcontrol --setup --vmlinux=/usr/lib/debug/lib/modules/`uname -r`/vmlinux
$ sudo opcontrol --start
ATTENTION: Use of opcontrol is discouraged.  Please see the man page for operf.
Using default event: CPU_CLK_UNHALTED:100000:0:1:1
Using 2.6+ OProfile kernel interface.
Reading module info.
Failed to open profile device: Device or resource busy
Couldn't start oprofiled.
Check the log file "/var/lib/oprofile/samples/oprofiled.log" and kernel syslog

Anyone familiar with Oprofile will notice I'm using the proper sequence of commands to invoke the service. This comes directly from Fedora documentation. Kernel debug information was also installed to generate the appropriate vmlinux file. But even after passing the location of this file to oprofile, nothing chaged:

$ sudo opcontrol --setup --vmlinux=/usr/lib/debug/lib/modules/3.12.11-201.fc19.x86_64/vmlinux
$ sudo opcontrol --start
ATTENTION: Use of opcontrol is discouraged.  Please see the man page for operf.
Using default event: CPU_CLK_UNHALTED:100000:0:1:1
Using 2.6+ OProfile kernel interface.
Reading module info.
Failed to open profile device: Device or resource busy
Couldn't start oprofiled.
Check the log file "/var/lib/oprofile/samples/oprofiled.log" and kernel syslog

What's more is there's no log file in the specified location. I've tried several other solutions, including re-installation, deleting the daemon, and running without profiling the kernel.

Upvotes: 4

Views: 2295

Answers (1)

kukka
kukka

Reputation: 121

Before running the oprofile, you should check wether your system exists watchdog. watchdog/nmi_watchdog registers with the perf subsystem which will blocking oprofile from working. You may have to stop the watchdog/NMI watchdog to free up counter 0 using the following:

echo "0" | sudo tee /proc/sys/kernel/watchdog

OR

echo "0" | sudo tee/proc/sys/kernel/nmi_watchdog

Upvotes: 2

Related Questions