Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stop Raspberry Pi from running program at boot

I was trying to figure out how to run a program at boot, but after realizing this program is an infinite loop, I have no way of getting out, or back to the terminal. Right when I give the Pi power it just goes right to the program on a black background. I don't remember exactly what I did to make it run at boot, I believe I just added some code in a place right above something that said "exit 0" and below something that says "esac". I don't remember the command that even got me there. (I am new to the Pi and Python and have just been playing around..unsucessfully.)

If anyone could help me either delete this program or get me to be able to edit it so I can fix the infinite loop that would be great. I'd rather not have to completely over-write the sd card with a fresh raspbian. But like I said I can't do anything at boot, and Ctrl + C doesn't do anything nor Ctrl + Alt + Delete.

EDIT: When I put the SD card in my computer, I see a list of 11 files: bootcode cmdline config fixup fixup_cd issue kernel kernel_cutdown kernel_emergency start.elf start_cd.elf

None of these mean anything to me...

like image 837
user2506445 Avatar asked Jun 21 '13 14:06

user2506445


People also ask

How do I stop a script from running on my Raspberry Pi?

Re: Stopping a script and clearing it from Pi memoryctrl-z doesn't kill a script it just suspends it so it will still be in memory. You can continue running it using either "fg" or "bg" depending on whether you want to have it running in the forground or background. ctrl-c kills most scripts dead.

How do I force quit a program on Raspberry Pi?

To stop a running program, make the program the focused window and use the key combination of Alt + F4 keys. Alt + F4 only works if the operating system is not frozen. Easily install anything on your Pi using Pi-Apps.


3 Answers

Update: Looks like I failed to get that you want to interrupt the running bootprocess and stop the script.

The simplest idea would be to turn of the pi, unplug the sd card and plug it into your desktop, (re)move the script and boot again.


Processes spawned during boot are stored in scripts in /etc/init.d/.... These scripts are called by the init process, the first process on a Linux machine (PID:1)

But init starts not all scripts in /etc/init.d. This depends on the run level. On a debian system there are 7 run levels.

For every run level there is a folder called like:

/etc/rc0.d
...
/rc6.d

in which are softlinks to scripts from /etc/init.d are stored.

To remove a script from being executed on every boot you'll delete all links from that folders. Usually on debian systems this is done using the update-rc.d tool:

update-rc.d NAME_OF_INIT_SCRIPT remove

You should also have a look at the file /etc/rc.local

like image 52
hek2mgl Avatar answered Oct 12 '22 04:10

hek2mgl


Alt + PrintScn + k to kill the process stuck running from rc.local

like image 26
user1070356 Avatar answered Oct 12 '22 04:10

user1070356


You can use the cmdline.txt. First, add or modify the cmdline.txt file on your sd card. Add "init=/bin/sh", then restart your Pi, and you can see a command line prompt. Type 'sudo nano /etc/rc.local' to edit the file, and comment or delete the line containing the error. After that restart.

like image 21
user2536152 Avatar answered Oct 12 '22 02:10

user2536152