Clean OS (Debian), OpenMediaVault and other "firmwares"

Sounds great, is it difficult to “change” the Kernel?
What do you think about additional “Samba Tuning” or is this already done with this?
Sorry if stupid Questions :smiley:

no luck…

root@MyCloud:~# ntfs-3g /dev/sdb1 /media/sdb1/
root@MyCloud:~# ls /media/sdb1
ls: cannot access /media/sdb1: Input/output error
root@MyCloud:~# umount /media/sdb1

Hi Fox,
i tried the way you recommend and i get a little further. But i cannot build iscsitarget dkms module at all.
root@wdmc:/var/lib/dkms/iscsitarget/1.4.20.3+svn502/source# dkms build iscsitarget/1.4.20.3+svn502

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area....
make KERNELRELEASE=3.10.70+ -C /lib/modules/3.10.70+/build M=/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build.....(bad exit status: 2)
Error! Bad return status for module build on kernel: 3.10.70+ (armv7l)
Consult /var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/make.log for more information.


root@wdmc:/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build# cat make.log 
DKMS make.log for iscsitarget-1.4.20.3+svn502 for kernel 3.10.70+ (armv7l)
Di 2. Mai 19:33:45 UTC 2017
make: Entering directory '/mnt/mc2kernel'
  LD      /var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/built-in.o
  LD      /var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/built-in.o
  CC [M]  /var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/tio.o
In file included from include/linux/sched.h:15:0,
                 from include/linux/blkdev.h:4,
                 from /var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/iscsi.h:11,
                 from /var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/tio.c:7:
/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/tio.c: In function ‘tio_add_data’:
include/linux/kernel.h:663:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_min1 == &_min2);  \
                 ^
/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/tio.c:75:25: note: in expansion of macro ‘min’
  const size_t to_copy = min(tio->pg_cnt * PAGE_SIZE - iter->size, len);
                         ^
include/linux/kernel.h:663:17: warning: comparison of distinct pointer types lacks a cast
  (void) (&_min1 == &_min2);  \
                 ^
/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/tio.c:82:18: note: in expansion of macro ‘min’
   size_t chunk = min(PAGE_SIZE - iter->pg_off, residual);
                  ^
scripts/basic/fixdep: 2: scripts/basic/fixdep: Syntax error: newline unexpected
scripts/Makefile.build:308: recipe for target '/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/tio.o' failed
make[2]: *** [/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel/tio.o] Error 2
scripts/Makefile.build:455: recipe for target '/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel' failed
make[1]: *** [/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build/kernel] Error 2
Makefile:1226: recipe for target '_module_/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build' failed
make: *** [_module_/var/lib/dkms/iscsitarget/1.4.20.3+svn502/build] Error 2
make: Leaving directory '/mnt/mc2kernel'

Did you had the same problems at compiling iscsitarget ? What about enabling iscsitarget function in kernel as build-in? Actually it switched to module.

I finally get iscsitarget to work.
You have to crosscompile the kernel module. I used the mc2kernel archiv and downloaded the iscsitarget trunk from svn

svn checkout svn://svn.code.sf.net/p/iscsitarget/code/trunk iscsitarget-code

Now the mc2kernel directory looks like

Within the iscsitarget directory you compile the kernel via

make CROSS_COMPILE=/home/florian/DevWDMyCloud/framework/mc2kernel/toolchain/bin/arm-marvell-linux-gnueabi- ARCH=arm KSRC=/home/florian/DevWDMyCloud/framework/mc2kernel/ kernel
Important: Use the absolute path!

This process will create the ./iscsitarget-root/kernel/iscsi_trgt.ko

Copy this kernel module to your WDMyCloud. In my case the destination is
/lib/modules/3.10.70+/kernel/iscsi and do chmod 644

After that you must install userland tools (ietd, ietadm). The easiest way is to install iscsitarget.
apt-get install iscsitarget

Via insmod command, i loaded the iscsi_trgt.ko into kernel
insmod /lib/modules/3.10.70+/kernel/iscsi/iscsi_trgt.ko

Now you can try to restart the iscsitarget service

To get openmediavault-iscsitarget installed, you must use force. I did it this way

apt-get download openmediavault-iscsitarget
dpkg --ignore-depends=linux-headers-armhf -i openmediavault-iscsitarget_3.1.6_all.deb

That’s all. My iSCSI Target is now running.

Next step is to provide a single partition as an iscsi target.

Good work!
it worked well with me but i run up with 502 Bad Gateway error (nginx) when i restart my cloud, but i can visit my files through smb in windows and ssh.

I did clear cache but that didn’t work. so could you please help me figure out what’s the problem?
best

Hi Fox_exe,

many thanks for your work on giving the mycloud a useful system instead of the outdated and insecure firmware.
But how to install clean debian on EX4100? Is it possible? I found files on your google drive but no explanation.
I cant find “Autoinstall” folder and “Recovery” folder mentioned in the first post on google drive.
And is it possible to have the debian running from an usb pen drive without touching the firmware?

to bad this could not be combined into a simple .deb update file.

personally with all the failures with wd updates i am thinking about doing this. i just wish a better step by step english guide existed my linux skills are nowhere near up to snuff

All is possible, but hard for me alone (Need many time for teach/research/develop thins)…

all is understood. just to risky for myself to undertake.
my windows environment did not like the latest official firmware downgrade to the first v4 and got better speeds again…
could you perhaps clean up your english instal instructions for a total linux starter.

Hello Fox_exe and lordmage,

i found this thread Debian on WD MyCloud EX 4100 where there are people preparing the EX4100 for debian boot.
Maybe a good place to join forces and not have to do all on your own.

