WD MyCloud Gen2 Chroot (+ Transmission and Minidlna)

Warning: WDMyCloud and WDMyCloud Gen2 - have different hardware and firmware

  • Gen1: fw v03.x.x.x and v04.x.x.x (Comcerto C2000 CPU, 256MB RAM)
  • Gen2: fw GLCR_v2.x.x (Marvell Armada 375 CPU, 512MB RAM)

Chroot, firmwares, info and more:

Chroot Installation:

  1. Enable APP install tab: Howto enable “App install” option
  2. Install “ChrootedDebian” app

Thats all!

Notes:

  • Your “Public” folder inside chroot mounted as /mnt/shares/Public
  • Login/Password for Transmission GUI: transmission / password (Please, change it!)
  • For go inside chroot, run this: chroot /mnt/HD/HD_a2/chroot /bin/bash
12 Likes

Hi, thank you very much for sharing this information, hopefully will be useful for any user that is planning on installing this on a My Cloud Gen 2.

:grinning:

Wow. It’s wonderful!

Thank you thank you thank you!!! Works a treat :slightly_smiling:

Hello,

Thank you very much, working great here!
Could you please you guide us how to enable watch-dir?

Thanks in advance

Any way to implement autostart on boot? I noticed that systemd or rc.d cannot be used :frowning:

I dont have this device, so cant experement with that.

Any idea why the the transmission becomes unavailable after some time?
chroot seems to run but transmission page cannot be accessed.
After rebooting mycloud and starting chroot everything works fine.

tried adding a crontab to start the script on reboot, but after reboot the crontab entry disappear! I think it has something to do with the way its stored to tmpfs or something, but the WD entries in crontab remains after reboot. Not sure what’s going on

Almost all OS placed in RamDisk. Need modify this ramdisk or search where bootscript switch to hdd (What scripts loaded from HDD)

these are the mount points on my gen 2 mycloud. I’m not even sure what type of an init system this thing is using to start up WD processes on boot!

proc on /proc type proc (rw)
/dev/ram0 on / type ext2 (rw)
sysfs on /sys type sysfs (defaults)
mdev on /dev type tmpfs (defaults)
proc on /proc type proc (0)
cgroup on /sys/fs/cgroup type cgroup (rw,memory,cpu)
/dev/sda3 on /boot type ext4 (rw)
/dev/sda7 on /usr/local/config type ext4 (rw)
/dev/loop0 on /usr/local/modules type squashfs (loop)
tmpfs on /mnt type tmpfs (size=1m,nr_inodes=0)
tmpfs on /var/log type tmpfs (size=40m,nr_inodes=0)
tmpfs on /tmp type tmpfs (size=100m,nr_inodes=20000)
/dev/sda4 on /mnt/HD_a4 type ext4 (rw)
/dev/sda2 on /mnt/HD/HD_a2 type ext4 (rw,noatime,nodiratime,barrier=0,usrquota,grpquota,init_itable=10)
nfsd on /proc/fs/nfsd type nfsd (rw)

also

root@WDMyCloud /dev # df -h
Filesystem Size Used Available Use% Mounted on
%root% 54.2M 33.7M 17.7M 66% /
/dev/ram0 54.2M 33.7M 17.7M 66% /
mdev 251.2M 32.0K 251.2M 0% /dev
/dev/sda3 976.1M 207.2M 742.9M 22% /boot
/dev/sda7 976.1M 1.6M 948.4M 0% /usr/local/config
/dev/loop0 99.8M 99.8M 0 100% /usr/local/modules
tmpfs 1.0M 0 1.0M 0% /mnt
tmpfs 40.0M 6.9M 33.1M 17% /var/log
tmpfs 100.0M 1.7M 98.3M 2% /tmp
/dev/sda4 928.9M 2.5M 910.4M 0% /mnt/HD_a4
/dev/sda2 2.7T 16.6G 2.6T 1% /mnt/HD/HD_a2

looks like WD took advantage of the increased RAM and put a lot of stuff on ramdisk. No clue as of yet how to change how scripts are loaded from hdd on boot

Guys, any idea why my transmission works every time only for few minutes? Then the remote connection hangs until I restart the service. I tried changing the 51413 port to different one. It didn’t help. Sometimes it gets stuck sooner, sometimes later.

Thanks in advance

@Dennis3001

turn off drive sleep and see if it helps.

@bob

Thanks for the suggestion. I have already tried that without success :frowning:
Sometimes transmission hangs just couple of minutes after starting :frowning:

I enabled logging see this error appearing many times:
[2016-02-23 11:53:23.096 UTC] tr_crypto error:24064064:lib(36):func(100):reason(100) (crypto.c:111)

