5

Specifications

[midas@localhost ~]$ uname -a Linux localhost.localdomain 4.0.4-301.fc22.x86_64 #1 SMP Thu May 21 13:10:33 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

and

[midas@localhost ~]$ cat /etc/issue Fedora release 22 (Twenty Two)

Problem preface

I was trying to install a new package through dnf on my Fedora 22. (Linux 4.0.4) When the package stopped downloading at 52% and the terminal window didn't show any more advancement.

I aborted the download and attempted to restart it using the same dnf install [package name] command.

I then received the following notification: Waiting for process with pid 2967 to finish.

Turns out dnf was still running in the background:

[midas@localhost ~]$ ps -A | grep 2967 2967 ? 00:00:01 dnf

Problem

I figured I could just kill the process, however:

[midas@localhost ~]$ kill 2967 bash: kill: (2967) - No such process [midas@localhost ~]$ sudo kill 2967 kill: sending signal to 2967 failed: No such process

How come ps can list the process but kill can't find it?

I know a reboot will solve this (or a bit of patience even). But I'm just curious as to why there is such a difference between these 2 commands.

Midas
  • 65
  • 1
  • 2
  • 8
  • 1
    If you repeat the `ps`command, then the PID is still there? – Jan Oct 07 '15 at 09:05
  • @Jan, yes, right after the kill command it was. After a while (while documenting for Stackexchange) the dnf started downloading the package and the ps entry with pid 2967 dissapeared. – Midas Oct 07 '15 at 11:05

1 Answers1

4

The listed process was probably already a zombie process, which you cannot kill. Its live-time is depending on its parent process.

If you add the u flag to the call of ps, it displays also the STAT column which is Z for zombie processes.

See e.g. https://stackoverflow.com/questions/16944886/how-to-kill-zombie-process for more details.

jofel
  • 26,513
  • 6
  • 65
  • 92