title: blktrace output error in docker container
body: <p>my docker container base image is ubuntu, and I ran it with full privilege options that means in run command I use these switches:</p>
  
  <pre><code>--cap-add=SYS_ADMIN --security-opt apparmor:unconfined
  </code></pre>
  
  <p>I wanna use blktrce using below command:</p>
  
  <pre><code>sudo blktrace -d / -a issue -o - | blkparse -f "%p %T.%9t %D %S ^C %d\n" -i - &gt;stream.out
  </code></pre>
  
  <p>but, first time when is use this command I get this error:</p>
  
  <pre><code>Debugfs is not mounted at /sys/kernel/debug
  </code></pre>
  
  <p>i searched and found <a href="https://utcc.utoronto.ca/~cks/space/blog/linux/BlktraceNotes" rel="nofollow">this solution</a> which led to use this command:</p>
  
  <pre><code>mount -t debugfs none /sys/kernel/debug
  </code></pre>
  
  <p>after that, when I use the <code>blktrace</code> command again, i get this error:</p>
  
  <pre><code>BLKTRACESETUP(2) / failed: 25/Inappropriate ioctl for device
  Thread 1 failed open /sys/kernel/debug/block/(null)/trace1: 2/No such file or directory
  Thread 0 failed open /sys/kernel/debug/block/(null)/trace0: 2/No such file or directory
  Thread 2 failed open /sys/kernel/debug/block/(null)/trace2: 2/No such file or directory
  Thread 4 failed open /sys/kernel/debug/block/(null)/trace4: 2/No such file or directory
  Thread 3 failed open /sys/kernel/debug/block/(null)/trace3: 2/No such file or directory
  Thread 5 failed open /sys/kernel/debug/block/(null)/trace5: 2/No such file or directory
  Thread 7 failed open /sys/kernel/debug/block/(null)/trace7: 2/No such file or directory
  Thread 8 failed open /sys/kernel/debug/block/(null)/trace8: 2/No such file or directory
  Thread 6 failed open /sys/kernel/debug/block/(null)/trace6: 2/No such file or directory
  Thread 12 failed open /sys/kernel/debug/block/(null)/trace12: 2/No such file or directory
  Thread 10 failed open /sys/kernel/debug/block/(null)/trace10: 2/No such file or directory
  Thread 13 failed open /sys/kernel/debug/block/(null)/trace13: 2/No such file or directory
  Thread 15 failed open /sys/kernel/debug/block/(null)/trace15: 2/No such file or directory
  Thread 14 failed open /sys/kernel/debug/block/(null)/trace14: 2/No such file or directory
  Thread 17 failed open /sys/kernel/debug/block/(null)/trace17: 2/No such file or directory
  Thread 16 failed open /sys/kernel/debug/block/(null)/trace16: 2/No such file or directory
  Thread 18 failed open /sys/kernel/debug/block/(null)/trace18: 2/No such file or directory
  Thread 11 failed open /sys/kernel/debug/block/(null)/trace11: 2/No such file or directory
  Thread 19 failed open /sys/kernel/debug/block/(null)/trace19: 2/No such file or directory
  Thread 20 failed open /sys/kernel/debug/block/(null)/trace20: 2/No such file or directory
  Thread 9 failed open /sys/kernel/debug/block/(null)/trace9: 2/No such file or directory
  Thread 21 failed open /sys/kernel/debug/block/(null)/trace21: 2/No such file or directory
  Thread 22 failed open /sys/kernel/debug/block/(null)/trace22: 2/No such file or directory
  Thread 23 failed open /sys/kernel/debug/block/(null)/trace23: 2/No such file or directory
  FAILED to start thread on CPU 0: 1/Operation not permitted
  FAILED to start thread on CPU 1: 1/Operation not permitted
  FAILED to start thread on CPU 2: 1/Operation not permitted
  FAILED to start thread on CPU 3: 1/Operation not permitted
  FAILED to start thread on CPU 4: 1/Operation not permitted
  FAILED to start thread on CPU 5: 1/Operation not permitted
  FAILED to start thread on CPU 6: 1/Operation not permitted
  FAILED to start thread on CPU 7: 1/Operation not permitted
  FAILED to start thread on CPU 8: 1/Operation not permitted
  FAILED to start thread on CPU 9: 1/Operation not permitted
  FAILED to start thread on CPU 10: 1/Operation not permitted
  FAILED to start thread on CPU 11: 1/Operation not permitted
  FAILED to start thread on CPU 12: 1/Operation not permitted
  FAILED to start thread on CPU 13: 1/Operation not permitted
  FAILED to start thread on CPU 14: 1/Operation not permitted
  FAILED to start thread on CPU 15: 1/Operation not permitted
  FAILED to start thread on CPU 16: 1/Operation not permitted
  FAILED to start thread on CPU 17: 1/Operation not permitted
  FAILED to start thread on CPU 18: 1/Operation not permitted
  FAILED to start thread on CPU 19: 1/Operation not permitted
  FAILED to start thread on CPU 20: 1/Operation not permitted
  FAILED to start thread on CPU 21: 1/Operation not permitted
  FAILED to start thread on CPU 22: 1/Operation not permitted
  FAILED to start thread on CPU 23: 1/Operation not permitted    
  </code></pre>
  
  <p>how can i solve that?</p>
  
  <p><strong>Update1:</strong></p>
  
  <p>there is <code>sda</code> folder in <code>/sys/kernel/debug/block/</code> and into this folder there are these files:</p>
  
  <pre><code>trace0 trace1 trace2 etc.
  </code></pre>
  
  <p><strong>Update2:</strong></p>
  
  <p>@abligh thank for your answer, but did not help. The <code>strace</code> output about <code>ioctl</code> is:</p>
  
  <pre><code>ioctl(3, BLKTRACESETUP, {act_mask=64, buf_size=524288, buf_nr=4, start_lba=0, end_lba=0, pid=0}, 0x7ffe8a4ceac0) = -1 ENOTTY (Inappropriate ioctl for device)
  write(2, "BLKTRACESETUP(2) / failed: 25/Inappropriate ioctl for device\n", 61) = 61
  ioctl(3, BLKTRACESTOP, 0x7f6fd19789d0) = -1 ENOTTY (Inappropriate ioctl for device)
  ioctl(3, BLKTRACESTOP, 0x7ffe8a4ce540) = -1 ENOTTY (Inappropriate ioctl for device)
  ioctl(3, BLKTRACESTOP, 0x7f6fd19789e0) = -1 ENOTTY (Inappropriate ioctl for device)`
  ioctl(3, BLKTRACETEARDOWN, 0x7f6fd19789e0) = -1 ENOTTY (Inappropriate ioctl for device)
  </code></pre>
  
  <p>to answer your question about why i run <code>blktrace</code> in container, i would say I'm using containers as cluster, so i need the trace of each node.</p>