Couple of minutes after this error starts appearing, transmission always hangs

Also, when starting the transmission there is this error:
“Failed to acquire random data”

Any ideas?

I finally found a solution! Or a workaround.
When I run the 2 line below before starting the Transmission everything works fine:

chmod 664 /dev/random
chmod 775 /dev/urandom

1 Like

Just to add a solution for anyone that wants to autostart a script or executable (you can do this to start the chrooted env automatically on boot and do whatever you want):

Gen 2 MyCloud uses a ramdisk AND crfs (squashfs), which basically means every reboot you will lose any changes you make. Long way to get around this is to get on a linux vm, download the GPL source for this device (FW 2.XX), extract, go to firmware/module folder and inside you’ll see a folder called crfs. This is the folder that makes the image.cfs which is mounted as squashfs (loop device) to /usr/local/modules on boot every time.

What you need to do is get inside the crfs folder here, go to script folder, and edit the system_init file. Add a line at the bottom pointing to whatever script or executable you want to run at boot. Save, go back to the “module” folder and run the create_image script. It should make a new my-image.cfs file, rename that to image.cfs and finally overwrite the image.cfs in the /boot/boot partition of your mycloud.

Make a backup of that file first! You could brick your mycloud if you mess this up!

OR

Here’s the modules folder with the script to pack it with squashfs. Literally all it does is take the modules folder and make a compressed file system. Download this, extract, edit the system_init file, run the script and overwrite the default image.cfs in /boot/boot

https://drive.google.com/file/d/0BxzB3cdR6ef2TGY0LXN2UmV0QXM/view?usp=sharing

I’m trying to make a debootsrapped clean debian for gen2, but getting it to compile has been a pain…

Thanks for making it such a pain to do such a trivial task, would a real init system have been too much of a bother WD?

1 Like

[quote=“bob, post:17, topic:148686”]
Thanks for making it such a pain to do such a trivial task, would a real init system have been too much of a bother WD?[/quote]
I already start build initial disk for Gen2 and normal Debian (For now - stuck on non-standart network drives)
Maybe later i make DSM for this device too… But later.

Cant translate this:
Я изучил прошивку и могу сказать только одно - это тихий ужос… Можно было всё сделать куда более функциональнее и без костылей, кои тут повсюду. Это просто п**ц… Особенно доставляют довольно “Детские” ошибки и костыли уровня выпускника гумунитария…
Финальный эпик - ктото додумался переименовать сетевой адаптер из общепринятого eth0 в нестандартный egiga0 (От чего теперь нужно пилить дополнительные костыли, либо исправлять в драйвере…)

1 Like

@Fox_exe

That’s good to hear, default firmware is really a mess to navigate around I have been trying to build debian for it, but I’m having compile issues. I would send you my MyCloud to test but unfortunately I’m in US :frowning:

Please keep us updated on progress!

Also noticed that by default, in WD firmware drive sleeps every 10 minutes if no hdd usage as per the config.xml file.

<power_management>                                                                   
                        <hdd_hibernation_enable>1</hdd_hibernation_enable>                           
                        <turn_off_time>10</turn_off_time>                                            
                        <recovery_enable>1</recovery_enable>                                         
                        <fan>0</fan>                                                                 
                        <power_off_scheduling_enable>0</power_off_scheduling_enable>                 
                        <led_enable>1</led_enable>                                                   
                        <led_sleep>0</led_sleep>                                                     
                </power_management> 

Is this ideal for HDD life? Looking at firmware files, it seems like a script is called (hd_standby.sh) to turn off HDD after 10 mins. Trying to figure out a way to keep drive on during business hours, and standby as usual during night/off peak

Hi, I have a problem when execute start script.

root@WDMyCloud dev # /mnt/HD/HD_a2/chroot/chroot-debian.sh start
mount: mount point /mnt/HD/HD_a2/chroot/dev/pts does not exist
[warn] Starting bittorrent daemon: transmission-daemon (warning).
[ ok ] Starting DLNA/UPnP-AV media server : minidlna.

those are the folders in this path

root@WDMyCloud dev # ls
console loop0 loop5 port ram1 ram14 ram4 ram9 stdout
core loop1 loop6 ptmx ram10 ram15 ram5 random tty
fd loop2 loop7 pts ram11 ram16 ram6 shm tty0
full loop3 mem ram ram12 ram2 ram7 stderr urandom
kmem loop4 null ram0 ram13 ram3 ram8 stdin zero

someone had this problem, help me please.

Just ignore this.