This KB article helps to troubleshoot a process which is stuck and it is further denying another processes to function.
Killing a 'mgd' process which is stuck and denying other process to execute. Sometimes multiple processes are opened for the same script or for a daemon (for example, mgd) and there is a need to kill some process. Some processes which are consuming high CPU can also be killed from shell.
In the example, a process ID 1062 is stuck starting from 2019-11-30 18:28 UTC. It is a 'mgd' process.
lab@ex4300> show system processed extensive | match 1062 1062 root 1 96 0 46212K 2772K select 0:00 0.00% mgd
Due to a 'mgd' process in a stuck state, the switch was unable to proceed further with the Junos software upgrade process.
lab@ex4300> request system software add reboot /var/tmp/jinstall-ex-4300-21.4R2.10-signed.tgz no-validate ERROR: Another package installation in progress: user root terminal unknown, process 1062, started at 2019-11-30 18:28 UTC
----Check the Junos installed logs-----
lab@ex4300> show log install 2023-10-18 04:02:58 UTC mgd[1864]: /user/libexec/ui/package -X update -reboot /var/tmp/jinstall-ex-4300-21.4R2.10-signed.tgz <output> ERROR: Another package installation in progress: user root terminal unknown, process 1062, started at 2019-11-30 18:28 UTC </output> <package-result>1</package-result> 2023-10-18 04:03:53 UTC mgd[1886]: /usr/libexec/ui/package -X update -reboot /var/tmp/jinstall-ex-4300-21.4R2.10-signed.tgz <output> ERROR: Another package installation in progress:
From the above log, we understand that the process 1062 is in installation and hence denying another process from processing further.
The stuck process can be killed from shell
lab@ex4300> start shell user root Password: lab@ex4300:RE:0% kill -9 1062 lab@ex4300:RE:0% exit
Once the stuck mgd process is killed, the Junos code upgrade process can be initiated.