INSTALL ENTWARE ON WD MY CLOUD HOME (SSH ACCESS, NFS SERVER, OPKG install packages)

Thanks for the debian boot info and translation link. I did look into the possibility some time ago, and tried unsuccessfully to persuade the firmware to boot a Linux kernel. I decided it would have to be built specially for the hardware and on balance that it wasn’t worth the pain when the Android OS is so fast working in the small memory on this device just serving files. So, that’s what I use it for and it really is an excellent NAS when hacked in this way. What a shame WD tried to turn it into something else.

The MCH out of the box is useless without network connectivity to the WD cloud and this is why they have put the ping test in there. The assumption is that unless it can reach the cloud it is only as good to the customer as a brick would be. What we want from it is the exact opposite, of course.

Well done on your analysis of the scripts, Romain. There’s plenty there to keep you busy, eh? Good luck.

Here’s my hosts file.

`--# cat /etc/hosts
127.0.0.1       localhost
127.0.0.1       staging.mycloud.com
::1             ip6-localhost
1 Like

Raaaaaaaa!
do I have to unbox the HDD to be able to mount the / in write mode ?

~ # /system/bin/mount -o rw,remount /
~ # vi /etc/hosts
...
~ # touch /etc/test
touch: /etc/test: Read-only file system

@RomainBagdam. Hahaha… have you torn all your hair out yet? This will help…

# touch /etc/test
touch: /etc/test: Read-only file system
# /system/bin/mount -o rw,remount /
# touch /etc/test                  
touch: /etc/test: Read-only file system
# /system/bin/mount -o rw,remount /system
# touch /etc/test                        
# rm /etc/test
#

LooooL

Symbolic link killed my brain… etc → /system/etc

# ls -la / | grep etc
lrwxrwxrwx    1 root     root            11 Jan  1  2014 etc -> /system/etc

thanks, this is done.

Here comes a new challenge ! … Device has been updated by Western Digital ! :frowning:

So, forced to use adb, again, reinstall busybox good version, the ssh server, samba, modify the sambstart script, the /etc/hosts, and ok,
opefully samba config are in /data folder and western digital did not cleaned this folder (with all my personal data…)

opportunity to correct the custom samba script as the last command ‘getprop’ without full path was not working…

and … this time I configured the iptables (but it would be better for security reasons to let both WD updates possibles and automatic tunning).

Opefully also I did not had to open the device again to enable debug with Android ADB tool :-o

So…
From Windows PC… donwload adb.zip and unpack, jump in folder, command line cmd…

c:\adb connect 192.168.0.xx
* daemon not running; starting now at tcp:5037
* daemon started successfully
connected to 192.168.0.**:5555
c:\adb root
c:\adb shell
root@monarch32_mini:/ #
cd /root
/system/bin/mount -o rw,remount /
mkdir /opt
/system/bin/mount -o ro,remount /

No neet to reinstall entware in /data…

mount -o bind /data/entware.arm /opt
/system/bin/mount -o rw,remount /system
exit

Push the busibox package to the drive from windows
https://busybox.net/downloads/binaries/1.28.1-defconfig-multiarch/busybox-armv7l
And save it as “busybox” to c:\ or d:\ to copy it (d:\ in my case)

adb push d:/busybox /system/bin
d:/busybox: 1 file pushed. 3.1 MB/s (1079156 bytes in 0.333s)

Go back to the device shell

adb shell
/system/bin/busybox --install /system/bin
/system/bin/mount -o rw,remount /
/system/bin/mount -o rw,remount /system
/system/bin/busybox --install /system/bin
unset LD_LIBRARY_PATH
unset LD_PRELOAD
/opt/bin/opkg install dropbear
Package dropbear (2019.78-2a) installed in root is up to date.
/opt/sbin/dropbear -p 22 -a
/system/bin/mount -o ro,remount /system
/system/bin/mount -o ro,remount /
exit

Now use putty to go with ssh… root and go again (root password was the allready configured one… great, this step to forget…)

/opt/bin/opkg install nano
/opt/bin/opkg install openssh-sftp-server
/opt/bin/opkg install samba36-server
/system/bin/mount -o rw,remount /system
vi /etc/hosts

insert (ESC, I) the

127.0.0.1       staging.mycloud.com

after

127.0.0.1       localhost

and before

::1             ip6-localhost

exit with save (Esc, wq, return)
back to the shell… backup old samba script and replace with new one that also start ssh.

cp /system/bin/start_samba.sh /system/bin/start_samba.ori
vi /system/bin/start_samba.sh

“dd” to remove lines, “I” to insert, righ clic to paste, and “:wq” to save

#! /system/bin/sh

if mount | grep /data/entware.arm > /dev/null; then
  echo "entware already mounted."
else
  unset LD_PRELOAD
  unset LD_LIBRARY_PATH
  sleep 3
  /system/bin/mount -o rw,remount /
  sleep 1
  /system/bin/mkdir /opt
  /system/bin/mount -o ro,remount /
  sleep 3
  /system/bin/mount -o bind /data/entware.arm /opt
  sleep 2
  /opt/etc/init.d/rc.unslung start
  sleep 2
fi

function start_samba()
{

    #Start smbd with fail-retry once
    count="0"
    while [ $count -le 1 ]
    do
        smbd_pid=`ps | grep smbd | busybox awk '{print $2}'`
        if [ -z "$smbd_pid" ]; then
            echo "starting smbd daemon"
            rm -f /data/wd/samba/var/run/samba/smbd.pid
            /opt/sbin/dropbear -p 22 -a
            /opt/sbin/smbd -D
        else
            echo "smbd_pid is $smbd_pid"
            break
        fi
       count=$((count+1))
    done

}

PLATFORM=`/system/bin/getprop ro.hardware`
if [ "$PLATFORM" != "yoda" ]
then
        start_samba
fi

let’s launch it…

/system/bin/start_samba.sh

Everithing is back on the network yeepe…

just dont forget to configure iptables this time…

   /system/bin/iptables -A OUTPUT -p tcp --dport 8443 -j DROP
   /system/bin/iptables -A OUTPUT -p tcp --dport 443 -j DROP

inspect logs…

tail -f /data/logs/*

Ok, device check every minutes internet connection, sucess (thanks to custom /etc/hosts), and fail to speak with mycloud servers: ok ! (and do not REBOOT !)

==> /data/logs/main.log <==
2020-04-22T11:47:23.375Z  2742  6637 I ConnectivityService: checking ethernet link
2020-04-22T11:47:23.376Z  2742  6637 I ConnectivityService: checking gateway
2020-04-22T11:47:23.376Z  2742  6637 I ConnectivityService: ping gateway 192.168.#.#, count 0
2020-04-22T11:47:23.401Z  2742  6637 I ConnectivityService: ping staging.mycloud.com, count 0
2020-04-22T11:47:23.427Z  2742  6637 I ConnectivityService: diagnosisNet success.

==> /data/logs/wdlog.log <==
2020-04-22T11:47:05.523Z  2495  2687 E restsdk : 
{"corid":"rmo:r3vWsMZ_DaFDGpcVjK5-","file":"monitor.go","fn":"Error","gitTime":1585256305,
"githash":"7cfda35","importPath":"vendor/stash.wdmv.wdc.com/midy/goshared
/stat","line":686,"msgid":"error","trace":[{"message":"Put https://device.mycloud.com/
device/v1/device/dfe19983-99cb-***********-f0a5f203fda7: net/http: request canceled 
while waiting for connection (Client.Timeout exceeded while awaiting headers)"},
{"importPath":"vendor/stash.wdmv.wdc.com/midy/goshared/clients/device","file":
"device.go","fn":"(*Client).Update","line":628},{"importPath":"internal/cloud/device",
"file":"device.go","fn":"(*Service).UpdateNetwork","line":191},
{"importPath":"internal/api","file":"api.go","fn":"
(*API).cloudConnectMgr.func1","line":14603,"message":"192.168.0.** 0.0.0.0 0 80 443"},
{"importPath":"internal/api","file":"api.go","fn":"(*API).cloudConnectMgr","line":14757,"message":"8 false false"}]}

Have you managed to solve this problem with finding the boot drive?

Yes, MCH Duo has a flash memory on board.
HDDs are easly extracted from the case, but there arent any boot partition on them. All I see are SWAP and DATA partitions.

This is from the logs/restsdk-server_err.log:

Failed to load config file "/sdcard/.rclone.conf" - using defaults: open /sdcard/.rclone.conf: no such file or directory

Below is the board of MCH Duo. On the right hand side is the Flash memory chip (moviNAND). So there is no way to hack the boot partition for Duo as I understand this.

Above it is the UART connector. Maybe try that next.

Great!

In addition to the Flash soldered to the MoBo, MCH Duo seems to put some encryption on the disks.

Maybe there is a way to get a console, or boot an alternative rom/OS via USB.

Its sad that having a relatively capable hardware (similar to Synology ds218j/ds220j) WD limit its potential with an unusable OS…

After modifying the script “netatalk_daemon.sh” the system has become unstable. The MyCloud system does not start, the ssh is cut periodically, and the transmission does not work correctly.
I don’t have a copy of the file “netatalk_daemon.sh”. Can we pass me the original content of the file “netatalk_daemon.sh”?
What I need is to reverse the changes

@davidddp here is the original netatalk_daemon.sh

#! /system/bin/sh

function start_netatalk()
{
    rm -rf /data/wd/netatalk/netatalk.lock
    if [ ! -d /data/wd/netatalk ]
    then
            mkdir -p /data/wd/netatalk/etc/netatalk
            mkdir -p /data/wd/netatalk/lib/netatalk
            mkdir -p /data/wd/netatalk/var/log
            mkdir -p /data/wd/netatalk/var/netatalk
            mkdir -p /data/wd/netatalk/sbin

            cp /system/etc/netatalk/extmap.conf /data/wd/netatalk/etc/
            cp /system/bin/afpd /data/wd/netatalk/sbin/
            cp /system/bin/cnid_dbd /data/wd/netatalk/sbin/
            cp /system/bin/cnid_metad /data/wd/netatalk/sbin/
    fi

    if [ ! -d /data/wd/diskVolume0/backups ]
    then
            mkdir -p /data/wd/diskVolume0/backups/timemachine
            mkdir -p /data/wd/diskVolume0/backups/.systemfile/netatalk/CNID
    fi

    netatalk -d -F /system/etc/netatalk/afp.conf
}

What you could also do is to let the modified netatalk script but forbid your device to do a network reboot by

  1. modifying the network reply for western digital server name (update the /etc/hosts)
  2. forbid network communication to https (add iptables)

1:
vi /etc/hosts

   127.0.0.1       localhost
   127.0.0.1       staging.mycloud.com
   ::1             ip6-localhost

2:

/system/bin/iptables -A OUTPUT -p tcp --dport 8443 -j DROP
/system/bin/iptables -A OUTPUT -p tcp --dport 443 -j DROP

This should help to have a clean setup.
otherwise you try 2nd solution to update only the samba start script (but you must also do this network config, see my last post)

But with this setup, could I still use MyCloud and Plex?
I want to continue using MyCloud and Plex. And a Samba server for Plex directories.

With the modified netatalk I cannot access MyCloud.

Thanks

You Shall definitively read my Last post :
No, you can’t because if you don’t cut MyCloud (with current iptables) then the device will automatically update oneday, as it happened to me last week (that is good for security but not for tunning…), you loose all your custom software / config not intalled under /data (samba is part of).

I don’t know for Plex, sorry.

That’s current status on this post / threads.

Then you can try new modifications !
(and add your discoveries here :))

ideas: I’m sure we could create iptables more detailed to block only automatic update, or find the script responsible for updates verifications, but as of today in this forum post you will not find it.

What would be also nice is to enable the samba server embedded in the device, not installing the entware version, only modify the samba config files that are in

 /data/data/com.wdc.mycloud.samba/files

see what happen… therefore whatever the system get updated by western digital, at minimum you may have to “enable” only the samba server… or not, it could be automatically loaded if the config files are modified

in fact script verify if directory

/data/data/com.wdc.mycloud.samba

exist… what is the case… and then inside you have the samba config files

/data/data/com.wdc.mycloud.samba/files
/data/data/com.wdc.mycloud.samba/files # ls -a
.          ..         nmbd       smb.conf   smbd       smbpasswd

and then copy those files in

/data/wd/samba/bin/smbd

But if you don’t modify the startup script you will have device netbios network name "MyCloud-… (script analysis)

But me I did not found how to do it and not tried to only modify the wd samba default files (look at the /system/bin/start_samba… you will see where / from where WD reload te config files, and play with that)

Hope this will help you.

1 Like

And Again ! device has been updated by WD…

This time I tried to update only the samba files, using adb… to let a chance to the device to launch itself samba daemons but with my configfiles… copying the custom samba (entware custom) files and daemon to the good folder for the WD samba script…

cp /data/entware.arm/etc/samba/smb.conf /data/data/com.wdc.mycloud.samba/files/
cp /data/entware.arm/etc/samba/smbpasswd /data/data/com.wdc.mycloud.samba/files/
cp /data/entware.arm/sbin/nmbd /data/data/com.wdc.mycloud.samba/files/
cp /data/entware.arm/sbin/nmbd /data/data/com.wdc.mycloud.samba/files/

but samba_start don’t start samba & nmbd daemons @Kryten, you may have an idea?
I copied all files (the 2 config files and the daemons… but start script error, it can’t start the daemons… )

root@monarch32_mini:/data/wd/samba/bin # /system/bin/start_samba.sh
smbd_pid is 3307
3314
3315
3323
5035
starting nmbd daemon with debug level 1
/system/bin/start_samba.sh: /data/wd/samba/bin/nmbd: No such file or directory
starting nmbd daemon with debug level 1
/system/bin/start_samba.sh: /data/wd/samba/bin/nmbd: No such file or directory

but…

root@monarch32_mini:/data/wd/samba/bin # ls -la
-rwxrwxrw- root     root      2598344 2020-05-02 17:04 nmbd
-rwxrwxrw- root     root     17030280 2020-05-02 16:57 smbd

So, I’ll take the risk, I’ll use your netatalk script :smiley: (with of course modification of hosts file and iptables

Edit:
FAILED.
even if I add

if mount | grep /data/entware.arm > /dev/null; then   
echo "entware already mounted."
else
  unset LD_PRELOAD
  unset LD_LIBRARY_PATH
  sleep 3
  /system/bin/mount -o rw,remount /
  sleep 1
  /system/bin/mkdir /opt
  /system/bin/mount -o ro,remount /
  sleep 3
  /system/bin/mount -o bind /data/entware.arm /opt
  sleep 2
  /opt/etc/init.d/rc.unslung start
  sleep 2
fi

instead of
entware.sh start

in your script… restart every 2 min :frowning:

lastedit, 4h later:
seems iptables not working, seems not loaded in kernel,
iptables -L list the blocked ports, I even tried to add arround 10 ip adress of amazon… still connected.

netstat -at

listing connections to amazon on port 433 or 8433
I also reinstalled it from opkg… nothing changed…

NEW EDIT ! LAST !
Finally I found a stable solution,
I stoped some of the services that was removed in the netatalk custom script,
and especially rest-sdk-server, need to confirm that this one stopped the device

Now the samba script looks like (and it’s worksing so far)

#! /system/bin/sh
if mount | grep /data/entware.arm > /dev/null; then
echo "entware already mounted."
else
  unset LD_PRELOAD
  unset LD_LIBRARY_PATH
  sleep 3
  /system/bin/mount -o rw,remount /
  sleep 1
  /system/bin/mkdir /opt
  /system/bin/mount -o ro,remount /
  sleep 3
  /system/bin/mount -o bind /data/entware.arm /opt
  sleep 2
  /opt/etc/init.d/rc.unslung start
  sleep 2
fi

// custom iptables to forbid (if it listen to those rules the device to communicate to https and proxyhttps), shall prevent device to go online, take updates, etc (do not work in all cases)

/system/bin/iptables -A OUTPUT -p tcp --dport 8443 -j REJECT
/system/bin/iptables -A OUTPUT -p tcp --dport 443 -j REJECT
   
// stop some services, that will prevent again the device to contact Western Digital servers and auto update.
/system/bin/stop avahi
/system/bin/stop otaclient
/system/bin/stop restsdk-server
/system/bin/stop media

// here is the mail start samba script, that also include the start of ssh, in case the loading of entware scripts failed, it will be started here
function start_samba()
{

    #Start smbd with fail-retry once
    count="0"
    while [ $count -le 1 ]
    do
        smbd_pid=`ps | grep smbd | busybox awk '{print $2}'`
        if [ -z "$smbd_pid" ]; then
            echo "starting smbd daemon"
            rm -f /data/wd/samba/var/run/samba/smbd.pid
            /opt/sbin/dropbear -p 22 -a
            /opt/sbin/smbd -D
        else
            echo "smbd_pid is $smbd_pid"
            break
        fi
       count=$((count+1))
    done

}

PLATFORM=`/system/bin/getprop ro.hardware`
if [ "$PLATFORM" != "yoda" ]
then
        start_samba
fi

With UART connector you get a direct Linux shell access from which you can install Busybox and Entware. Original WD’s Busybox also has a wget command so you can install everything without using adb, so you can skip that part of hacking.

/system/bin/busybox

Then install dropbear, samba …

Hello i stuck on the same place with Can’t sée system partition

Somebody help me

How to make it show the system partition on partition tree using lsblk .i got this


I stuck here and need help please .

It must be one of the 800M ones which are not mounted. you can try mounting all three of them. one of it should be the system.

For anyone starting new, easier way is to use the guide in Install Debian on WD My Cloud home - #20 by ahmedespo
But instead of using the debian package, use the rescue package from Index of /wd/Cloud_Home/Rescue_usb/
This will open a telnet session without a password. You should be able to mount and make the updates without pulling the harddisk.

  1. Turn off your MCH device and remove the power cord.
  2. Plug the USB containing the extracted files from wd-mycloud-home-debian.7z (link in the first post) in the MCH port.
  3. While holding the Reset button, plug in the power cord. (Don’t release the reset button, yet)
  4. The MCH light indicator will rapidly flash and than it will dim to a steady light. (This might take around 20 seconds maybe)
  5. Now you can release the reset button.

The process might take 3 to 5 minutes. The device will reboot after installation.
Don’t remove the USB until your device is discoverable on the network under “wdnas”.

1 Like

Hello,

Thanks to method mentioned by Cloudhome, I found MCH IP on router, connected by ftp://ip address, changed build.prop, removed disable_adb, created enable_root… and now what?
Where do I have to put unzipped ADB? On windows pc c:? or on MCH?
Where i have to type these commands?

adb connect 192.168.0.5
adb root
adb shell

are these telnet commands? (unfortunately, I can;t enable any windows feature in control panel/programs including telnet)

Is there maybe easier solution o make this brick working with SAMBA and transmission?

Hi @Aresso yes you need to unzip adb in windows, where you want as soon as you can do a command line cmd from this location, then when you are in the same folder as extracted adb you can launch the different commands.

it will connect using the adb sofware that is a kind of telnet, yes, in a sense, it is more like a rpc software dedicated to android systems management… just launch the commands.

I would recomend you either to apply my last complete install post
reply 126
with also last samba script modification
reply 134
because it is stable since now more than 3 months…

option 2, look here to have a completely different NAS software, a real Debian NAS… until you get too much data on it do decide to switch from crappy Western digital android system to a real linux one, using a usb key
post 250061

Hi @RomainBagdam thanks for the tips, I made backup of data on mch, before I started to “upgrade” it.
Which option is easier? better? - more user friendly?

easier? installing entware and getting access to android system
better? depends on usage. If using Plex, stick with android as it supports hw transcoding. If you want a traditional linux experience, install debian.
more user friendly? definitely debian