Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I'm a newbie to Linux (but not POSIX), and I have the following problem:
There seem to be 32 instances of the "df" command running which have been hanging for nearly a month in some cases.
[root@ussd-apps2 root]# ps -ef |grep " df" |wc -l
33
I tried killing them all:
for proc in `ps -ef |grep " df" |grep -v grep |awk '{print $2}'`; do echo "killing ${proc}"; kill ${proc}; done
But it simply didn't work. No error message, and the processes are all still there.
Even an “uncatchable” signal may not terminate a process. For instance, a zombie is the remnant of a process that’s waiting to exit. (A zombie has Z in the ps STAT column.) A process that’s being traced can also be unkillable.
Unfortunately that article doesn't tell you what you can do about zombies, if anything.
You should find out what those parent processes are (like 21968 in the case of the last one). These processes are not waiting for their spawned df processes.
Maybe it helps to visualize what is going on if you install and use the program htop and use it to display the process structure as a tree. It will update the situation regularly and you can see what those processes spawning all those instances of df are. Normally df is too fast to even learn its process number, it just prints its results then exits. I suppose there is a badly written script or something which spawns these zombie processes.
D stands for a process that has entered an uninterruptible sleep. Often, these processes refuse to die even when passed a SIGKILL.
Ok so what now?
I was thinking that it may have something to do with nfs mounts. When I run the df command I do get some output - it hangs when it gets to the nfs mount.
There is no script spawning these processes - it's curious people like me who want to find out what the disk usage is and run df -kh. So even if I can kill these processes I'll still create a new one every time I run df -kh. I suppose I should try and find out the reason the df command is hanging - as per my last post, I think it's something to do with nfs....
Have you started all those df instances yourself or is there an automatism? All those ppids look as if they got created just to spawn a df instance. There must be a reason why df cannot read the nfs mount, so there's something wrong there.
If the NFS server (or the network connection thereto) becomes unavailable all processes that try to access any part of that share will be set into D state. (Use intr or soft mount options on NFS to avoid all that).
Thanks for your help and note the solution for future reference!
Yep, a little more info, state "D" is uninterruptible sleep. In that state a program is off in a driver call and cannot be interrupted even by kill -9. Fixing or removing the NFS mount, or mounting with different options, solves that as you saw.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.