Error with command iotop on CentOS












13















When using sudo iotop (latest version 0.6-2.el7) in a terminal in my newly installed CentOS 7.5, I get the following error message:



Traceback (most recent call last):
File "/sbin/iotop", line 17, in <module>
main()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 620, in main
main_loop()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 610, 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 501, in run_iotop_window
ui.run()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 155, in run
self.process_list.duration)
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 434, in refresh_display
lines = self.get_data()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 415, in get_data
return list(map(format, processes))
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 388, in format
cmdline = p.get_cmdline()
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 292, in get_cmdline
proc_status = parse_proc_pid_status(self.pid)
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 196, in parse_proc_pid_status
key, value = line.split(':t', 1)
ValueError: need more than 1 value to unpack


Any idea how to fix this problem?










share|improve this question

























  • It works for me. uname: Linux 4.4.0-127-generic #153~14.04.1-Ubuntu iotop version: iotop 0.6 Phyton version /usr/bin/python2.7

    – Marko
    Sep 3 '18 at 19:20
















13















When using sudo iotop (latest version 0.6-2.el7) in a terminal in my newly installed CentOS 7.5, I get the following error message:



Traceback (most recent call last):
File "/sbin/iotop", line 17, in <module>
main()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 620, in main
main_loop()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 610, 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 501, in run_iotop_window
ui.run()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 155, in run
self.process_list.duration)
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 434, in refresh_display
lines = self.get_data()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 415, in get_data
return list(map(format, processes))
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 388, in format
cmdline = p.get_cmdline()
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 292, in get_cmdline
proc_status = parse_proc_pid_status(self.pid)
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 196, in parse_proc_pid_status
key, value = line.split(':t', 1)
ValueError: need more than 1 value to unpack


Any idea how to fix this problem?










share|improve this question

























  • It works for me. uname: Linux 4.4.0-127-generic #153~14.04.1-Ubuntu iotop version: iotop 0.6 Phyton version /usr/bin/python2.7

    – Marko
    Sep 3 '18 at 19:20














13












13








13


1






When using sudo iotop (latest version 0.6-2.el7) in a terminal in my newly installed CentOS 7.5, I get the following error message:



Traceback (most recent call last):
File "/sbin/iotop", line 17, in <module>
main()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 620, in main
main_loop()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 610, 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 501, in run_iotop_window
ui.run()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 155, in run
self.process_list.duration)
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 434, in refresh_display
lines = self.get_data()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 415, in get_data
return list(map(format, processes))
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 388, in format
cmdline = p.get_cmdline()
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 292, in get_cmdline
proc_status = parse_proc_pid_status(self.pid)
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 196, in parse_proc_pid_status
key, value = line.split(':t', 1)
ValueError: need more than 1 value to unpack


Any idea how to fix this problem?










share|improve this question
















When using sudo iotop (latest version 0.6-2.el7) in a terminal in my newly installed CentOS 7.5, I get the following error message:



Traceback (most recent call last):
File "/sbin/iotop", line 17, in <module>
main()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 620, in main
main_loop()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 610, 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 501, in run_iotop_window
ui.run()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 155, in run
self.process_list.duration)
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 434, in refresh_display
lines = self.get_data()
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 415, in get_data
return list(map(format, processes))
File "/usr/lib/python2.7/site-packages/iotop/ui.py", line 388, in format
cmdline = p.get_cmdline()
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 292, in get_cmdline
proc_status = parse_proc_pid_status(self.pid)
File "/usr/lib/python2.7/site-packages/iotop/data.py", line 196, in parse_proc_pid_status
key, value = line.split(':t', 1)
ValueError: need more than 1 value to unpack


Any idea how to fix this problem?







centos python iotop






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 29 '18 at 9:49







F. Privé

















asked May 29 '18 at 7:24









F. PrivéF. Privé

16816




16816













  • It works for me. uname: Linux 4.4.0-127-generic #153~14.04.1-Ubuntu iotop version: iotop 0.6 Phyton version /usr/bin/python2.7

    – Marko
    Sep 3 '18 at 19:20



















  • It works for me. uname: Linux 4.4.0-127-generic #153~14.04.1-Ubuntu iotop version: iotop 0.6 Phyton version /usr/bin/python2.7

    – Marko
    Sep 3 '18 at 19:20

















It works for me. uname: Linux 4.4.0-127-generic #153~14.04.1-Ubuntu iotop version: iotop 0.6 Phyton version /usr/bin/python2.7

– Marko
Sep 3 '18 at 19:20





It works for me. uname: Linux 4.4.0-127-generic #153~14.04.1-Ubuntu iotop version: iotop 0.6 Phyton version /usr/bin/python2.7

– Marko
Sep 3 '18 at 19:20










2 Answers
2






active

oldest

votes


















29














Apparently, recent kernel versions introduced a blank line in /proc/(pid)/status that iotop does not expect:



CapBnd: 0000001fffffffff
CapAmb: 0000000000000000
Seccomp: 0

SpeculationStoreBypass: vulnerable


As a zeroth approximation of a fix, edit (as root) /usr/lib/python2.7/site-packages/iotop/data.py ca l.195:



