Hi
Originally Posted by
markling
I am unable to write to files in, or even go to, my debug or debug/tracing tracing directories.
$ sudo echo 1 > /sys/kernel/debug/tracing/tracing_on
bash: /sys/kernel/debug/tracing/tracing_on: Permission denied
<snip>
$ echo workqueue:workqueue_queue_work > /sys/kernel/debug/tracing/set_event
bash: /sys/kernel/debug/tracing/set_event: Permission denied
<snip>
You have to enter a root shell to enter these commands as suggested by SlugSlug.
The reason for this is because the sudo command is only working on the part of the command to the left of the redirection.
I.E. In this example
Code:
sudo echo 1 > /sys/kernel/debug/tracing/tracing_on
echo 1 is running under elevated privileges, whereas the redirection to the file /sys/kernel/debug/tracing/tracing_on is not and it's the redirection, or more accurately writing to the file, that requires the elevated privileges.
There are a number of ways to ensure that the redirection has the required elevated privilages such as entering a root shell.
...running the entire command under a temporary root shell.
Code:
sudo bash -c "echo 1 > /sys/kernel/debug/tracing/tracing_on"
...or ensurinig that writing to the file has the presquiste privileges for it to succeed.
Code:
echo 1 | sudo tee /sys/kernel/debug/tracing/tracing_on
workqueue:workqueue_queue_work
# cat /sys/kernel/debug/tracing/trace_pipe > out.txt
bash: out.txt: Permission denied
This, i suspect, is failing because you are in a directory that you cannot create new files in.
Code:
root@matthew-S206:/sys/kernel/debug# pwd
/sys/kernel/debug
root@matthew-S206:/sys/kernel/debug# cat /sys/kernel/debug/tracing/trace_pipe > out.txt
-bash: out.txt: Permission denied
root@matthew-S206:/sys/kernel/debug#
Try to create the file in your home directory.
Code:
cat /sys/kernel/debug/tracing/trace_pipe > ~/out.txt
Code:
root@matthew-S206:/sys/kernel/debug# cat /sys/kernel/debug/tracing/trace_pipe > ~/out.txt
^C
root@matthew-S206:/sys/kernel/debug# head -n3 ~/out.txt
<idle>-0 [000] d.s. 236969.439359: workqueue_queue_work: work struct=ffff880106c110e8 function=od_dbs_timer workqueue=ffff880101220540 req_cpu=0 cpu=0
<idle>-0 [000] d.s. 236969.455352: workqueue_queue_work: work struct=ffff880106c110e8 function=od_dbs_timer workqueue=ffff880101220540 req_cpu=0 cpu=0
firefox-4405 [000] d.s. 236969.463202: workqueue_queue_work: work struct=ffff880106c110e8 function=od_dbs_timer workqueue=ffff880101220540 req_cpu=0 cpu=0
root@matthew-S206:/sys/kernel/debug#
# echo blah > blah.txt
bash: blah.txt: Permission denied
I.E You cannot create a new file under sysfs or under debugfs.
Kind regards
Bookmarks