Operating System - HP-UX
1833589 Members
4004 Online
110061 Solutions
New Discussion

Kill a process with PPID 1

 
SOLVED
Go to solution
saju_2
Respected Contributor

Kill a process with PPID 1

Hi

What is the method to kill a process whose PPID is 1.

I was unmounting a cdrom while the process got hung. I tried to kill the process with kill -9 but it was not getting killed. All the options were tried but the process was still running. Finally I killed the shell , then the process has gone to PID 1.

I have faced this problem 3-4 times during vgchange process where the PPID has gone to 1 and we were forced to do a server reboot.

Is there a method other than server reboot to kill a user initiated process whose PPID has gone to 1

Thanks in advance
CS
8 REPLIES 8
Steven E. Protter
Exalted Contributor

Re: Kill a process with PPID 1

Once a process is PID 1 it can not be killed. The OS starts off with PID 1 and this process can not be allowed to die.

kill -9 doesn't work because if the parent gets killed all the children become orphans.

Prior to the PID 1 problem, you might have success with any kill other than kill -9

IF the PPID is 1, don't use kill -9 it will create the situation you currently have.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Geoff Wild
Honored Contributor

Re: Kill a process with PPID 1

As Steven said - you can't kill it...

That said, you could try stopping it...

Try kill -18

It may eventually die....

You may have to rebooot :(

Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Arunvijai_4
Honored Contributor

Re: Kill a process with PPID 1

You can't kill a process with PPID 1(init process, which is the father of all other processes in OS). The process will become orphan and Init will be its PPID. Only way is rebooting server to get rid.

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Bill Hassell
Honored Contributor
Solution

Re: Kill a process with PPID 1

I think the problem is more basic than PPID 1. kill -9 (from root) sets the SIGKILL flag in the process table but nothing happens if the process is waitning on I/O. You can't make any process disappear from the process table until it starts running, and it won't run if the kernel has not returned control to the program. I/O is notorious for hanging processes. Most drivers have timeouts, but a few, especially NFS and depending on patches, CDROMs, keep waiting forever. The same is true with broken disk devices that don't handshake properly. I have personally seen a bronken disk hangup all networking queries (netstat, nslookup, lanscan) and the processes could not be killed. Once the disk was physically removed, evrything started working again.

So the process is likely not running at all (consuming CPU cycles) but just waiting on I/O that will never finish.


Bill Hassell, sysadmin
saju_2
Respected Contributor

Re: Kill a process with PPID 1

Hi

The command which I issued was a pfs_umount and it went to a hung state forever. The server was not into production (installation stage) and I was able to do a reboot.

I was able to do a pfs_mount and pfs_umount after the reboot without any problem. I wonder what went wrong first time.

Thanks to all for giving their valuable suggestions.

Regards
CS
Geoff Wild
Honored Contributor

Re: Kill a process with PPID 1

Instead of pfs_mount - install the Rockridge Extentions:

Install the Rock-Ridge extension patches instead and never worry about these problems. For HP-UX 11.00 you will need forget all about PFS and install PHKL_26448 (now superceded by PHKL_28060), PHCO_26449, and PHKL_26450 to have HP-UX recognize those file systems automatically on mount! For HP-UX 11.11 (11i) you need PHCO_25841, PHKL_26269, and PHKL_25760 (now superceded by PHKL_28025).

Installation of patches requires a reboot.

swinstall -x autoreboot=true -x autoselect_patches=TRUE -x patch_match_target=TRUE -x patch_filter=*
.* -s mydepotserver:/var/software/hp/rockridge @`hostname`


To mount a Rockridge CD (instead of using pfs_mount):

mount -F cdfs -o ro,rr,noauto /dev/cdrom /cdrom

To unmount:

umount /cdrom

To share out the cd over NFS:

exportfs -i -o ro,anon=0 /cdrom

On remote:

mount -F nfs sha1:/cdrom /zmnt


Note: client server does NOT need to have Rock Ridge patches installed to access the cdrom remotely.



Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Bill Hassell
Honored Contributor

Re: Kill a process with PPID 1

Just a followup to Geoff's post: PFS is NOT recommended at all. The hang you saw is very typical for PFS and the most common scenario is to start the two PFS processes in the wrong order. PFS is a true hack: in order to provide the needed functionality without writing a driver, Young Minds, Inc (the authors of PFS) wrote user code that reads the raw CDROM, performs the CD filesystem translations and then exports the results with rpc calls as an NFS filesystem.

Never use PFS if you are running 11.00 or higher (get the latest RockRidge patches). If you are running 10.20, you have no choice, but realize that PFS may eventually force you to reboot your machine again. Once PFS hangs, logins, bdf, all sorts of filesystem commands may also hang.


Bill Hassell, sysadmin
saju_2
Respected Contributor

Re: Kill a process with PPID 1

Hi Bill and Geoff

Thanks for giving a valuable input as pfs mount cannot be used in 11.x . I cannot give u any point as the thread is closed. But I am really thankful to u since u replied eventhough the thread was closed.

Warm regards
CS