pinkandwhitestripes
Posts: 17
Joined: Thu Jul 03, 2014 9:16 pm

deleting a file from autostart?

Sun Sep 07, 2014 11:53 pm

I did something REALLY stupid.
I wrote a script to shutdown my raspberry pi (on a button trigger), then put it in autostart. I was having trouble connecting things to the GPIO pins, so I moved past that part till I get pigtails... I put the script in autostart. Guess what?! IT WORKS :(
I've never been sad about those two words before.

So, how do I get it out of my autostart?

I'm running wheezy. It automatically logs in and goes to the gui... so ... any ideas?
Maybe I can access the autostart file from my mac?

User avatar
socialdefect
Posts: 110
Joined: Mon Jun 25, 2012 9:02 pm
Location: Tilburg, the Netherlands
Contact: Website

Re: deleting a file from autostart?

Mon Sep 08, 2014 12:16 am

On your Mac mount the boot (FAT32) partition, open cmdline.txt and add the following parameter

Code: Select all

init=/bin/sh
Save the file, unmount the disk and boot your Pi. The Pi should boot into an sh root shell instead of running init. From this shell you can edit/move/remove the script like this:

To remove the executable bit execute:

Code: Select all

chmod -x /home/username/.config/Autostart/myscript.sh
To move the script to a different folder:

Code: Select all

mv /home/username/.config/Autostart/myscript.sh /home/username/
To delete the script execute:

Code: Select all

rm /home/username/.config/Autostart/myscript.sh
When you're done power off the Pi and revert the changes in cmdline.txt and you should be good to go.
== If it's not broke... I'm not done fixing it! ==

pinkandwhitestripes
Posts: 17
Joined: Thu Jul 03, 2014 9:16 pm

Re: deleting a file from autostart?

Mon Sep 08, 2014 12:24 am

I did try this already, but let me try it again.
Do I add init=/bin/sh to the end of the cmdline.txt, or at any specific place?

User avatar
socialdefect
Posts: 110
Joined: Mon Jun 25, 2012 9:02 pm
Location: Tilburg, the Netherlands
Contact: Website

Re: deleting a file from autostart?

Mon Sep 08, 2014 12:46 am

Don't know what the rootwait option in the end is for so I would go with this: (your options might be different)
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 elevator=deadline root=/dev/mmcblk0p2 rootfstype=ext4 init=/bin/sh rootwait
(goes all in one line, no enters)
== If it's not broke... I'm not done fixing it! ==

pinkandwhitestripes
Posts: 17
Joined: Thu Jul 03, 2014 9:16 pm

Re: deleting a file from autostart?

Mon Sep 08, 2014 12:54 am

oh. it worked! I actually just entered sudo nano /path/autostart
and it let me take the file out.
Thank you!

User avatar
socialdefect
Posts: 110
Joined: Mon Jun 25, 2012 9:02 pm
Location: Tilburg, the Netherlands
Contact: Website

Re: deleting a file from autostart?

Mon Sep 08, 2014 4:04 am

Glad I could be of service..
== If it's not broke... I'm not done fixing it! ==

Return to “Beginners”