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


#1539

Let me warn you, don’t install nextcloud with apache, it runs unbearably slow on this device. Nginx makes it about 3 times faster though it’s still only OK-ish.
Assuming you’re using the latest Debian, there’s no easy way to have nextcloud up and running. You’ll have to install your favorite webserver, php interpreter and SQL database (in my case nginx, php-fpm and mariadb) from the package manager and from there on it’s all manual work (the official doc is outdated but it’s a starting point). You will have to:

  • download latest nextcloud archive
  • untar said archive into your webroot
  • chown the created folders to www-data and chmod some folders for security purpose (follow the official doc). Also move the data folder outside of your webroot
  • create a new database and a new database admin
  • create a self-signed certificate or a public certificate to use with https / TLS
  • create the vhost config file for your nextcloud in /etc/nginx/sites-available and symlink it into …/sites-enabled (that’s where most of the PITA is)
  • modify a few parameters in /etc/php/7.0/php-fpm/pool.d/
  • once all is set, you run the php installer and let it work its magic
  • configure your NAT to allow access from the internet if needed

Obviously, the above is just an overview so you know what you’re getting yourself into. If you aren’t that familiar with most of this, you’ll have to spend quite some time googling for info and piecing it all together from various docs, blogs and forums. I certainly did.


#1540

Yes, this is a problem. pfe.ko (and *.elf files) - is a network driver.


#1541

Thanks again for your great work!

I have a question related to the toolchain to build the system. I’m trying to compile aria2c for WDMyCloud Gen2. However, the official toolchain only contains a gcc ver 4 while aria2c requires gcc > 4.5. I tried to build my own toolchain with buildroot 2018-02 version. I started from cortex-a9 armv7 and added NEON FPU. I didn’t add other VFP. For the libraries, I tried both uclibc and glibc.

With the toolchain I get, I can compile simple helloworld and aria2c statistically successfully. But only helloworld runs successfully on WDMyCloud. Aria2c has “segment fault”.

I checked your ftp and find in http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen2/Debian/Dev/helpmebuild.sh, there is a line

CROSS_COMPILE="$CUR_DIR/…/cc-armada370/bin/arm-unknown-linux-gnueabi-"

So I wonder if you build your own toolchain? Is it possible for you to share your configuration file for the toolchain? Thank you!


#1542

Nope. Its a default toolchain from WD sources.
Or you can use toolchain from DSM sources.
Or install binutils-arm-linux-gnueabi


#1543

Hi!

I have to say you that I am really happy to have found this page and I think that you are helping to the people to truly use their devices (I have to admit that the WD software does not seem very good to me).

I have three questions.

  1. Is this still compatible with the latest version (I have a WD My Cloud Gen2 of 4TB with the original firmware 2.30.181)?

  2. How does the ChrootedDebian’ app work? I know what is the chroot command for, but I would like to know if this is well implemented in the WD My Cloud and if it is stable …

  3. If I only install apps in the normal firmware, can I update it as normal?

Thanks you very much :slight_smile:


#1544

Hi!

I am back with more questions about this great repository :wink:. I’ve been trying to install some apps like PhpMyAdmin, Joomla, MediaWiki and Wordpress, but I have the same problem with each of them:

  • How can I connect to MySQL? I have seen that the NAS already has a MySQL server installed, but I don’t know the password or how to connect to it.

Thanks :blush:

EDIT: I answer my own question. The default login and password for the MySQL that is already installed is “admin” and “admin”.


#1545

Thank you so much for your reply!

So you believe I should try another one? I’m interested mostly in a “dropbox” or “gdrive” experience mostly. But because most of the users are regular people I thought own/nextcloud would be the best option because of the graphical design.

You think nginx would do the trick? I really appreciate your answer @troolie

Regards


#1546

@ZeryOs

Well, it does for me as I described in my previous message. I use nextcloud mostly as centralized backup for my android devices (there are several android clients to do all sort of things: create shared tasklists, backup phonebook, copy files from and to the phone, centralized agenda and so on). If I’m lazy or don’t wanna map a samba share, I can also access my public shared folder from nextcloud’s web interface.
Like I said, nginx makes it workable, at least when you don’t throw several concurrent users at it. Then again, it also depends what visualization plugins you add to your nextcloud. For example, do you want it to integrate viewers for office documents so you can view the content from any device? Well, there’s a plugin for that, but it takes more memory to use it and to small ARM CPU will have to process the job. Whereas you could simply download the file and use some program on your computer to view the file (more work for you, less for the mycloud).
YMMV. A lot. I’m happy with it though and you probably would be too.

I went with nextcloud cause we use owncloud at work. I didn’t research much about alternative products but I’m pretty sure nextcloud is the best and most advanced opensource project you can find for a personal cloud. I kinda wanted to document its installation (I even setup a wikimedia on the mycloud to keep track of that kind of stuff) but it takes more time than I can spare at the moment.


