NAS - WD My Cloud

This is a simple guide to get syncthing to startup as a service and run at boot:

Must be on firmware < 4.00 http://www.scramworks.net/hacking-mycloud.html#mc1

Downgrading your Cloud

I’ve only tested this with 4.00.00-607 (7/2014) firmware, they may lock the device down even further with subsequent updates.

Turn off automatic updates, otherwise all your hardwork will be for nothing.

I found the “how To” for downgrading on the WD supportforums but just incase that vanishes I’ll repeat JoaquinAR’s instrustions here.

Get the latest 3.X version of the firmware from: http://download.wdc.com/nas/sq-030401-230-20140415.deb.zip (Cached copy Here - in case WD decide to remove it from their site.)

“You’d have to edit the file /usr/local/sbin/updateFirmwareFromFile.sh commenting out the lines 256 through 259 since it won’t allow you to apply any version lower than the existing one:”

Using a terminal or putty SSH to drive then

nano /usr/local/sbin/updateFirmwareFromFile.sh

# if [ -z "${update_container}" ] && [ "${vnew}" -lt "${vnow}" ]; then 
# error="failed 200 \"invalid firmware package\"" 
# pre-update_error $error 
# fi

You can now install the downgrade from the web interface.

Step 1: I created a share on the My Cloud Shares called Tools You can set this up via the web page UI. Navigate in the browser to the WD’s ip address. Enable SSH in settings

Step 2: First you need to have the ARM7 binary file saved on the WD Drive. Download file https://github.com/syncthing/syncthing/releases Extract the file twice (I used 7zip) you are looking for the file named syncthing I saved the file to /shares/Tools/ (copy to folder via windows)

Step 3: Using putty SSH login to WD user: root password: welc0me

Step 4: cd /shares/Tools chmod +x sycthing ./syncthing

Step 5: ./syncthing Wait for Syncthing to setup.

After it has setup you will need to ctrl + c to kill the process

cd /root/.config/syncthing

Step 6: nano config.xml

Modify the config file

gui enabled="true" tls="false"
        address 192.168.1.25:8080  address

Or what ever IP you are using to connect to the WD UI. I have set my device up to be a static IP at 192.168.1.25

Step 7: Press Ctrl + x Y to save And Enter to save the file as named

Step 8: You will need to move the file to the /usr/local/bin mv /shares/Tools/syncthing /etc/usr/local/bin

Step 9: nano /etc/init.d/syncthing

Step 10: Paste this script into the file :

https://forum.syncthing.net/t/keeping-syncthing-running-systemd-regular-etc-init-d/402
#!/bin/sh
### BEGIN INIT INFO
# Provides: syncthing
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Multi-user daemonized version of syncthing.
# Description: Starts the syncthing daemon for all registered users.
### END INIT INFO

# Replace with users you want to run syncthing clients for
syncthing_USERS=""
DAEMON=/usr/local/bin/syncthing

startd() {
  for stuser in $syncthing_USERS; do
    HOMEDIR=$(getent passwd $stuser | awk -F: '{print $6}')
    if [ -f $config ]; then
      echo "Starting syncthiing for $stuser"
      start-stop-daemon -b -o -c $stuser -S -u $stuser -x $DAEMON
    else
      echo "Couldn't start syncthing for $stuser (no $config found)"
    fi
  done
}

stopd() {
  for stuser in $syncthing_USERS; do
    dbpid=$(pgrep -fu $stuser $DAEMON)
    if [ ! -z "$dbpid" ]; then
      echo "Stopping syncthing for $stuser"
      start-stop-daemon -o -c $stuser -K -u $stuser -x $DAEMON
    fi
  done
}

status() {
  for stuser in $syncthing_USERS; do
    dbpid=$(pgrep -fu $stuser $DAEMON)
    if [ -z "$dbpid" ]; then
      echo "syncthing for USER $stuser: not running."
    else
      echo "syncthing for USER $stuser: running (pid $dbpid)"
    fi
  done
}

case "$1" in
  start) startd
    ;;
  stop) stopd
    ;;
  restart|reload|force-reload) stopd && startd
    ;;
  status) status
    ;;
  *) echo "Usage: /etc/init.d/syncthing {start|stop|reload|force-reload|restart|status}"
     exit 1
   ;;
esac

exit 0

Step 11: ctrl + x – to exit y – to save enter – confirm file name

Step 12: nano /etc/init.d/mystartup.sh

Step 13: Copy and paste like before in the previous step

#! /bin/sh
# /etc/init.d/mystartup.sh
#
 
syncthing restart &
 
exit 0

Step 13: ctrl + x – to exit y – to save enter – confirm file name

Step 14: sudo chmod 755 /etc/init.d/mystartup.sh

Step 15: sudo chmod 755 /etc/init.d/syncthing

Step 16: sudo update-rc.d mystartup.sh defaults

Step 17: I like to use reboot command in terminal, but it has caused a few issues. The better way is to reboot the device via the WD UI.

3 Likes