How to kill a continuous process started from rc.local?

6,615

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.

Share:
6,615

Related videos on Youtube

Skyler
Author by

Skyler

I have discovered a truly marvelous proof of myself, which this margin is too narrow to contain.

Updated on September 18, 2022

Comments

  • Skyler
    Skyler over 1 year

    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?