1

I edited the /etc/rc.local to run a python script. It works, but it never ends, I tried Ctrl+c but it does not work I can't get in to the log in / password display.

  • That would be because you forgot the trailing & to run the python script in the background whilst the rest of the /etc/rc.local was run and then exited wouldn't it? 8-) Most of the answers that I can see below seem to think that /etc/rc.local has finished (so that then the RPi proceeds to complete multi-user start-up) - but you need to avoid rc.local from being run... – SlySven Mar 18 '16 at 18:50
1

Try ctrl+alt+f1 to get a console window (ctrl+alt+f7 to return).

You can login and edit/kill the script and reboot.

Search for password recovery.

Alternatively edit cmdline.txt (it's on a FAT partition so is visible on a Windows machine) and add init=/bin/sh to the end of the (single) line. Reboot and edit rc.local then undo the change to cmdline.txt and reboot again.

  • it doen´t work, ctrl+alt+f4 f5 f6 turns black the screen with ctrl+alt+f1 im returning to the script – Wilty Jun 26 '15 at 19:03
  • @Wilty Added an aleternative to post. – joan Jun 26 '15 at 19:21
  • Also, once you get to a regular state again, make sure the last line in /etc/rc.local is exit 0. – PiEnthusiast Jun 26 '15 at 19:48
  • i also try with the cmdline stuff with the recover because, i didnt see the cmdline.txt on windows :S – Wilty Jun 26 '15 at 20:08
  • @Wilty If you are using NOOBS you'll need to google a bit more. I don't know what to do when using NOOBS. – joan Jun 26 '15 at 20:32
1

If all fails:

a) If you are using NOOBS hold shift at startup and you can restore

b) Plug the card into an alternate computer, pull off the files you want, and wipe/reinstall

1

When booting to CLI, alt+print+k seems to work. This kills all processes running in the current terminal, from what i read. You get to the CLI then, and can modify rc.local.

  • 1
    You mean the magic sys-req key? – SlySven Mar 18 '16 at 18:56
  • Thanks for the link for background info =) Didn't know this key combination is part of a whole set oO – Bastian35022 Mar 21 '16 at 15:20
0

try putting a background process in rc.local

!/usr/bin/sh
runMyScript() {
    python PATH/TO/SCRIPT/script.py &
}
runMyScript

Next time you reboot your Pi you will get your login again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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