user3234025
user3234025

Reputation: 1

RPI Not Booting because of infinite shell script

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

Answers (2)

hogliux
hogliux

Reputation: 251

There are several options to get a shell without completing the full boot process:

  1. Try switching to a different console for example with 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.
  2. If the ssh server started before your script then you will be able to connect remotely from another computer
  3. Follow Ignacio's recommendation: by taking out the SD card and mounting the SD card on another linux computer and deleting your init script
  4. 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

Ashoka Lella
Ashoka Lella

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

Related Questions