Hi,
Hope someone can help. I know just about enough to be dangerous now and think I have broken my pi.
I have created a bash script which runs continually (starting ffmpeg). I tried to put this to boot on startup using chkconfig at levels 3,4 and 5 but did not do it correctly and now when my pi boots up it just sticks on this script and does not complete the rest of the startup activities so I cannot get to a command line or SS in to do anything - namely stop the script running and correct my mistake.
I am using Debian Wheezy install which I don't think has a safe mode I can boot into.
Can anyone help at all as I am stuck. If not I suppose I will just have to use all the backup's I have made of all my hard work - unfortunately they are only backed up very poorly in my brain.
Thanks
Poor scripting stops my pi from booting
Barnaby Kent
http://www.pi-cars.com
Control your radio controlled car through your Raspberry Pi
http://www.pi-cars.com
Control your radio controlled car through your Raspberry Pi
Re: Poor scripting stops my pi from booting
I meant SSH of course...
Barnaby Kent
http://www.pi-cars.com
Control your radio controlled car through your Raspberry Pi
http://www.pi-cars.com
Control your radio controlled car through your Raspberry Pi
-
- Raspberry Pi Engineer & Forum Moderator
- Posts: 6433
- Joined: Wed Aug 17, 2011 7:41 pm
- Location: Cambridge
Re: Poor scripting stops my pi from booting
Safe mode will be available if you've run rpi-update in the last month or so.
You can also insert the sdcard in a windows machine and add
kernel=kernel_emergency.img
to config.txt.
Then you can boot on Pi, and mount /dev/mmcblk0p2 and remove your script.
Or you can do the same from a linux PC.
You can also insert the sdcard in a windows machine and add
kernel=kernel_emergency.img
to config.txt.
Then you can boot on Pi, and mount /dev/mmcblk0p2 and remove your script.
Or you can do the same from a linux PC.
Re: Poor scripting stops my pi from booting
Does debian have chkconfig?
Edit cmdline.txt on another machine and add "2" to boot in runlevel 2, or "single" for runlevel S.
(Or, if you have broken all runlevels, add "init=/bin/bash". But that will give you an empty /dev, so unless you happen to remember that mmcblk0 is block major 179, you may prefer the emergency initramfs.)
Edit cmdline.txt on another machine and add "2" to boot in runlevel 2, or "single" for runlevel S.
(Or, if you have broken all runlevels, add "init=/bin/bash". But that will give you an empty /dev, so unless you happen to remember that mmcblk0 is block major 179, you may prefer the emergency initramfs.)
Re: Poor scripting stops my pi from booting
Another option is to get another PC running Linux or OSX with an SD card reader. If you only have a Windows PC you can use a live CD (for example Ubuntu) to run Linux for just a few minutes.
On the PC, you can edit the contents of the SD card to undo the changes that caused the trouble in the first place.
This method doesn't work on a PC running Windows because Windows can't read the Linux file system.
You can use any Linux that you want. i recommend the Ubuntu live CD because
1. It automatically mounts and SD cards it finds, saving you a lot of trouble.
2. It is Debian in a fancy skin, so it works exactly like Raspbian.
On the PC, you can edit the contents of the SD card to undo the changes that caused the trouble in the first place.
This method doesn't work on a PC running Windows because Windows can't read the Linux file system.
You can use any Linux that you want. i recommend the Ubuntu live CD because
1. It automatically mounts and SD cards it finds, saving you a lot of trouble.
2. It is Debian in a fancy skin, so it works exactly like Raspbian.
Re: Poor scripting stops my pi from booting
Hi All,
Thanks for your help the option I went for in the end was:
- Put SD card into my windows laptop
- Browse to directory and open config.txt in Notepad++
- Add line kernel=kernel_emergency.img to the end of the config.txt file
- Put SD card back into RPi and boot
- This gave me a terminal I could do stuff on
- Made a rescue directory
- Mounted the directory /dev/mmcblk0p2 to the newly created rescue directory with the following command
- I could then browse into rescue directory and see my rpi filesystem
- I didn't actually want to get rid of my problematic script so went into each /etc/rcX.d directory and removed the link to my problematic script
- Unmounted my rescue directory (remember to browse to top directory - out of the rescue directory first
- Turn off pi
- put SD card back into laptop
- comment out the kernel=kernel_emergency.img line in config.txt (let's not remove I will probably need again
- Save config.txt and put SD card back into pi
- rebooted pi and....
- Hooray back to life
As I said thanks for your help
@jojopi re chkconfig I had to install it, when I tried to set my script using chkconfig I did only specify levels 3,4 and 5 but I guess errors in the script or something else (maybe I did not have the levels set in my bash script) seemed to add it to all levels
Thanks for your help the option I went for in the end was:
- Put SD card into my windows laptop
- Browse to directory and open config.txt in Notepad++
- Add line kernel=kernel_emergency.img to the end of the config.txt file
- Put SD card back into RPi and boot
- This gave me a terminal I could do stuff on
- Made a rescue directory
Code: Select all
mkdir rescue
Code: Select all
mount /dev/mmcblk0p2 /rescue
- I didn't actually want to get rid of my problematic script so went into each /etc/rcX.d directory and removed the link to my problematic script
- Unmounted my rescue directory (remember to browse to top directory - out of the rescue directory first
Code: Select all
umount rescue
- put SD card back into laptop
- comment out the kernel=kernel_emergency.img line in config.txt (let's not remove I will probably need again

- Save config.txt and put SD card back into pi
- rebooted pi and....
- Hooray back to life
As I said thanks for your help
@jojopi re chkconfig I had to install it, when I tried to set my script using chkconfig I did only specify levels 3,4 and 5 but I guess errors in the script or something else (maybe I did not have the levels set in my bash script) seemed to add it to all levels
Barnaby Kent
http://www.pi-cars.com
Control your radio controlled car through your Raspberry Pi
http://www.pi-cars.com
Control your radio controlled car through your Raspberry Pi
Re: Poor scripting stops my pi from booting
BPK
thanks for the clear instructions - saved me when a chmod went wrong and took X from /etc.
thanks for the clear instructions - saved me when a chmod went wrong and took X from /etc.
Re: Poor scripting stops my pi from booting
If someone wants to access Linux partition files from Windows, that can be done with one of the utilities found here: http://www.howtoforge.com/access-linux- ... om-windows
Re: Poor scripting stops my pi from booting
BPK,
This is excellent. I wrote a script that gets triggered on boot and required user input (just says OK and user has to knock off the dialog). The keyboard and mouse are not yet activated when this script runs (init.d + update-rc). I stayed awake all night brooding a raspbian rebuild and your post helped me recover from that situation. You rock!
Thanks,
Bala
This is excellent. I wrote a script that gets triggered on boot and required user input (just says OK and user has to knock off the dialog). The keyboard and mouse are not yet activated when this script runs (init.d + update-rc). I stayed awake all night brooding a raspbian rebuild and your post helped me recover from that situation. You rock!
Thanks,
Bala