Red Hat Bugzilla – Bug 1290691
iotop crash, OSError: Netlink error: No such file or directory (2)
Last modified: 2016-12-20 11:54:58 EST
Description of problem:
When running iotop in a privileged docker container, it crashes.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Fedora Atomic 23.29
2. docker pull fedora
3. docker run -it fedora /bin/bash
4. dnf install iotop hdparm smartmontools strace
5. docker commit <id> fedoradiskutils
7. docker run --privileged=true -it fedoradiskutils /bin/bash
[root@34404614e573 /]# iotop
Traceback (most recent call last):
File "/usr/sbin/iotop", line 17, in <module>
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 631, in main
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 621, in <lambda>
main_loop = lambda: run_iotop(options)
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 508, in run_iotop
return curses.wrapper(run_iotop_window, options)
File "/usr/lib64/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 498, in run_iotop_window
taskstats_connection = TaskStatsNetlink(options)
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 137, in __init__
self.family_id = controller.get_family_id('TASKSTATS')
File "/usr/lib/python2.7/site-packages/iotop/genetlink.py", line 69, in get_family_id
m = GeNlMessage.recv(self.conn)
File "/usr/lib/python2.7/site-packages/iotop/genetlink.py", line 51, in recv
msg = conn.recv()
File "/usr/lib/python2.7/site-packages/iotop/netlink.py", line 229, in recv
OSError: Netlink error: No such file or directory (2)
Should work. hdparm -I <dev> works, as does smartctl -a both of which need more hardware access than iotop.
Created attachment 1104593 [details]
This is probably because something in a container namespace is missing that the tool expects to see.
You might want to try to turn off a couple of the namespaces. Candidates would be
This is definitely not a bug in docker. might be a bug in iotop. For some of the device checking you might want to run your containers with the hosts /dev mounted into the container.
docker run -v /dev:/dev --privileged ...
Adding --net=host alone solves this. Other options alone result in the same traceback. Normal/expected?
I spoke too soon. While --net=host avoids the crash, iotop doesn't list any processes. I'm not finding a combination of things that permits that.
(In reply to Daniel Walsh from comment #3)
> docker run -v /dev:/dev --privileged ...
Do you mean literally '-v /dev:/dev' or the actual block devices being monitored? Because when I do this:
[root@f23a ~]# docker run --net=host -v /dev:/dev --privileged=true -it fedext /usr/sbin/iotop -d3
I can no longer remotely ssh into the f23a host that command was run on. Instead I get this from the client:
[chris@f23m ~]$ ssh email@example.com
PTY allocation request failed on channel 0
Restarting sshd and docker, do nothing. I have to reboot to regain remote logins. If I use '-v /dev/sda:/dev/sda' the login breakage doesn't happen, but still no listed processes that are doing IO.
no processes producing IO are listed when run in (privileged) docker container
I am reassigning this to IOTOP to see if they have any insights.
If -v/dev/sda:/dev/sda works that is fine, also. I think iotop is getting blocked by one or more of the namespaces. Did you try with the --pid=host?
(In reply to Daniel Walsh from comment #8)
> I am reassigning this to IOTOP to see if they have any insights.
> If -v/dev/sda:/dev/sda works that is fine, also.
-v /dev:/dev actually breaks the ability to remote login to the host and I have to reboot. If that's a bug, I'll start a new one.
-v /dev/sda:/dev/sda doesn't break the host, but also doesn't make a difference in iotop's behavior. It still doesn't show any processes utilizing IO (except itself).
> I think iotop is getting
> blocked by one or more of the namespaces. Did you try with the --pid=host?
Yes. No change in behavior.
docker run -v /dev/sda:/dev/sda --privileged --net=host --pid=host ...
This tool looks like it is examining the host network and perhaps processes based on this device.
Yes that does work.
I suspect non-deterministic results though because now even without -v, and just --net=host --pid=host --privileged it also works which I had tried previously (albeit that was a different atomic tree version so kernel, docker, most things were different versions). I've got one other instance of a docker command affecting the behavior of the host (breaking ssh logins) until the next reboot. Between that and user error, the testing is challenging.
# docker run --net=host --pid=host --privileged -it fedext iotop -d3 -o
# docker run --net=host --pid=host --privileged -v /dev/sda:/dev/sda -it fedext iotop -d3 -o
# docker run --net=host --pid=host --privileged=true -it fedext iotop -d3 -o
# docker run --net=host --pid=host --privileged=true -v /dev/sda:/dev/sda -it fedext iotop -d3 -o
None of those crash, but none show all processes.
# docker run --net=host --pid=host -v /dev/sda:/dev/sda --privileged=true -it fedext /usr/sbin/iotop -d3
This one shows all processes. Why? Only the order of -v and --privileged differs.
# docker run --net=host --pid=host --privileged=true -it fedext iotop -d3
So does this! Now I don't even need -v?
# docker run --net=host --pid=host --privileged -it fedext iotop -d3
And now this works!!! This is the same first command that didn't work. If I reboot, this command no longer works (only iotop itself is shown as a process).
Again, none of these crash.
I have no idea, the order of option handling should have no effect, they are all bundled up and sent to the docker daemon in the same bundle. Their might be some changes being made to the kernel with each run then end up allowing the final docker run to work.
For the most part the only thing that is shared between all of these containers is the kernel. But I think we need people who know what iotop is doing to figure out what is happening.
ANy input from the IOTop guys?
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora 'version'
Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.
Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 23 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.
Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.
If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
Thank you for reporting this bug and we are sorry it could not be fixed.