1

Despite kill -9 $PID should work always, it sometimes does not. At least I have some encounters to recall. Yesterday I got one such: I had a problem with my SD-card and I wrote it over with zeroes (dd). After that, I reinserted into a card reader and tried to list all partitions available:

$ sudo parted -l

But the process hanged and after a couple of minutes I tried to interrupt it with CTR+C. It did nothing, so I tried to kill the process:

$ ps aux | grep parted
root      26968  0.0  0.0  73408  4384 pts/4    S+   01:40   0:00 sudo parted -l
root      26969  0.0  0.0  39516  3072 pts/4    D+   01:40   0:00 parted -l
username  27178  0.0  0.0  15664  1148 pts/5    S+   01:45   0:00 grep parted

After a few iterations of

$ sudo kill 26969
$ sudo kill -15 26969
$ sudo kill -9 26969 
$ sudo kill -9 26968 

I got killed 26968 (just sudo, I think). PID 26969 is still (about 16h later) in a process table:

root     26969  0.0  0.0  39516   444 pts/4    D    01:40   0:00 parted -l

And I can't access my SD-card, I reinserted it few times tried to access it few ways, in dmesg I don't see any events on inserting the card. Usually, in situations like that, I have found no other ways but reboot.

Is there a better way?

w.k
  • 119
  • 1
    No, there is nothing else you can do. This sounds like a bug in the SD card driver. In your linked answer this is mentioned as erroneously being in uninterruptible sleep. – icarus Dec 21 '19 at 16:02
  • 2
    You process is in interruptible sleep so kill -9 isn't going to work. The only way to stop it is the reboot the system but the driver will just cause it to happen it again. – Nasir Riley Dec 21 '19 at 16:20
  • 1
    "However kill -9 is not guaranteed to work immediately" – muru Dec 21 '19 at 16:33
  • 3
    Uninterruptible sleep, is uninterruptible. – Kusalananda Dec 21 '19 at 16:59
  • @muru are you ironic with your quote or do you know when immediately ends? – w.k Dec 21 '19 at 19:13
  • @NasirRiley what you mean with "will cause it to happen again"? I can't use this SD-card anymore? – w.k Dec 21 '19 at 19:17
  • I'm merely pointing out that you're being misleading in your question. "Despite kill -9 $PID should work always, it sometimes does not." ... is obviously false. – muru Dec 21 '19 at 21:37
  • @w.k I think he means that it's a bug. As long as the bug isn't fixed, it can happen again. I'm not sure how you would debug that, but you could try to find out which driver you're using and then notifying the developers. – rudib Dec 27 '19 at 13:04

0 Answers0