Reputation: 1
so today i was trying to get a shell script(which is an infinite loop) to run on boot in the background of my RaspberryPi's terminal.
I used this command: update-rc.d -f GPIOServer.sh start 4 and then rebooted my pi and after a couple seconds it runs the infinite loop and doesn't boot to the terminal.
i don't know how to cancel the script: ive tried ^C ^Z ^X Esc and i dont want to have to erase all my files etc.
Please help.
Upvotes: 0
Views: 1411
Reputation: 251
There are several options to get a shell without completing the full boot process:
CTRL+ALT+F2
(or any other F2-12 key). This will only work if your init script is one of the last scripts to start.If you only have a mac or windows machine then you will only be able to edit the boot parition of the SD card. In this case you can modify/add the boot config file cmdline.txt
to boot straight into a root terminal. If there is already a cmdline.txt
file on the the sd-card then make a backup copy of this file and then simply add init=/bin/bash
after the root
kernel parameter.
For example, the full line might look something like this:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p3 init=/bin/bash rootfstype=ext4 elevator=deadline rootwait
If there is no cmdline.txt
file on the sd-card then create a new empty text file and just put init=/bin/bash
into that file. Your raspberry pi will now boot straight into a root terminal.
Upvotes: 1
Reputation: 6729
Assuming you are not logging in as root. You can try to log in as root and disable the infinite loop for your user's shell.
Upvotes: 0