Bug 1290691 - iotop crash, OSError: Netlink error: No such file or directory (2)
iotop crash, OSError: Netlink error: No such file or directory (2)
Product: Fedora
Classification: Fedora
Component: iotop (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Adel Gadllah
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2015-12-11 03:12 EST by Chris Murphy
Modified: 2016-12-20 11:54 EST (History)
11 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2016-12-20 11:54:58 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
strace iotop (170.68 KB, text/plain)
2015-12-11 03:14 EST, Chris Murphy
no flags Details

  None (edit)
Description Chris Murphy 2015-12-11 03:12:01 EST
Description of problem:

When running iotop in a privileged docker container, it crashes.

Version-Release number of selected component (if applicable):

How reproducible:

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
6. exit
7. docker run --privileged=true -it fedoradiskutils /bin/bash
8. iotop

Actual results:

[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
    raise err
OSError: Netlink error: No such file or directory (2)
[root@34404614e573 /]# 

Expected results:

Should work. hdparm -I <dev> works, as does smartctl -a both of which need more hardware access than iotop.

Additional info:
Comment 1 Chris Murphy 2015-12-11 03:14 EST
Created attachment 1104593 [details]
strace iotop
Comment 2 Daniel Walsh 2015-12-11 09:59:04 EST
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

Comment 3 Daniel Walsh 2015-12-11 10:00:39 EST
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 ...
Comment 4 Chris Murphy 2015-12-11 12:42:04 EST
Adding --net=host alone solves this. Other options alone result in the same traceback. Normal/expected?
Comment 5 Chris Murphy 2015-12-12 15:59:59 EST
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.
Comment 6 Chris Murphy 2015-12-12 16:28:10 EST
(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 chris@
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.
Comment 7 Chris Murphy 2015-12-12 16:43:35 EST
no processes producing IO are listed when run in (privileged) docker container
Comment 8 Daniel Walsh 2015-12-14 12:27:32 EST
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?
Comment 9 Chris Murphy 2015-12-14 13:06:45 EST
(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.
Comment 10 Daniel Walsh 2015-12-14 15:45:00 EST

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.
Comment 11 Chris Murphy 2015-12-14 16:53:43 EST
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.
Comment 12 Chris Murphy 2015-12-16 01:11:32 EST

# 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.
Comment 13 Daniel Walsh 2015-12-17 08:58:31 EST
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.
Comment 14 Daniel Walsh 2016-01-06 15:46:41 EST
ANy input from the IOTop guys?
Comment 15 Fedora End Of Life 2016-11-24 09:09:29 EST
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'
of '23'.

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.
Comment 16 Fedora End Of Life 2016-12-20 11:54:58 EST
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.

Note You need to log in before you can comment on or make changes to this bug.