alas i’m sitting on a gen 1 x4 firmware mycloud. that i can ssh into and work with just would prefer a better guide to install and use alternatives with it., but since they are provided for free i am not rushing anyone in doing so… i sit behind a double nat using the my cloud as a back-up rather than as a cloud devices

Hi. Maybe you will skip the last step with openmediavault-iscsitarget.deb. I got also trouble with this package. so i removed it finally. furthermore the openmediavault iscsi webplugin isn’t able to map partitions. so i must use the config files.
good luck

WdMycloud.GEN1

Very good performance with samba debian Jessie-4K in reading, less good in writing, but not really important to me, just to dismount the disk to copy.

Read :

Write :

Just :
apt-get install samba
cd /etc/samba/
mv smb.conf smb.conf.back
nano smb.conf
follow : http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen1/Other/Samba%20v4/Info.txt
cd /data
mkdir Data Public
chmod 777 /data/Public
service smbd restart

And recover any place of the root file system (3.8GB) :

add raspberry repository :
nano /etc/apt/sources.list
deb Index of /raspbian jessie main contrib non-free rpi

Goodbye 64k, welcome 4k, Thanks @Fox_exe

@HRVSTR
If you could detail the procedure in one post, I would be really interested in your method. Thank you in advance.

Edit: To set the samba cache in tmpfs (/var/run) :

service nmbd stop
service smbd stop

mv /var/cache/samba /var/cache/samba.bak
mkdir /var/run/samba-cache
ln -s /var/run/samba-cache /var/cache/samba

The tip to add in /etc/init/smbd.conf install -o root -g root -m 755 -d /var/run/samba-cache does not work on reboot, so a @reboot to recreate the samba-cache folder.

crontab -e
and add
@reboot mkdir /var/run/samba-cache

service nmbd start
service smbd start

rm -rf /var/cache/samba.bak (If everything works)

I go to hdparm now see what it will give.

Thx @jpflouret

Edit1 : What I learnt from using WD Red disks to build a home NAS | With Blue Ink

On Linux, the traditional way to control disk standby (and power management) is to use hdparm; however, hdparm will not work with WD Red drives, because the firmware of the disks doesn’t support that. Instead, we can use the third-party hd-idle utility to accomplish this.

I tested hdparm with an old laptop drive, works perfectly. But if you want to do it with a WD RED, read the article.

1 Like

#WDMycloud GEN1 Debian Jessie-4K : Preserve your hard drive

#1.Edit :
/etc/fstab, add mount options to /dev/sda4 (Data partition) and
/dev/md0 (root):noatime,nodiratime,commit=60
#2.Install log2ram :
git clone GitHub - azlux/log2ram: ramlog like for systemd (Put log into a ram folder)
cd log2ram
chmod +x install.sh
./install.sh
#3.Disable unusual cron jobs:
crontab -e
Move fake-hwclock to “daily” folder:
mv /etc/cron.hourly/fake-hwclock /etc/cron.daily
#4.Set the samba cache in tmpfs (/var/run) :
service nmbd stop
service smbd stop
mv /var/cache/samba /var/cache/samba.bak
mkdir /var/run/samba-cache
ln -s /var/run/samba-cache /var/cache/samba
crontab -e
and add the line :
@reboot mkdir /var/run/samba-cache
service nmbd start
service smbd start
rm -rf /var/cache/samba.bak (If everything works)
#5. Install hd-idle (Spin Down and Manage Hard Drive Power)
apt-get install build-essential fakeroot debhelper -y
wget Download hd-idle-1.05.tgz (hd-idle)
tar -xvf hd-idle-1.05.tgz && cd hd-idle
dpkg-buildpackage -rfakeroot
dpkg -i …/hd-idle_*.deb
cd …
dpkg -i hd-idle_1.05_armhf.deb
Open the hd-idle configuration file to enable the service to automatically start and spin down drives :
nano /etc/default/hd-idle
Change this line to enable hd-idle :
START_HD_IDLE=true
Adjust this line to enable sleeping on the drive every 10 minutes (60 seconds * 10) :
HD_IDLE_OPTS=“-i 0 -a sda -i 600”

Reboot

#Bonus : Fix your WD Red drives (valid for all old WdRed hdd)
I did the manipulation yesterday under a Windows PC, no problem to report. Obligation to open the WDMycloud case to remove the disc.
Any command lines depending on your operating system are in the article :

2 Likes

@Fox_exe

I wanted to know if you had intentionally left this command “debug initcall_debug” and that it serves to keep it in the configuration of the bootconfig in /dev/sda7 ?

http://mybookworld.wikidot.com/forum/t-2222984

The default system cmdline includes some debug clauses in the cmdline: debug initcall_debug. This cause systemd and kernel to throw lots of unneeded messages. The only way to fix it is writing a new configuration partition. This is how I did it.

I followed the instructions and install the new bootconfig , temp on boot up is impressive.
To see if it does not pose a problem later.

For those who want to test, the file is already ready :
http://www62.zippyshare.com/v/WNMUTEZ3/file.html
dd if=/dev/zero of=/dev/sd7
dd if=new-config.img of=/dev/sd
7

Please can show me which file I need to down load for my mycloud version 2 and how do I install it to replace the useless WD software
thank you
Alistair

All is here for GEN2 :
https://drive.google.com/drive/folders/0B_6OlQ_H0PxVRXllYjY5RG1CZEU

Thank you, there is a load of folders there which one is the correct one?

Do you want exactly, dsm, debian, just some software?
You have the choice.