So, I was trying to set a Python script to start when the Raspberry Pi turns on (using Raspbian). That Python script includes a shutdown line.

So my Pi starts, successfully runs my script, then shuts down. ...so, I cant get "in" to the Pi.

Pressing CTRL X, Q, CTRL ALT Q or X doesn't stop the Python script. I also tried holding Shift on startup to see if I can get into safe mode, but it doesn't work...the script is still run.

How can I either update rc.local, or exit the Python script, so I can get to the desktop?

3 Answers 3


You could have changed the python script from another Linux computer. Just mount the SD card and edit the script.


I was able to get it by logging in via SSH connection and doing sudo nano /etc/RC.local and the quickly deleting the line that calls the .py, save and exit.

Fortunately I had a 25 second sleep timer before shutdown, otherwise I still don't know how I would have done it.

Edit: I don't yet consider this "the answer" since if I didn't set a sleep() for enough time to connect via SSH, I wouldn't know what to do.

  • And that is how Batman solves problems.
    – user46953
    Commented Jan 10, 2017 at 4:12

If you installed Raspbian via NOOBs you can access the NOOBs menue by holding the shift-key during start-up. In the menue, click on the edit config-button in the top of the window. Select the cmdline.txt-tab and add an s separated by a space to the end of the line. After exiting NOOBs, your Raspberry should boot into an emergency-terminal from which you'd be able to change any script.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.