Proxmox5 Debian9 and iotop in container error

I have the same problem, iotop does not run in an LXC container (Container: Debain 9.9, Proxmox 6)

iotop version 0.6-2

Code:
root@lxc-container:~# iotop
Traceback (most recent call last):
  File "/usr/sbin/iotop", line 17, in <module>
    main()
  File "/usr/lib/python3/dist-packages/iotop/ui.py", line 620, in main
    main_loop()
  File "/usr/lib/python3/dist-packages/iotop/ui.py", line 610, in <lambda>
    main_loop = lambda: run_iotop(options)
  File "/usr/lib/python3/dist-packages/iotop/ui.py", line 508, in run_iotop
    return curses.wrapper(run_iotop_window, options)
  File "/usr/lib/python3.5/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/lib/python3/dist-packages/iotop/ui.py", line 498, in run_iotop_window
    taskstats_connection = TaskStatsNetlink(options)
  File "/usr/lib/python3/dist-packages/iotop/data.py", line 137, in __init__
    self.family_id = controller.get_family_id('TASKSTATS')
  File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 69, in get_family_id
    m = GeNlMessage.recv(self.conn)
  File "/usr/lib/python3/dist-packages/iotop/genetlink.py", line 51, in recv
    msg = conn.recv()
  File "/usr/lib/python3/dist-packages/iotop/netlink.py", line 229, in recv
    raise err
OSError: Netlink error: No such file or directory (2)

Then I took the Debian Buster version (0.6-24-g733f3f8-1) of it:
root@lxc-container:~# wget http://ftp.at.debian.org/debian/pool/main/i/iotop/iotop_0.6-24-g733f3f8-1_amd64.deb root@lxc-container:~# dpkg -i iotop_0.6-24-g733f3f8-1_amd64.deb

Code:
root@lxc-container:~/iotop-cgroups# iotop
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 620, in run_iotop
    return curses.wrapper(run_iotop_window, options)
  File "/usr/lib/python3.5/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  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)

Still the same problem, so I found this forum post, I downloaded iotop for cgroups but I run into another problem:

./iotop.py -g -cgroups

CONFIG_TASK_DELAY_ACCT not enabled in kernel, cannot determine SWAPIN and IO %

On this blog ( http://blog.brocktice.com/2012/05/23/delayacct-and-iotop-in-ubuntu-10-04-lucid-lynx/ ) the solution proposed was to add delayacct to /etc/default/grub ( GRUB_CMDLINE_LINUX_DEFAULT="delayacct quiet" )

After a reboot the problem remained: CONFIG_TASK_DELAY_ACCT not enabled in kernel, cannot determine SWAPIN and IO %

So is there a way to run iotop in an LXC container or on the host with cgroups?
 
I found out that ./iotop.py -g /lxc/[CONTAINER-ID] is not enough to list just the container. You have to exactly put the string like shown in CGROUP when running just ./iotop.py (sort by CGROUP reversed). In my case it was:

Code:
./iotop.py -g /lxc/1234/ns
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!