Here comes a new challenge ! … Device has been updated by Western Digital !
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"}]}