#1547

First of all, thanks @Fox_exe for the hard work. I really appreciated.

My device is a Gen 1 and I was doing some experiments that lead me to a problem now.

After installing clean_debian 64k the repos were not working so I decided to move it back to clean_debian Jessie but when I try to re-run autoinstall it said that mdadm was not working proberly.

When I tried to run root@mycloud: mdadm it always answer with ‘Killed’.

root@MyCloud:~# mdadm
Killed

Full Log:

root@MyCloud:/data/shares/Public# ./install.sh
=============================================
Ok, lets go...
Stop all processes...
forked-daapd: no process found
Stopping periodic command scheduler: cron.
./install.sh: line 44: wdAutoMountAdm.pm: command not found
Recreate mdraid partitions:
/dev/md0 exist! Deleting...
./install.sh: line 58:  2093 Killed                  mdadm --stop ${upgradeDevice} 2> /dev/null
./install.sh: line 58:  2094 Killed                  mdadm --wait ${upgradeDevice} 2> /dev/null
Restoring raid...
./install.sh: line 61:  2097 Killed                  mdadm ${currentRootDevice} --remove ${Disk}1 > /dev/null 2>&1
./install.sh: line 62:  2098 Killed                  mdadm --wait ${currentRootDevice} 2> /dev/null
./install.sh: line 63:  2099 Killed                  mdadm ${currentRootDevice} --add ${Disk}1 > /dev/null 2>&1
./install.sh: line 64:  2100 Killed                  mdadm --wait ${currentRootDevice} 2> /dev/null
./install.sh: line 65:  2101 Killed                  mdadm ${currentRootDevice} --remove ${Disk}2 > /dev/null 2>&1
./install.sh: line 66:  2102 Killed                  mdadm --wait ${currentRootDevice} 2> /dev/null
./install.sh: line 67:  2103 Killed                  mdadm ${currentRootDevice} --add ${Disk}2 > /dev/null 2>&1
./install.sh: line 68:  2104 Killed                  mdadm --wait ${currentRootDevice} 2> /dev/null
=============================================
Current device: /dev/md1
Upgrade device: /dev/md0
Upgrade part: /dev/sda1
Current raid status:

Personalities : [linear] [raid0] [raid1] [raid10]
md1 : active raid1 sda2[0]
      1999808 blocks [2/1] [U_]

md0 : active raid1 sda1[0]
      1999808 blocks [2/1] [U_]

unused devices: <none>
=============================================
Creating new mdraid volume...
./install.sh: line 80:  2106 Killed                  mdadm ${currentRootDevice} -f ${upgradePart}
./install.sh: line 81:  2107 Killed                  mdadm --wait ${currentRootDevice}
./install.sh: line 83:  2109 Killed                  mdadm ${currentRootDevice} -r ${upgradePart}
./install.sh: line 84:  2110 Killed                  mdadm --wait ${currentRootDevice}
./install.sh: line 86:  2112 Killed                  mdadm --zero-superblock --force --verbose ${upgradePart}
./install.sh: line 89:  2115 Killed                  mdadm --create ${upgradeDevice} --verbose --metadata=0.90 --raid-devices=2 --level=raid1 --run ${upgradePart} missing 2> /dev/null
./install.sh: line 90:  2116 Killed                  mdadm --wait ${upgradeDevice}
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! Something wrong: /dev/md0 not exist !!
!! Exiting now.                                !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I tried to reinstall mdadm but unfortunately with the 64k repo not working I wasn`t able to doit. Now i am stuck, I still have access to ssh, mounting and unmounting and everyting but I cant reinstall debian.

Thanks in advance.


#1548

The depot for 64k is here : http://anionix.ddns.net/dists/jessie-64k/main/binary-armhf/
You have to start over from the original firmware, otherwise it will not work.
In mycloud ssh :
wget http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen1/Recovery/Boot%20recovery%20from%20HDD/boot-md0.env
dd if=boot-md0.env of=/dev/sda7
reboot.
You should go back to the original firmware, from here you can restart the script.

Option 2
You erase your disk and install the image I just uploaded, with clean debian jessie 4k and rootfs 10Gb :
https://mega.nz/#F!DGBxwQiS!y3H8twu3jeMjLzzebPIzfg
I just came to post it and share, just follow the instructions for installation.

ps : I have fail and remove /dev/sda2 from the raid, I just kept /dev/sda1 and /dev/md1 with the same partitioning order as the original.



#1549

Thanks for the reply @Tony_Le_moine

I did try the first option but it didnt`t seem to work

In mycloud ssh :
wget http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen1/Recovery/Boot%20recovery%20from%20HDD/boot-md0.env
dd if=boot-md0.env of=/dev/sda7
reboot.

after reboot I lost ssh access and it seems like it is bricked, is there anything else to be done after it?

