This question already has an answer here:

So I have a friend who had an ssh server running on his Raspberry Pi (This question isn't a problem specific to RPi, so that's why I'm posting here). I logged in over ssh, and ran :(){ :|: & };:, as a joke. He texted me and asked me what I did, and why his Pi was lagging so bad, and I told him and he sent back the laughing emoji. He asked how to fix it, so I told him to reboot. He did and told me that it was still lagging, but he had a minute or so before it froze up again. I did not know that the fork bomb would persist after a reboot. He has managed to (kinda) fix this. I just asked him what he did, and he replied with "First I tried ulimit, that had minimal effectiveness. Then, I ran a while loop from terminal that killed the process every second." I have no idea how he got the process name to kill.

So the problem is that even though there is a script running to kill the processes every second, his Pi keeps jumping off of the network. I don't know why this is happening. How can we completely eradicate the fork bomb?

(By the way, he is not mad at me [That I know of], and he has said he is not mad)

marked as duplicate by muru, Stephen Rauch, countermode, Jeff Schaller, Rui F Ribeiro Jul 3 '17 at 12:15

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 4
    The fork bomb as posted in your question is not persistent after a reboot. Something else is going on. Maybe your SD Card is on its way out. – captcha Jul 2 '17 at 23:51
  • Oh. Are there any clues or something that could possibly tell you what the problem is? – tylerr147 Jul 2 '17 at 23:52
  • Take out the SD Card and do a fsck -f from another system. Backup first of course.. – captcha Jul 2 '17 at 23:54
  • Alright. We'll try that – tylerr147 Jul 2 '17 at 23:54
  • @captcha What is the -f used for? – tylerr147 Jul 2 '17 at 23:57

We are pretty sure it is not the fork bomb causing this. If he has 60 seconds, then there are a lot of things it is possible to run.

I would do:

terminal1$ wssh rpi-server cat /var/log/syslog > rpi-syslog
terminal2$ wssh rpi-server tail -f /var/log/syslog
terminal3$ wssh rpi-server top
terminal4$ wssh rpi-server dmesg

(wssh waits for the port to open, and runs SSH immediately, so you get in ASAP. It uses w4it-for-port-open and nc: https://gitlab.com/ole.tange/tangetools/tree/master/w4it-for-port-open https://gitlab.com/ole.tange/tangetools/tree/master/wssh)

Not the answer you're looking for? Browse other questions tagged or ask your own question.