Install Debian on WD My Cloud home

Probably you are right, I decided that maybe was something in the bootloader because I didn’t manage to boot, not once ever, the kernel 4.9. But for example I manage to boot the kernel 4.1.17 from monarch on my device (when i bought it and tried to install debian at first). But maybe all the edits that i did are wrong. I manage to build ffmpeg with the rtk accelerator and install the libraries on debian, but it fails because it need the drivers from the 4.9 kernel (or at least that’s what i think). I gonna try again with the kernel to see if I manage to boot it, thanks.

@Vismo I wish I read that before getting the infamous reboot loop. Now I have to start it all over again :rage:

Remember, the goal is threefold:

  1. wipe out all remains of Android and Google’s presence;
  2. cut off ties with unknown/untrusted developers;
  3. have an up-to-date Debian OS.

I’d like to be corrected if one part of this is incorrect.
The following steps only upgrade Debian. Instead of an ordinary apt-get update apt-get dist-upgrade, they trick the MCH into booting a “recovery OS”, modified according to our needs. The correct commands for upgrading the Debian 9 stretch + OMV 4.x (Original version based on Android, to Debian 10 buster would be…

apt-get install debootstrap
debootsrap 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   #This command changes newly-created user password. Not mandatory as "adduser" already asks to set password
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 *   #Notice there is no hyphen after the command!
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 *

Assuming you still have the “Russian” USB drive plugged in (Debian 9 + OMV 4.x), manually mount it (I used OMV’s interface as I had it open, but it can also be done from the command line. USB drive should mount at:
/srv/dev-by-uuid-SOMETHING/, SOMETHING being the name you gave your USB stick. Hint: don’t give a name with spaces as it creates useless complexity when typing commands. I named mine “K4G”.

Don’t quote me for the path, check by yourself with the “mount” command where your USB key is mounted. It should be sufficiently different from the hard drive’s partitions you won’t mix them up.

Copy all three files on the USB key. 20-root.tar.gz, 21-var.tar.gz and 22-usr.tar.gz into /srv/dev-by-uuid-SOMETHING/omv/, replacing the ones already there. Hint: if the upgrade goes wrong, it could be useful to keep the original 20, 21 and 22-named files aside.

mv /srv/dev-by-uuid-SOMETHING/omv/20-root.tar.gz /srv/dev-by-uuid-SOMETHING/omv/21-var.tar.gz /srv/dev-by-uuid-SOMETHING/omv/22-usr.tar.gz /srv/dev-by-uuid-SOMETHING/omv/originals/
mv /mnt/20-root.tar.gz /srv/dev-by-uuid-SOMETHING/omv/
cd /new/var
mv /mnt/21-var.tar.gz /srv/dev-by-uuid-SOMETHING/omv/
cd /new/usr
mv /mnt/22-usr.tar.gz /srv/dev-by-uuid-SOMETHING/omv/

Now, unplug power jack from the MBP, stick something pointy in the reset button hole (a trusty paperclip will do), hold the reset button why plugging power back in.
Hopefully, the MCH should spin right up, shine a continuous light, while the USB key also flashes as it is read.

Would these steps by the right ones?

@juniornerd I tried your tutorial but got lost right at the beginning: when you write:

or me it works fine as I enlarged the partitions before I installed anything.

What application did you use for that? Did you extract the disk from its enclosure to do so? What are your recommended settings? Re-partitionning a disk once installed is a pain, especially with so many partitions as the MCH. Your other blog post appears to confirm this.

I first tried installing Openmediavault 5 with Debian 10 and ran into an error (…) the install fails without it.

How is this failure visible to the user? Unless you assume a serial console to be plugged in and activated.

And:

Now as Debian 11 is out I upgraded and tried to install OMV 6

Meaning you were upgrading from Russian’s Debian 9 + OMV 4.x, since Debian 10 couldn’t install? Or that you did manage to get Debian 10 installed, finally? bertek’s post refers to “new Debian from Alex-N”, and that was a 10, not 11, but you say you used it to finish off Debian 11 upgrade so as to install OMV 6.x?

I tried the first installation from the Russian firmware, then tried Alex-N’s method, but didn’t end up with the same files as yours…

This thread is already rather difficult to follow, with all kinds of links pointing here and there… Plus I’m not too familiar with this forum software…

1 Like

I’m glad to see that ppl still work on this.
I want to upgrade mine so badly but hw accel feels like a dealbreaker.

But since noone has bothered to make an public D10/D11 install stick and you still need to upgrade the russian one, i fear if we(you) get hw accel to working you still need to follow a trail of 20+ clues and steps throughout the forums to get it working.

Images for install sticks of D11/D10 are linked here:
WD My Cloud Home to Linux Server – 2. Installation – Nerdy Projects / Nerdprojekte (wordpress.com)

2 Likes

I opened the case and connected the HD to a computer.
There is a video at fox-exe.ru describing the partitioning of the HD. Fox_exe file archive (fox-exe.ru)
I downloaded the windows app and deleted the last few partitions ( I have to look up which exactly) and created them again as EXT4 partitions but larger in size.
If you use Linux you should be able to do this with the disk utility
I will see which partitions I actually touched. You are not the first to ask and the blog post is definitely outstanding…

@scascalesp
Can you check your /var directory for what exactly eats up all the space?
I opened the case and repartitioned the HD on a computer.
If there is anybody here who knows the commands to do it on the MCH via SSH, it would be nice if you could share (or link to a good tutorial).
In any case, be aware that you will wipe all your data!

Thank you. Please feel free to share the Kernel once it is compiled :wink:

2 Likes

Thanks man, i’ll look it up.

Isnt there a way to runt the Original OS in a docker/vm and get HW accel that way?

Not that i ever need to transcode 1080-4k content while i’m home but if i upgrade i know i’ll need it -.-

It’s not possible what you are asking. The original firmware is android 6.0, you can run android and then Debian with chroot or other apps with Entware (there is an existing thread about Entware on MCH), so you can transcode video.

The only two ways for having hw acceleration in a clean OS are:

  • Compiling android with WD sources, and compiling the apps that you need to have a useful NAS with Android (time consuming and not worthy).

  • Reusing the libraries from other NAS (Synology, Asustor, bananapi), that work on openwrt and probably on Debian, so you can use openmediavault.

I’m trying with the second option but probably I will never succeed. It’s a hobby project, and i´m not sure if the ffmpeg that I compile doesn’t work because it needs the drivers from kernel 4.9, or because the memory addresses for transcoding are different. Basically i don’t know what i’m doing :smile:

2 Likes

Firstly thankyou to everyone on this thread for their work in making this device useful again, until a week ago I had confined my 8TB unit to the loft !

I’m a DIY Dad keen to learn but slow to really understand (I guess like many) and have found the guide on this thread and the work of @juniornerd in his blog invaluable.

However I’ve been going round in circles for quite a few days now trying to figure out why OMV6 won’t install (there are tons of errors mainly starting dpkg:…). My question though is a bit more billy basic to that as my knowledge of linux etc is ‘keen but honestly clueless’

So I followed the guide from juniornerd with a fresh bullseye install, went through the usual pain of spending days trying to get NFS to work then realising that it wouldn’t unless I installed a new Kernel but not really knowing what it would do if I (as was likley) messed it up have refrained and use SMB (slow <100Kb/s) but at least it works. Question - What exactly is the Kernel ? Is it the brains of the device that everything runs under, is it connected to bullseye or does it sit above it in some way, by not changing anything am I missing out and if I ■■■■ it up can I get my device back or will it be briked forever ?

My next question is around OMV and how that works, during my frustrations of trying to get NFS to work I downloaded the package from that russain site and USB’s it to the mycloud home, I tohught OMV looks cool but it kept giving me errors whenever I tried to change anything so started again with the bullseye install. I wondered if by installing that russian package and old OMV it has left something behind that is preventing OMV6 from installing or whether I should just give it all up as a bad job ?

Thanks again everyone for all your fine work on here, I’m sorry an old bloke is messing it up !

Hi, the kernel is the most basic software (after the bootloader) that tells the OS how it can use the hardware. If you delete the kernel, you always can recover it with the usb recovery method, in the 4 files that you put in the pen drive to install the OS, the file called uImage is the kernel, and the file ending in dtb is an “extension” of that kernel. For using NFS, or for example docker, you need a kernel with the needed modules. The basic kernel from WD doesn’t have said modules, but you can modified and compile your own kernel with the sources. it’s weird that you had speeds so slow with SMB, I Manage speeds of 90~100 MB (the limit of the gigabit connection in theory is 120MB). I see that there is a lot of people with difficulties installing Debian Bullseye or OMV, I have almost no problems, but i make a new image from 0, and the only problem i have was the file that you need to edit so SALT can install, and changing the iptables for docker. And lastly you have that many errors in OMV, because the missing modules on the kernel, and because you have the OS on the same disk that you use to share (so you cannot edit partititons or format trough OMV). I compiled my kernel with all the memory (taking out the reserved for transcoding), the needed docker modules, NFS, Zram and zswap. unfortunately i don’t have the same device as you, I have the 2 disk version, i can make you a kernel, but i have no way of testing it.

And for anyone with the Monarch, can I ask you, why don’t you put the OS on a pendrive?, for example, in the pelican if you mess up or delete all the init files (kernel, dtb, fwtable) from the emmc, it automatically boots from usb. The single drive (monarch) doesn’t have the same behavior? if you formst the disk, doesn’t boot from USB without pushing the reset button?. I’m saying this because I read a lot of people with problems of space on the OS partition, and I have my nas booting from a NETAC SSD usb that cost me 18 euros, an the rest of the space of the SSD is swap memory (so I have a swap partition that goes at 500MB/s), I know that the swap and OS on and ssd is gonna wear, but it takes a lot of time and is easy to replace it. making it boot from usb you only need to make a first partition fat 32 for the recovery files, and edit the rootfs file to boot on a 2 partition of the usb, that way you can change, and even format the disk from OMV. But I don’t know if the behavior of Monarch is the same, someone can confirm that if you format the disk, the device goes into rescue mode (flashing light, like when you connect it with the pushed reset button)

its works WD My Live\Book\Cloud\Cloud Mirror - 4PDA

plus i del from your .config “sound cards”

1 Like

Thanks @zeusjan for clarifying everything I think I’ll have another go from scratch and use buster and the kernel Alex N provided and see what happens. I realised that this won’t wipe all my shares so no biggie if it goes wrong.

1 Like

Hello,
If may I ask about resizing partitions… I dissasembled HDD, after that from Ubuntu Live and GParted created new partitions, 10gb / ea.
Now I want to move /usr and /var partitions to created before. Now I did:

  1. Mounted new partition as /var2 in /etc/fstab file
  2. copied /var via “cp -R /var/ /var2/”
  3. changed in /etc/fstab /var with /var2. After long restart nothing changed, still /var was old /var, and /var2 was unmounted.
    What is going on? On simple linux distros it worked.

use Eassos Disk Genius, GParted does not work with sataa1 FW_TABLE (Realteck/WD)

kernel automounts partitions sataa21 /var and sataa22 /usr when they formatted to EXT2/3/4.
Solution: format sata21 and sata22 to FAT, and transfer /var and /usr to /root (sataa20).
Delete in fstab mounting sataa21 /var and sataa22 /usr

Image WD-MCH(25GB)Debian10_clean.zip - Google Disk
root/root
user/user

Hi,
I was prompted by one person where the code of the hated sataa is located))) (straight Satan)
He was engaged in mod uboot and disappeared … at his direction, need to delete a piece of code in the file GPL_MCH_6.6.1-123_20191114.tar\linux-kernel\linux-kernel\drivers\scsi\sd.c
line 2965

#ifdef CONFIG_AHCI_RTK
	if( sdp->host && sdp->host->hostt ) {
		if( strncmp(sdp->host->hostt->name, "ahci", 4 ) == 0 ) {
			error = sd_format_disk_name("sata", index, gd->disk_name, DISK_NAME_LEN);
		}
		else {
			error = sd_format_disk_name("sd", index, gd->disk_name, DISK_NAME_LEN);
		}
	}
	else
#endif

I tried to do this, indeed the disk name becomes sda and sda1-24 partitions when the kernel is loaded, but after that the network interface does not work. If you have free time, please look)))

With this Image my partition will be bigger properly as you said?
Another question: If I change image, I lost data from 2.7Tb disk?

yes

yes

After restoring the table and each partition (from FW_TABLE to SWAP) from the images, you will need to create the last partition sataa24 manually on the entire unallocated space and save by clicking “Save All”

I have all the information in this post and related ones, I compiled and installed debian11 + OMV6.

Everything works as I need it, however I would like to create a script that formats the disk and installs everything automatically.

I plan to use commands like sgdisk to create the partitions etc.

Is there a maximum size for the rootfs “rescue.root.sata.cpio.gz_pad.img” ?

@Alex-N How can I go back to stock kernel? (I’ve a dd backup of all original partitions)
PS: I can’t compile, I’m getting this error at make menuconfig

make[1]: Entering directory '/srv/dev-sataa24/new_kernel'
  HOSTCC  scripts/basic/fixdep
/bin/sh: 1: scripts/basic/fixdep: Permission denied
scripts/Makefile.host:91: recipe for target 'scripts/basic/fixdep' failed
make[2]: *** [scripts/basic/fixdep] Error 126
/srv/dev-sataa24/GPL_MCH_7.15.0-160_20210429/GPL_MCH_7.15.0-160_20210429/linux-kernel/linux-kernel/Makefile:452: recipe for target 'scripts_basic' failed
make[1]: *** [scripts_basic] Error 2
make[1]: Leaving directory '/srv/dev-sataa24/new_kernel'
Makefile:146: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2