jcteel
Posts: 2
Joined: Wed Aug 13, 2014 5:39 pm

Stuck in infinite loop script at startup - please help

Wed Aug 13, 2014 5:50 pm

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

jcteel
Posts: 2
Joined: Wed Aug 13, 2014 5:39 pm

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

Wed Aug 13, 2014 7:33 pm

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

cpc464
Posts: 239
Joined: Tue Jul 08, 2014 5:10 pm
Contact: Website

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

Thu Aug 14, 2014 12:29 pm

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.
Unix engineer since 1989

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

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

Thu Aug 14, 2014 12:41 pm

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.

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

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

Thu Aug 14, 2014 12:55 pm

either boot a wondows box with a live CD version of linux
or ssh in when the RPi boots [you can probably do that]
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
rpdom
Posts: 17170
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

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

Thu Aug 14, 2014 1:06 pm

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.

cpc464
Posts: 239
Joined: Tue Jul 08, 2014 5:10 pm
Contact: Website

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

Thu Aug 14, 2014 4:23 pm

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.
Unix engineer since 1989

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

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

Thu Aug 14, 2014 5:39 pm

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.

Return to “Troubleshooting”