iotop raises "UnboundLocalError: local variable 'pgpgin' referenced before assignment" in a ProxMox KVM

Bug #1977633 reported by Gilberto "Kowalsky" Martins
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
iotop (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Hello.

iotop just does not work in my ProxMox KVM boxes:
 $ iotop
 Traceback (most recent call last):
   File "/usr/sbin/iotop", line 10, in <module>
     from iotop.ui import main
   File "/usr/lib/python3/dist-packages/iotop/ui.py", line 46, in <module>
     from iotop.data import find_uids, TaskStatsNetlink, ProcessList, Stats
   File "/usr/lib/python3/dist-packages/iotop/data.py", line 51, in <module>
     vmstat_f = VmStat()
   File "/usr/lib/python3/dist-packages/iotop/vmstat.py", line 23, in __init__
     self.vmstat = self.read()
   File "/usr/lib/python3/dist-packages/iotop/vmstat.py", line 40, in read
     return pgpgin, pgpgout
 UnboundLocalError: local variable 'pgpgin' referenced before assignment

PVE Version:
 $ pveversion
 proxmox-ve: 6.4-1 (running kernel: 5.4.143-1-pve)

Ubuntu version:
 $ lsb_release -a
 No LSB modules are available.
 Distributor ID: Ubuntu
 Description: Ubuntu 20.04.4 LTS
 Release: 20.04
 Codename: focal

Kernel version:
 $ uname -a
 Linux prd1frm201 5.4.0-1065-kvm #68-Ubuntu SMP Wed May 18 23:28:33 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

iotop version:
 $ sudo iotop -h
 Traceback (most recent call last):
   File "/usr/sbin/iotop", line 10, in <module>
     from iotop.ui import main
   File "/usr/lib/python3/dist-packages/iotop/ui.py", line 46, in <module>
     from iotop.data import find_uids, TaskStatsNetlink, ProcessList, Stats
   File "/usr/lib/python3/dist-packages/iotop/data.py", line 51, in <module>
     vmstat_f = VmStat()
   File "/usr/lib/python3/dist-packages/iotop/vmstat.py", line 23, in __init__
     self.vmstat = self.read()
   File "/usr/lib/python3/dist-packages/iotop/vmstat.py", line 40, in read
     return pgpgin, pgpgout
 UnboundLocalError: local variable 'pgpgin' referenced before assignment

 $ sudo apt show iotop |& grep -i version
 Version: 0.6-24-g733f3f8-1

Revision history for this message
Robie Basak (racb) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better.

It looks like "pgpgin" and "pgpgout" are missing from /proc/vmstat in your environment, and that's what's causing the crash. Looking at the current upstream master branch at https://repo.or.cz/iotop.git/blob/HEAD:/iotop/vmstat.py this is a problem there too.

I'm not sure if iotop is expected to work correctly in an environment where these fields are missing, but this is really a question for iotop upstream.

To make progress, I suggest you contact upstream with this report, pointing them at this analysis. Details here: http://guichaz.free.fr/iotop/

tags: added: needs-upstream-report
Changed in iotop (Ubuntu):
importance: Undecided → Low
status: New → Triaged
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.