3

I put the script "myscript.sh" with the following content into init.d:

#!/bin/bash
while :
do
    raspistill -v --width 1920 --height 1440 --quality 10 -t 1000 -o /home/pi/webcam/current.jpg
    sleep 3
    now=$(date +"%Y_%m_%d_-_%H_%M_%S")
    scp -i /home/pi/.ssh/id_rsa /home/pi/webcam/current.jpg user@1.2.3.4:/data/$now.jpg
    rm /home/pi/webcam/current.jpg
    sleep 10
done

I gave it execute permissions and also executed

sudo update-rc.d myscript defaults

and restarted the pi via sudo shutdown -r now.

Judging from the fact that I cannot ssh into the pi anymore (it's in a remote location), this was a mistake. How do I best fix it when I get there? Do I have to remove the memory card and manually change something, or is there a chance that the console is still reachable, just not via ssh? Depending on the answer, I would bring or not bring a monitor.

4

If I remember correctly, the operating system will not move beyond an init.d script until it has finished running. Essentially, your system is trying to launch its init.d script, but since this script never exists, your system never moves past it.

At this point you won't be able to log in via SSH or through the desktop. If you don't want to do a clean install on the SD card, your best bet would be to pull the card and edit the file system directly from another unix box.

Edit:

I just remembered that the Pi can be run under single user mode. If you edit cmdline.txt to include init=/bin/sh the Pi will boot up to a terminal prompt (with sudo privileges) and you will be able to edit the stuff locally.

Note: this skips all init processes so you won't have the ability to SSH in, and a monitor/keyboard will be required. This may or may not be more desirable than editing the whole thing from another computer, depending on your comfort level.

Source

  • Doesn't holding the shift button throughout the entire boot sequence accomplish the same? – Phil B. May 14 '15 at 16:59
  • @PhilB.: I'm not sure, and I don't have an RPi near by to verify. I believe that is a NOOBS specific feature, and I think it's also dependent on the version of NOOBS installed. – Jacobm001 May 14 '15 at 17:01
  • Did some reading on this - it won't help - shift will just ignore the /boot/config.txt settings (overclocking etc.), not the init.d steps. – Phil B. May 14 '15 at 17:24
  • Easiest way for me was to remove the SD card, mount it on Windows using Paragon ExtFS for Windows and remove the loop from the file. Then after restarting the Pi, I could remove it properly. – helm May 18 '15 at 13:11

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.