Thanks


#1550

You have this solution:
http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen1/Recovery/Readme-en.txt

Or you open your MyCloud and you follow these tutorials:
http://anionix.ddns.net/WDMyCloud/WDMyCloud-Gen1/Replace%20HDD%20-%20English.txt

Another faster solution, but you still have to open it: [GUIDE] Debrick a completely dead MyCloud

To open it without damaging it: https://www.youtube.com/watch?v=2_eW25LGXcI


#1551

Thanks @Tony_Le_moine the restore works properly.


#1552

Hey @Fox_exe, I did a lot of reading on the web and in your gdrive folder but I am still not sure how to fix the problem with “packages held back” on GEN1 devices.

Could you explain what I have to do to update? I am running kernel 3.2.68.

I tried dist-upgrade and manually installing the held back packages but it always bricks my device.


#1553

V4 firmware is built with a non-standard 64k page size. So any upgrades from standard repositories are likely to brick your device.


#1554

Ok, so if I understand correctly, nginx is substitution for OMV?

If that’s the case, could you please walk me into the details? Any guide I could follow. This is my first experience into setting-up any “server-type” device so any help would be really appreciated!

Thanks again!


#1555

Ok as I understand, Nginx es a webserver.

What I need it mostly is for an small team to share files not much of editing really.

So i did what you asked:

  • Downloaded Nextcloud Archive (currently 13.0.1 version)
  • Unzip it into my webroot (under /var/www/nextcloud/ (created a folder)

When you speak about chown / chmod it is unclear what permissions should them be. Could you specify please?
About the database, how do I access to it?
How do I create a self-signed certificate / public certificate?
What should the vhost config should look like?
What parameters in pool.d?


Could you give me a hand with this? I’m really trying to make it work and willing to learn.
I’d be so thankful If your could help me on this one based on your experience @troolie

Regards!


#1556

What I wrote previously wasn’t meant to walk you through the process. I’m well aware many things aren’t explained cause it would require me to redo a good part of it or dig for info again (it was 6 months ago and I don’t install nextcloud every week). Now:

  • the permissions needed are written in the official nextcloud doc. Somewhere in there is a warning saying that some folders shouldn’t be accessible from the web. Or I did that cause nginx doesn’t support .htaccess files. Anyway, it all starts here; https://docs.nextcloud.com/server/13/admin_manual/installation/index.html
  • For the database, you access it from the command line. In my case, I ran mariadb then once inside:
    CREATE USER cloud_admin IDENTIFIED BY ‘your_password’;
    CREATE DATABASE nextcloud;
    GRANT ALL PRIVILEGES ON nextcloud.* TO ‘cloud_admin’@’%’ IDENTIFIED BY ‘your_password’;
    GRANT ALL PRIVILEGES ON nextcloud.* TO ‘cloud_admin’@‘localhost’ IDENTIFIED BY ‘your_password’;
    FLUSH PRIVILEGES;
    exit
  • For a public cert, you buy it from verisign and the likes (that’s when you want to run a public server and you don’t want your users to be met with “invalid/untrusted certificate” error when they visit). For a self signed certificate, I used openssl on my computer: openssl dhparam -out dh4096.pem 4096
    You will refer to this pem file from the vhost config file (of course you’ll have to move that file somewhere on the mycloud first).
  • There’s a vhost file example (it doesn’t work with debian stretch, though) here: https://docs.nextcloud.com/server/13/admin_manual/installation/nginx.html
  • there’s only one file in pool.d, that’s www.conf. I can’t remember exactly what I had to mess with in there. I believe it was: listen = /run/php/php7.0-fpm.sock
    Maybe I added it or modified it, and maybe there was something else (could have been optional stuff). All I can tell you still is that it’s gotta match the fastcgi_pass unix:/run/php/php7.0-fpm.sock; in the nginx vhost file. Otherwise nginx will try to access CGI using 127.0.0.1:9000 and that will fail because of some system permission.

That’s all I can remember without digging for hours.


#1557

Yeah i figured that you where more trying to warn me then to show me and I’m sorry I took the other path but is just something I believe I need in my cloud, so first of all thanks!

I’ve done some research and if something works fine, I believe I should make a full tutorial or guide of the process for others to follow in case are looking for something like that. Do you also have the Gen2 Mycloud? Thanks again @troolie

Regards!


#1558

Yes, my device is Mycloud 2nd Gen running standard debian stretch.

I just realize the command I gave you to create a certificate isn’t all of it. That one is for the Diffie-Hellman secured key exchange that happens before SSL/TLS connection is established. You also need to generate the RSA .key and .crt files that will be used to encrypt traffic:
openssl req -x509 -newkey rsa:2048 -keyout yoursite.key -out yoursite.crt -days 3650 -nodes -sha256

That will create a certificate valid for 10 years.