Tuesday, November 6, 2012

solaris 10 forcefully shutdown a zone

In my notes this is marked: "killzonekill".

That being said...

Sometimes my zones on Solaris 10 refuse to shut down. This could be for a variety of reasons. A tell-tale sign is, say after 1day, you see this:
[root@bigsystem ~]# zoneadm -z soxvm218 shutdown

... 24 hours later ...

[root@bigsystem ~]# zoneadm list -civ 

  18 soxvm218       shutting_down /opt/zones/soxvm218          native   shared

Well hell. Maybe there be zombies.
[root@bigsystem ~]# ps -fz soxvm218
     UID   PID  PPID   C    STIME TTY         TIME CMD
    root  1619     1   0 21:56:00 ?           0:00 zsched
 0003088  4486     1   0        - ?           0:00 defunct
Yeah. defunct that's no fun.

You try the usual:

[root@bigsystem ~]# zoneadm -z zonename unmount -f
[root@bigsystem ~]# zoneadm -z zonename reboot -- -s 
[root@bigsystem ~]# pkill -9 -z zonename
Nada.

In that case, do some kill -9 action. Programmatically:
for i in `ps -lLef | grep defunct |grep -v grep | awk '{print $4}'`
               do 
                 echo "Killiing Process..pidno= $i" ; sleep 1 
                  kill -9 $i ; sleep 5; 
               done
Yeah. That does it every time.

No comments: