Sonntag, 6. September 2020

Debian on WD My Cloud Home single-bay (MCH) - part 1

 It's been almost ten years that I've been using a (few) WD MyBookLive (MBL) as my home server. In the end I used it for pure NAS tasks (Samba) only. The original 3TB became too small a couple of months ago, and I started looking for a larger harddisk.

 At that time the price for an 8TB NAS drive would be about 220€. Hence my surprise when I found an offer of a new WD NAS called My Cloud Home with an 8TB (WD RED CMR drive) for just 199€. Even if I would only use the disk it would still be cheaper - I guess that's the benefit of WD, being a harddrive manufacturer...

 Reading the specs also got me interested (4xCortex-A53@1.4GHz, 1GB RAM) - quite a bit more beefy than my old MBL. What I read about the software was rather irritating, so I didn't even bother with setting up the original software. Instead I put my hopes on a post I found in the Russian 4PDA forum (use Chrome and translate to English). Without opening the device, the procedure would install Debian Stretch and OpenMediaVault onto the device.
 The image works quite satisfactory, but coming from an unknown source it was clear for me that I need to replace it with my own. Also I would want the recent Debian Buster on it. As before on the MBL debootstrap is my weapon  of choice. Due to the nature of the boot process, repartitioning the disk is not recommended and we're limited to two 839MB plus one 2147MB partitions. The resulting RootFS therefore has to be split into root, /var, and /usr - exactly the files that are required for the original install method above. Only this time it is going to install our Debian Buster basic install instead of OMV.
apt-get install debootstrap
debootstrap buster /mnt http://ftp.debian.org/debian
cp /etc/network/interfaces /mnt/etc/network/interfaces
cp /etc/fstab /mnt/etc/fstab

cd /mnt/
mount -t proc proc proc/
mount -t sysfs sys sys/
mount -o bind /dev dev/
chroot .

apt-get update
apt-get upgrade
apt-get install openssh-server -y --no-install-recommends
apt-get clean
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /var/cache/apt/archive/*.deb

adduser --home /home/alex --shell /bin/bash alex
passwd alex
passwd

exit
umount /mnt/proc/
umount /mnt/sys/
umount /mnt/dev/

mkdir /new
mv /mnt/usr /new/
mv /mnt/var /new/
mkdir /mnt/usr /mnt/var
cd /mnt
tar cfz /srv/dev-sataa24/20-root.tar.gz *
cd /new/var
tar cfz /srv/dev-sataa24/21-var.tar.gz *
cd /new/usr
tar cfz /srv/dev-sataa24/22-usr.tar.gz *

The resulting files should be copied onto the USB-stick, replacing the originals in the /omv folder.

Now the only challenge is to get a proper Kernel onto the system. That's what I am going to cover in the next post.

46 Kommentare:

  1. Thank you for sharing!
    Is there a way to install Debian on an empty disk drive? I purchased only the case without hard drive.
    Then also the hard drive could be partitioned differently.
    I am looking forward to the next posts.

    And there is a typo in line 2 (bootsrap without t)

    AntwortenLöschen
  2. Now we are all excitedly waiting on your solution for getting a new kernel on the system ;)

    I followed your guide. Should this give me Debian Buster after a restart? Or do I need to install the kernel?

    AntwortenLöschen
    Antworten
    1. Dieser Kommentar wurde vom Autor entfernt.

      Löschen
    2. Hello, on the first post of this forum https://community.wd.com/t/clean-os-debian-openmediavault-and-other-firmwares/93714 you can download different files for the Home Cloud. If the disk is new, you need to format it with the original partitions (you can find it in that post) then you can install debian

      Löschen
    3. Dieser Kommentar wurde vom Autor entfernt.

      Löschen
    4. Dieser Kommentar wurde vom Autor entfernt.

      Löschen
    5. Success! I got it working. Buster with the original kernel. :)
      The following lines created archives for me that had a folder level too much. Instead of having all var folders in the root of the archive (/bin) they were behind a (/var/bin) which was written to the disk and could not be started.
      cd /new
      tar cfz /srv/dev-sataa24/21-var.tar.gz var/
      tar cfz /srv/dev-sataa24/22-usr.tar.gz usr/

      Instead I used
      cd /new
      cd var
      tar cfz /srv/dev-sataa24/21-var.tar.gz *
      cd ..
      cd usr
      tar cfz /srv/dev-sataa24/22-usr.tar.gz *

      Finally I downloaded the files via scp
      scp root@wdnas:/srv/dev-sataa24/20-root.tar.gz /home/me/wdnas
      scp root@wdnas:/srv/dev-sataa24/22-usr.tar.gz /home/me/wdnas
      scp root@wdnas:/srv/dev-sataa24/21-var.tar.gz /home/me/wdnas
      And put them on the USB Stick that I created to install OMV in the first place (replace the files in the OMV folder).
      If you log in via SSH, ssh root@wdnas does not work. Use the user name you chose when you followed the above manual. E.g. ssh alex@wdnas.

      Löschen
  3. Hello, I was trying to bring Debian to the home cloud duo, and i did it (with a least elegant solution as forth32). After that I tried to change the kernel and activate HW acceleration, but currently I have no time. if you are interested, on github there are sources for rtd1395 (in theory also valid for rtd1295). And if you send a mail to the developer of banana pi w2 (rtd1296) he can add you to his fork of openwrt with hw acceleration

    AntwortenLöschen
    Antworten
    1. Hi JAN, where exactly are you hoping for speed improvements due to hw acceleration? I used the WD sources and my SMB speed is saturating the 1GBit/s network interface.

      Löschen
    2. Hello, I mean HW Video Acceleration, for transcoding video. My NAS is working also at full speed and very reliable, but obviously I lost hw transcoding

      Löschen
  4. Antworten
    1. Hi Andy, what is the issue with OMV? Adding the sources and running "apt-get install openmediavault" didn't work?

      Löschen
    2. Thats the problem when try apt get install omv command only error message

      Löschen
    3. Have you an How TO to adding sources and so on

      Löschen
    4. Yes. OMV install fails when creating the salt environment.
      See post https://community.wd.com/t/install-debian-on-wd-my-cloud-home/250061/157
      Two posts further down is a solution. When I used the file provided here https://community.wd.com/t/install-debian-on-wd-my-cloud-home/250061/159 I finally could install OMV.
      Still it does not fully work. OMV does not find any drives, so you can't create any shares.

      Löschen
    5. ok thanks when any people have au fully work system can he create a new install for mch with omv 5

      Löschen
  5. I just bought one of these devices having used MyBookLive and WD MyCloud but without realising what WD had done in making the Home range ... I now want to go through the software replacement process as well.
    Just wanted to check a couple of things ...

    First ... is the starting point to this booting from a USB stick made from the contents of the download from the linked .7z in the 4pda forum?
    If yes then that still means booting from something where the exact contents of the binary files is unknown (I think).

    Second ... my device is new and has firmware version 7.12.1-170 ... are you (or anyone else) aware if the process still works?
    I don't want to trash the device on day 1

    AntwortenLöschen
  6. I followed your guide on my MyCloud Mirror gen1. I have Debian Jessie installed and working.
    To upgrade to Buster I got until

    tar cfz /srv/dev-sataa24/20-root.tar.gz *

    but that failed since mounting and boot is different on my much older device. Any suggestions ?

    AntwortenLöschen
  7. Hallo,
    leider funktioniert das bei mir überhaupt nicht... :( gibt es die Möglichkeit das fertige Buster+OMV5 zu bekommen?

    AntwortenLöschen
  8. Hello!
    I was able to follow the procedure at the end i have 3 TAR.GZ totally 70Mb,they are compressed much i noticed but to compare with the others are much smaller. is correct?

    I modified the partitions with 3 of 2gb because i didn't have enought space and honestly i dont care at all about the original WD firmware, there is one way to install everything in one partition and if is not enought make one 4GB (20) and the other 2 (21,22) smaller?

    AntwortenLöschen
    Antworten
    1. i tried to follow this procedure at least 5 times, but when i login and i try to do something i receive this:

      E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
      E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

      The login is alex also because root is not working

      Löschen
  9. this has never worked for me.
    I have used wd-mycloud-home-debian.7z from https://fox-exe.ru/WDMyCloud/WDMyCloud-Home/Debian/ as a base for your instructions. the results were as the following: when using the firmware directly without your modificatoins it works ok. Changing the files according to your instructions results in the device is not booting and not discoverable iin the network. Can you come up with instructions for everything from start to end.

    AntwortenLöschen
    Antworten
    1. maybe with this alternative method? https://4pda.to/forum/index.php?showtopic=467828&st=16500#Spoil-108340429-7

      Löschen
  10. "The resulting files should be copied onto the USB-stick, replacing the originals in the /omv folder." CAn you explain please?

    AntwortenLöschen
    Antworten
    1. You'll have to copy the files created (20-root.tar.gz 21-var.tar.gz 22-usr.tar.gz) onto the USB Stick (download from forth32), replacing the original files in the /omv folder. The install procedure will install the bootstrapped Debian this time.

      Löschen
  11. Dieser Kommentar wurde vom Autor entfernt.

    AntwortenLöschen
  12. Dieser Kommentar wurde vom Autor entfernt.

    AntwortenLöschen
  13. Hello Alexander,
    Thanks for your work :)
    I followed your guide and everithing is fine.
    My MCH is booting on Debian Buster :D
    But, I don't know how to have root access on the system.
    Sudo doesn't work and su ask me for an unknown password.
    Can you tell me how to define the root password please ?
    I must miss out something, but I don't find what :(

    AntwortenLöschen
    Antworten
    1. Ok I finaly found what was going wrong.
      I missed out the passwd command...
      I'll retry to make it work tomorrow :)

      Löschen
  14. Hellou, great project. I also bought my Cloud Home thinking that is a clasic NAS. Woult Your solution work on 4 TB drive?

    AntwortenLöschen
  15. Dieser Kommentar wurde vom Autor entfernt.

    AntwortenLöschen
  16. Great blog! I just tried this again with Ubuntu, however the /etc/network/interfaces folder doesn't exist any more.
    Do you have a work-around for this? Or which flavor/version of Linux did you use to create your USB stick?
    Thanks!

    AntwortenLöschen
    Antworten
    1. I believe you have to run the commands in part 1 on the MCH (running Debian from the Russian site) itself.

      Löschen
  17. Reading up on it I still dont understand 1 part: The linux commands, where do you exactly put them. I suppose in a file that is copied to the USB stick. But what filename? Created the USB Stick (formated with Windows), copied the original files on the stick. Have the folder omv in there. But now?

    AntwortenLöschen
  18. Hi Alex

    Do we have to install the new Buster file system from a USB before starting to compile the kernel in part 2? I tried to do that but the MCH won't install the Buster file system from USB using the same method that I used to install the original Debian from the Russian site. Any thoughts?

    AntwortenLöschen
  19. For everyone getting here looking for DUO. I don't have the time now to recompile a tutorial from scratch, but basically using the omv image for duo (4dpa forums) + following these instructions and in the end installing the mdadm package, works perfectly. I hope in the future to put a repo together.

    AntwortenLöschen
  20. Hello Alex and congratulations / so many thnaks on your WD My Cloud Home posts! They have been amazingly useful for me to understand what happens with this little beast.
    I have a question: My device was upgraded itself with OTA to Linux Debian with kernel 4.9.266 as per this post.
    How could I boot with external USB stick and enable SSHD so I can load more Linux daemons and/or other apps like docker ?
    https://www.westerndigital.com/support/product-security/wdc-22009-my-cloud-home-firmware-version-8-7-0-107

    AntwortenLöschen
    Antworten
    1. I am experimenting on one of my devices with the stock firmware (using a serial connection). Unfortunately I have not yet found a way to permanently enable sshd there. We need to get hold of a signature certificate and with that might get lucky.
      Alternatively you can check the WD community forum and use the version provided by RAV66.
      Alex

      Löschen
  21. Hi, does anybody know whether booting another OS from USB still works with firmware version 9.5.0-186?

    AntwortenLöschen
    Antworten
    1. Yes, it's working. The Bootloader did never change ;)

      Löschen
  22. P.S.: And does it work for the MyCloud Home *Duo* at all?

    AntwortenLöschen
    Antworten
    1. The procedure is a little different as the Duo has a small onboard eMMC for storing kernel and initrd.

      Löschen
  23. Thank you! Then there is hope. Though, I read that USB boot was deactivated on this page: https://cybertalk.io/de/ubuntu-server-auf-wd-mycloud-home-installieren/?mtm_kwd=Linuxserver
    I lost my way browsing through the web and the WD Community forum during the last two weeks. Could I have a pointer to a good starting point how to get a decent Linux on the Duo from scratch?

    AntwortenLöschen
  24. With the right search terms at Google, some reading and understanding, and combining files from two sources, I was finally able to free my WD MCHD and have Debian10/OMV6 on it,

    AntwortenLöschen