def parse_proc_pid_status(pid):
result_dict = {}
try:
for line in open('/proc/%d/status' % pid):
if not line.strip(): continue
key, value = line.split(':t', 1)
result_dict[key] = value.strip()
except IOError:
pass # No such process

return result_dict


where the if not line.strip(): continue is new. Beware that python does not have explicit braces, so the indentation of this line should match that of the line below it.



(Also see https://bugs.launchpad.net/pkg-website/+bug/1773383 for other fixes for this bug.)






share|improve this answer





















  • 1





    Here is a link to the CentOS bug covering this issue: bugs.centos.org/view.php?id=14864

    – doshea
    Jun 2 '18 at 6:06











  • Same for "Pympler" Python package. Line 147. Add if not entry.strip(): continue before to solve that problem. pythonhosted.org/Pympler

    – Eduardo Lucio
    Jun 12 '18 at 18:02



















0














Just to complement the accepted answer (couldn't add as comment because they don't allow multiple white spaces)




  1. Search for the filepath of the Python script


sudo find ./usr/lib | grep iotop/data.py



  1. Replace with sed


sed -i '1n;/key, value = line/i            if not line.strip(): continue' <script_path>


Be careful and check everything is ok the first time you run it.



For my systems, it is:



sudo sed -i '1n;/key, value = line/i            if not line.strip(): continue' /usr/lib/python2.7/dist-packages/iotop/data.py





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "106"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446624%2ferror-with-command-iotop-on-centos%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    29














    Apparently, recent kernel versions introduced a blank line in /proc/(pid)/status that iotop does not expect:



    CapBnd: 0000001fffffffff
    CapAmb: 0000000000000000
    Seccomp: 0

    SpeculationStoreBypass: vulnerable


    As a zeroth approximation of a fix, edit (as root) /usr/lib/python2.7/site-packages/iotop/data.py ca l.195:



    def parse_proc_pid_status(pid):
    result_dict = {}
    try:
    for line in open('/proc/%d/status' % pid):
    if not line.strip(): continue
    key, value = line.split(':t', 1)
    result_dict[key] = value.strip()
    except IOError:
    pass # No such process

    return result_dict


    where the if not line.strip(): continue is new. Beware that python does not have explicit braces, so the indentation of this line should match that of the line below it.



    (Also see https://bugs.launchpad.net/pkg-website/+bug/1773383 for other fixes for this bug.)






    share|improve this answer





















    • 1





      Here is a link to the CentOS bug covering this issue: bugs.centos.org/view.php?id=14864

      – doshea
      Jun 2 '18 at 6:06











    • Same for "Pympler" Python package. Line 147. Add if not entry.strip(): continue before to solve that problem. pythonhosted.org/Pympler

      – Eduardo Lucio
      Jun 12 '18 at 18:02
















    29














    Apparently, recent kernel versions introduced a blank line in /proc/(pid)/status that iotop does not expect:



    CapBnd: 0000001fffffffff
    CapAmb: 0000000000000000
    Seccomp: 0

    SpeculationStoreBypass: vulnerable


    As a zeroth approximation of a fix, edit (as root) /usr/lib/python2.7/site-packages/iotop/data.py ca l.195:



    def parse_proc_pid_status(pid):
    result_dict = {}
    try:
    for line in open('/proc/%d/status' % pid):
    if not line.strip(): continue
    key, value = line.split(':t', 1)
    result_dict[key] = value.strip()
    except IOError:
    pass # No such process

    return result_dict


    where the if not line.strip(): continue is new. Beware that python does not have explicit braces, so the indentation of this line should match that of the line below it.



    (Also see https://bugs.launchpad.net/pkg-website/+bug/1773383 for other fixes for this bug.)






    share|improve this answer





















    • 1





      Here is a link to the CentOS bug covering this issue: bugs.centos.org/view.php?id=14864

      – doshea
      Jun 2 '18 at 6:06











    • Same for "Pympler" Python package. Line 147. Add if not entry.strip(): continue before to solve that problem. pythonhosted.org/Pympler

      – Eduardo Lucio
      Jun 12 '18 at 18:02














    29












    29








    29







    Apparently, recent kernel versions introduced a blank line in /proc/(pid)/status that iotop does not expect:



    CapBnd: 0000001fffffffff
    CapAmb: 0000000000000000
    Seccomp: 0

    SpeculationStoreBypass: vulnerable


    As a zeroth approximation of a fix, edit (as root) /usr/lib/python2.7/site-packages/iotop/data.py ca l.195:



    def parse_proc_pid_status(pid):
    result_dict = {}
    try:
    for line in open('/proc/%d/status' % pid):
    if not line.strip(): continue
    key, value = line.split(':t', 1)
    result_dict[key] = value.strip()
    except IOError:
    pass # No such process

    return result_dict


    where the if not line.strip(): continue is new. Beware that python does not have explicit braces, so the indentation of this line should match that of the line below it.



    (Also see https://bugs.launchpad.net/pkg-website/+bug/1773383 for other fixes for this bug.)






    share|improve this answer















    Apparently, recent kernel versions introduced a blank line in /proc/(pid)/status that iotop does not expect:



    CapBnd: 0000001fffffffff
    CapAmb: 0000000000000000
    Seccomp: 0

    SpeculationStoreBypass: vulnerable


    As a zeroth approximation of a fix, edit (as root) /usr/lib/python2.7/site-packages/iotop/data.py ca l.195:



    def parse_proc_pid_status(pid):
    result_dict = {}
    try:
    for line in open('/proc/%d/status' % pid):
    if not line.strip(): continue
    key, value = line.split(':t', 1)
    result_dict[key] = value.strip()
    except IOError:
    pass # No such process

    return result_dict


    where the if not line.strip(): continue is new. Beware that python does not have explicit braces, so the indentation of this line should match that of the line below it.



    (Also see https://bugs.launchpad.net/pkg-website/+bug/1773383 for other fixes for this bug.)







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 29 '18 at 8:54

























    answered May 29 '18 at 8:40









    Ulrich SchwarzUlrich Schwarz

    9,63512946




    9,63512946








    • 1





      Here is a link to the CentOS bug covering this issue: bugs.centos.org/view.php?id=14864

      – doshea
      Jun 2 '18 at 6:06











    • Same for "Pympler" Python package. Line 147. Add if not entry.strip(): continue before to solve that problem. pythonhosted.org/Pympler

      – Eduardo Lucio
      Jun 12 '18 at 18:02














    • 1





      Here is a link to the CentOS bug covering this issue: bugs.centos.org/view.php?id=14864

      – doshea
      Jun 2 '18 at 6:06











    • Same for "Pympler" Python package. Line 147. Add if not entry.strip(): continue before to solve that problem. pythonhosted.org/Pympler

      – Eduardo Lucio
      Jun 12 '18 at 18:02








    1




    1





    Here is a link to the CentOS bug covering this issue: bugs.centos.org/view.php?id=14864

    – doshea
    Jun 2 '18 at 6:06





    Here is a link to the CentOS bug covering this issue: bugs.centos.org/view.php?id=14864

    – doshea
    Jun 2 '18 at 6:06













    Same for "Pympler" Python package. Line 147. Add if not entry.strip(): continue before to solve that problem. pythonhosted.org/Pympler

    – Eduardo Lucio
    Jun 12 '18 at 18:02





    Same for "Pympler" Python package. Line 147. Add if not entry.strip(): continue before to solve that problem. pythonhosted.org/Pympler

    – Eduardo Lucio
    Jun 12 '18 at 18:02













    0














    Just to complement the accepted answer (couldn't add as comment because they don't allow multiple white spaces)




    1. Search for the filepath of the Python script


    sudo find ./usr/lib | grep iotop/data.py



    1. Replace with sed


    sed -i '1n;/key, value = line/i            if not line.strip(): continue' <script_path>


    Be careful and check everything is ok the first time you run it.



    For my systems, it is:



    sudo sed -i '1n;/key, value = line/i            if not line.strip(): continue' /usr/lib/python2.7/dist-packages/iotop/data.py





    share|improve this answer




























      0














      Just to complement the accepted answer (couldn't add as comment because they don't allow multiple white spaces)




      1. Search for the filepath of the Python script


      sudo find ./usr/lib | grep iotop/data.py



      1. Replace with sed


      sed -i '1n;/key, value = line/i            if not line.strip(): continue' <script_path>


      Be careful and check everything is ok the first time you run it.



      For my systems, it is:



      sudo sed -i '1n;/key, value = line/i            if not line.strip(): continue' /usr/lib/python2.7/dist-packages/iotop/data.py





      share|improve this answer


























        0












        0








        0







        Just to complement the accepted answer (couldn't add as comment because they don't allow multiple white spaces)




        1. Search for the filepath of the Python script


        sudo find ./usr/lib | grep iotop/data.py



        1. Replace with sed


        sed -i '1n;/key, value = line/i            if not line.strip(): continue' <script_path>


        Be careful and check everything is ok the first time you run it.



        For my systems, it is:



        sudo sed -i '1n;/key, value = line/i            if not line.strip(): continue' /usr/lib/python2.7/dist-packages/iotop/data.py





        share|improve this answer













        Just to complement the accepted answer (couldn't add as comment because they don't allow multiple white spaces)




        1. Search for the filepath of the Python script


        sudo find ./usr/lib | grep iotop/data.py



        1. Replace with sed


        sed -i '1n;/key, value = line/i            if not line.strip(): continue' <script_path>


        Be careful and check everything is ok the first time you run it.



        For my systems, it is:



        sudo sed -i '1n;/key, value = line/i            if not line.strip(): continue' /usr/lib/python2.7/dist-packages/iotop/data.py






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 20 mins ago









        AFP_555AFP_555

        1033




        1033






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Unix & Linux Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446624%2ferror-with-command-iotop-on-centos%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Accessing regular linux commands in Huawei's Dopra Linux

            Can't connect RFCOMM socket: Host is down

            Kernel panic - not syncing: Fatal Exception in Interrupt