2

This question already has an answer here:

I'm trying to run htop on Ubuntu 16.04.1 LTS. Until the end of last week the command was working fine, and I haven't made any major changes to the system since then. Now, when I attempt to run htop, the screen goes black and I'm unable to exit using Ctrl-C, Ctrl-Z, q, or any of the standard escape characters. I'm forced to restart the terminal.

top still works just fine.

EDIT2: I ran

strace -o strace.log -f xterm -e htop

Examination of the output reveals that the htop reads all the existing processes until it gets to the last one, where it does

    41049 read(5, "72165 (python) D 1 72113 72069 0"..., 2048) = 190
    41049 read(5, "", 1858)                 = 0
    41049 close(5)                          = 0
    41049 stat("/proc/72113/task/72165", {st_mode=S_IFDIR|0555, st_size=0, ...}) = 0
    41049 open("/proc/72113/task/72165/cmdline", O_RDONLY) = 5
    41049 read(5,  <unfinished ...>

and then it never finishes reading the file.

Running ps -ef also causes the terminal to hang. It prints the names of all the processes before 72113, and then it freezes at 72113 and can't be escaped without closing the terminal.

If I type

    sudo less /proc/72113/task/72165/cmdline

the terminal hangs. I have also tried

    sudo kill -9 72113

which runs but does nothing; htop and ps -ef still freeze when run.

I'm puzzled about what's going on here.

marked as duplicate by Community May 17 '17 at 5:19

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • No, the output stopped in the middle of printing the line. The call was probably just fine. Doesn't explain what happened though. – Kusalananda May 15 '17 at 20:52
  • Could try strace -o to send the output elsewhere, or something like strace -f xterm -e htop (though that'll add a lot of xterm noise, thankfully in a different process). Just in case its being cut off due to htop trying to control the terminal. – derobert May 15 '17 at 21:05
  • What about hd /proc/72113/task/72165/cmdline (to see if the problem is reading from the file, or displaying some special character that it contains)? (You should post this output in your question, but check that it doesn't contain any confidential information.) Whch terminal emulator are you using, and can you reproduce this problem with a different one? – Gilles May 15 '17 at 23:34
  • Err, I'd check dmesg, not being able to read that file makes me think something is wrong with the kernel. Or the hardware (e.g., bad RAM). Also, how confident are you in the security of the system? If your previous assessment was "unsure" I'd downgrade it to "somewhat worried, investigate": could be a buggy rootkit trying to hide that process. – derobert May 15 '17 at 23:39
  • I noticed this question is basically the same problem I'm having. I wonder if a system restart may be necessary. – CloudyGloudy May 15 '17 at 23:58

Browse other questions tagged or ask your own question.