diff options
author | Paul Wise <pabs3@bonedaddy.net> | 2018-05-03 11:06:09 +0800 |
---|---|---|
committer | Paul Wise <pabs3@bonedaddy.net> | 2018-05-03 12:34:06 +0800 |
commit | 0881c06027b49c3e53fcfe803ba63e11b2090ef3 (patch) | |
tree | 20b890da22b3a8f2bab67be53c841793277662bd | |
parent | 5bdd01c3b3b1c415c71b00b2374538995f63597c (diff) | |
download | iotop-0881c06027b49c3e53fcfe803ba63e11b2090ef3.tar.gz |
Improve the message that is printed when Linux taskstats are not found
Usually this means that iotop is being run in a container.
The Linux kernel doesn't support taskstats outside the host net namespace.
There was a patch that looks like it may fix this but it never got merged.
Traceback (most recent call last):
File "/usr/sbin/iotop", line 17, in <module>
main()
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 737, in main
main_loop()
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 727, in <lambda>
main_loop = lambda: run_iotop(options)
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 618, in run_iotop
return run_iotop_window(None, options)
File "/usr/lib/python3/dist-packages/iotop/ui.py", line 609, in run_iotop_window
taskstats_connection = TaskStatsNetlink(options)
File "/usr/lib/python3/dist-packages/iotop/data.py", line 151, in __init__
self.family_id = controller.get_family_id('TASKSTATS')
File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 76, in get_family_id
m = GeNlMessage.recv(self.conn)
File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 56, in recv
msg = conn.recv()
File "/usr/lib/python3/dist-packages/iotop/netlink.py", line 255, in recv
raise err
OSError: Netlink error: No such file or directory (2)
See-also: https://blog.outlyer.com/using-netlink-to-calculate-load-averages
See-also: https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg924689.html
See-also: https://bugzilla.redhat.com/show_bug.cgi?id=1290691
See-also: https://bugs.openvz.org/browse/OVZ-5655
-rw-r--r-- | iotop/ui.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/iotop/ui.py b/iotop/ui.py index c22ed1a..2482511 100644 --- a/iotop/ui.py +++ b/iotop/ui.py @@ -630,6 +630,15 @@ configure sudo to allow you to run iotop as root. Please do not file bugs on iotop about this.''', file=sys.stderr) sys.exit(1) + if e.errno == errno.ENOENT: + print(e, file=sys.stderr) + print(''' +The Linux kernel interfaces that iotop relies on for process I/O statistics +were not found. Please enable CONFIG_TASKSTATS in your Linux kernel build +configuration, use iotop outside a container and or share the host's +network namespace with the container. + +Please do not file bugs on iotop about this.''', file=sys.stderr else: raise |