Page 1 of 1

Stuck in infinite loop script at startup - please help

Posted: Wed Aug 13, 2014 5:50 pm
by jcteel
Hello,

I would greatly appreciate help. I created a script with an infinite loop and then copied it to /etc/init.d/superscript so it would always run at startup. I did this with the assumption that ctrl-x/c would stop it, but that assumption was invalid. Now I can't even get a command line prompt to try to fix the problem since the script starts up automatically and can't be stopped.

Also note I don't have another Linux machine, just a Windows PC. I read online that in this case I should access the SD card on my PC and add a cmdline.txt file (with init=/bin/bash) under the /boot directory. Although I can read the SD card on my PC and see various directories, I can't find a /boot directory or a /etc/init.d directory. I do see a recovery.cmdline file but that's the closest thing. Other places online mentioned a config.txt file but I don't see that either.

So how do I get a command line prompt?

Thanks!!
John

Re: Stuck in infinite loop script at startup - please help

Posted: Wed Aug 13, 2014 7:33 pm
by jcteel
Please note a couple more things I've tried:

1) Booted up in Safe mode (shorting GPIO 5/6) which brings up a command line prompt (Busybox kernal) and allows me to access the linux directory structure. However, for some reason, I can't see anything under the /etc/init.d/ directory even though that is where I put my script.

2) Entered Recovery Mode at startup (held Shift key down) which brings up the NOOBS menu. It shows that Rasbian is installed, but won't let me enter the config file. It only gave me the option to install other OS's, or to reinstall Rasbian.

3) While in Safe mode I also tried creating a config.txt and cmdline.txt files but wasn't sure where to place them since there was no /boot directory visible.

The next thing I plan to try is to install a Linux OS on a USB drive for my Windows PC to boot from. Hopefully, then I can use my PC to access the /etc/init.d/superscript file to delete it.

Thanks!
John

Re: Stuck in infinite loop script at startup - please help

Posted: Thu Aug 14, 2014 12:29 pm
by cpc464
I guess you just need to remove that "superscript" file to fix the problem. Not sure why Windows would show some files and not others. As you say, boot your PC into Linux and check it. A live CD might be slightly easier to do than the USB method.

Re: Stuck in infinite loop script at startup - please help

Posted: Thu Aug 14, 2014 12:41 pm
by DirkS
Not sure why Windows would show some files and not others.
Windows will only show the contents of the first FAT (or variations of that) partition on the SD card. It cannot show anything inside e.g. linux ext partitions, because it does not have the drivers for that,

Gr.
Dirk.

Re: Stuck in infinite loop script at startup - please help

Posted: Thu Aug 14, 2014 12:55 pm
by RaTTuS
either boot a wondows box with a live CD version of linux
or ssh in when the RPi boots [you can probably do that]

Re: Stuck in infinite loop script at startup - please help

Posted: Thu Aug 14, 2014 1:06 pm
by rpdom
It sounds like you have a NOOBS installation managing your OS booting and installs.

If you press the Shift key during boot you should get the NOOBS recovery screen which will provide an optio to edit the config and cmdline files for each installed OS. You can add the "bash" option there and then reboot to get a recovery prompt. You will probably need to mount /dev/mmcblk0p5 (or something similar) to get access to the file system, then you can remove your loop file or edit it so it does exit 0 near the beginning, then edit the cmdline file back to what it was and reboot.

Re: Stuck in infinite loop script at startup - please help

Posted: Thu Aug 14, 2014 4:23 pm
by cpc464
DirkS wrote:
Not sure why Windows would show some files and not others.
Windows will only show the contents of the first FAT (or variations of that) partition on the SD card. It cannot show anything inside e.g. linux ext partitions, because it does not have the drivers for that,

Gr.
Dirk.
I know windows cannot read ext. But the OP says he can browse some directories and not others, and seems to be talking about the main linux data. However on re-reading, I'm not sure what he can or can't see.

Re: Stuck in infinite loop script at startup - please help

Posted: Thu Aug 14, 2014 5:39 pm
by DirkS
I know windows cannot read ext. But the OP says he can browse some directories and not others, and seems to be talking about the main linux data. However on re-reading, I'm not sure what he can or can't see.
He is basically seeing a minimal linux install in memory used by Noobs recovery. It does not show the Raspbian linux filesystem, but as rpdom says, you can mount that if you know the name of the partition.

Gr.
Dirk.