4

I'm working on a Raspberry Pi with Raspbian (Debian-based) OS. For testing I added such a command in /etc/rc.local:

python /home/pi/test.py

It works fine starting this script. But the problem is that I forgot that there is an infinite loop in the script, something like:

while True:
    print 'Hello"
    time.sleep(5)

This loop blocks the system to boot, so I can't enter the system to edit the script. Ctrl+C doesn't work to kill it. So I wonder how to kill a continuous process started from rc.local?

Timothy
  • 205
  • 3
  • 8

2 Answers2

5

You cannot kill the process interactively from the console but you have multiple options how to avoid running of it during boot.

a) Boot in a single user mode

Append s separated by space to the line in cmdline.txt in the boot partition (FAT). After booting you can either rename /etc/rc.local, make it non-executable (chmod a-x /etc/rc.local) or edit it.

b) Boot with a shell instead of init

Append init=/bin/sh separated by space to the line in cmdline.txt. This will bypass starting of any boot scripts. Then you can make the same measures against /etc/rc.local as above.

c) Mount the Linux partition in a different system

Put the SD card to a different system and mount the partition with /etc/rc.local there. Then you can make the same measures against /etc/rc.local as above.

0

I have a same kind of application which play infinitely after reboot. For any changes, I mount that to another system and do the changes and put it back to my board. Its the easiest way to do so.

NitinG
  • 101
  • 4