I have this busybox/linux box that I need to maintain periodically. To do that, I issue a ps
command programmatically and check the running processes.
But as shown in the screenshot, sometimes, the ps
command does not terminate and return to the prompt, it just stays there, and so my application cannot proceed.
It's also obvious that previous ps
commands are still running while the current one (i.e. which's output is shown in the screenshot) is also hanged.
Does anyone know what could be the problem and how to fix it ?
strace -vf ps aux 2>&1 | tee /tmp/ps.strace
. And take a look at that file. – Runium Jun 20 '13 at 11:25strace
&aux
) doesn't exist. While thetee
commands causes the same behavior. I tried copying theps.strace
file locally to check it on a windows machine but it only contained the following line:-sh: strace: command not found
– Muhammad Gelbana Jun 20 '13 at 11:42aux
wasn't important, only a reflex on my part.). Is the system built on some distro as base (the Linux)? What is the version ofps
?ps --version
or the like. Doeslsof
give you anything to work with? E.g.lsof -p <PID_OF_HUNG_PS> | grep proc
. And again; anything in log files? Looks like you have root access, could you installstrace
? – Runium Jun 20 '13 at 12:20reboot
also hanging there (PID2398
and2471
)? If it is I guess there is more thenps
that has trouble. Log-files should hopefully give some indication on what is going on. – Runium Jun 20 '13 at 12:30uname -a
outputs:Linux HST-R1 2.6.25.4 #1 Mon Oct 26 15:28:50 EDT 2009 ppc unknown
I also remember we are usingbusybox
.lsof
isn't installed andps
doesn't support the--version
option. I'm sorry I'm not very good with linux. What other logs can I inspect ? Thanks a lot for your help. – Muhammad Gelbana Jun 20 '13 at 12:52HST
, but that is an fairly old kernel version. You should also get open files of process byls -la /proc/<PID_OF_PS>/fd/
– (Only wondering if it is stuck on a specific file). For other information in/proc/
look at PROC(5). As for log files look in/var/log/
. As it is an custom build you have to poke around, but you should have something likemessages
,dmesg
,kern.log
etc. Look e.g. here: Some of the logfiles. Do you havesysctl
?sysctl fs.file-nr
. – Runium Jun 20 '13 at 13:14