3

Hi I have configured my Raspberry Pi to run a Java program on startup, now when my program runs it causes an internal error, but that is not the big deal. My problem is I can't login to the system anymore, because it all stops before the login prompt.

How can i skip that?

5

One way of solving this is editing your cmdline.txt to avoid starting any of your services:

Insert your SD card into another PC. On your SD boot partition, edit the file cmdline.txt and append (in the same line):

init=/bin/bash

Save and insert again your sd card into your raspberry pi. When you power it, you will be logged as root, without starting any of your services. What we have done is skipping the execution of the init program which manages to start all the services.

Once you have disabled java, shutdown your raspberry pi by using:

poweroff -f

(You can't use shutdown because you don't have any init program running and shutdown will try to tell init to change the current runlevel to zero)

And finally, edit again your cmdline.txt file on another pc and restore it has before so you can start raspbian normally.

  • 1
    Thank you aleixrocks, this saved me. In case you are just as noob as me, these are the things I've learned: Use Notepad++ or other proper text editors, as Windows Notepad makes changes to the formatting. If you need to change a file, like rc.local add rw before init=/bin/bash – user2674577 Jan 10 '17 at 19:25
  • This approach doesn't seem to work on the latest version of Raspbian Stretch Lite, the file system is mounted as readonly. – James Jan 14 '19 at 14:46
  • James, probably you SD card partition is being mounted read only in your system by default. You can try to explicitly mount it as writable as shown here. – aleixrocks Jan 15 '19 at 15:40
1

I had a similar problem .... running a python script that would not let me end the program .... I did this:

downloaded puTTY to my Windows PC

found the IP address of the PI by using arp ... From the windows command line: 'arp -a'

looked for IP address with a MAC address that started with 'B8-27"

used that ip in the host name field in puTTY

got a login request, my PI used the default user pi and password raspberry

that got me a command prompt

then I used nano to edit the profile to remove the autorun of my script - 'sudo nano /etc/profile'

saved the file

rebooted - 'sudo reboot'

that fixed it

0

Another solution is making your program not-executable, you can do it via command chmod, simply typing chmod -x yourprogram should work and your program will not be an executable anymore, so it won't run at startup.

You can also type chmod 666 yourprogram or chmod 444 yourprogram or chmod 222 yourprogram, either of them would make your program not-executable with different permissions of read/write to different users, you can check this site for understanding them all : http://catcode.com/teachmod/

-1

Try pressing Alt + PrtScr + k

This should bring up the login prompt.

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.