Debian Linux on the My Cloud PR4100/PR2100

You didn’t say where it fails… what have you done so far?
Preseed config should be the same, so what is the output of

lspci -k -s 00:1e
ls -l /sys/class/tty/*/device/driver
sudo dmesg | grep tty

I’m using zfs on debian with the kernel headers as above and then

apt-get install zfs-dkms zfsutils-linux

I tried using http://archive.ubuntu.com/ubuntu/dists/bionic-updates/main/installer-amd64/current/images/netboot/mini.iso in place of …/debian-cd/current/amd64/iso-cd/debian-9.2.1-amd64-netinst.iso. SSH never came up and I don’t have a UART port cable to diagnose why.

I did install Debian successfully with ZFS, thank you. I found this guide to be helpful: https://unix.stackexchange.com/a/396160/48189

From https://help.ubuntu.com/community/Installation/MinimalCD

mini system in UEFI mode
While the minimal iso image is handy, it isn’t useful for installing on UEFI-based systems that you want to run in UEFI mode. The mini iso lacks the proper files for booting the computer in UEFI mode. Thus, the computer will boot in BIOS compatibility mode, and the installation will be in BIOS mode.

I’d use the ubuntu server iso.

Thanks for your hints. Encouraged, I gave it another go with Ubuntu. I tried testing it first on another Linux machine I just acquired so I could see what I was doing.

Big mistake. I wasted hours and regret it. Ubuntu has TWO server installers. The default is http://releases.ubuntu.com/18.04.1/ubuntu-18.04.1-live-server-amd64.iso which doesn’t appear to work with preseeding but there’s no good documentation explaining that or why.

The other, http://cdimage.ubuntu.com/ubuntu/releases/18.04/release/ubuntu-18.04.1-server-amd64.iso, supposedly does but fails with the error “Your installation CD-ROM couldn’t be mounted.” This is a bug that’s been known for years and requires manual intervention to pass.

Both images are available via HTTP only, no SSL! This is 2018! Shame on you, Ubuntu!

Conclusion: Ubuntu installers are a giant mess and I’m sticking with Debian.

@dswv42 You may want to remove the nomodeset kernel parameter from the GRUB config.
This prevents the i915 intel video driver getting loaded, required for vaapi HW video transcoding.
Thanks reference

I removed it from /etc/default/grub default params and then did

# sudo update-grub
# sudo reboot
...
# ls -l /dev/dri/renderD128
# vainfo      
error: XDG_RUNTIME_DIR not set in the environment.
error: can't connect to X server!
libva info: VA-API version 0.39.4
libva info: va_getDriverName() returns 0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
libva info: Found init function __vaDriverInit_0_39
libva info: va_openDriver() returns 0
vainfo: VA-API version: 0.39 (libva 1.7.3)
vainfo: Driver version: Intel i965 driver for Intel(R) CherryView - 1.7.3
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Simple            :	VAEntrypointEncSlice
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointEncSlice
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileH264MultiviewHigh      :	VAEntrypointVLD
      VAProfileH264MultiviewHigh      :	VAEntrypointEncSlice
      VAProfileH264StereoHigh         :	VAEntrypointVLD
      VAProfileH264StereoHigh         :	VAEntrypointEncSlice
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointEncPicture
      VAProfileVP8Version0_3          :	VAEntrypointVLD
      VAProfileVP8Version0_3          :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD

E.g. Emby media server can now use it

ps fax | grep vaapi
 2706 ?        Sl     0:15  \_ /opt/emby-server/bin/ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i file:/MM/Trailers/SomeMovie.mkv -threads 0 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_vaapi -vf format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=692 -b:v 3680000 -maxrate 3680000 -bufsize 7360000 -profile:v 578 -level 41 -force_key_frames expr:if(isnan(prev_forced_t),eq(t,t),gte(t,prev_forced_t+3)) -copyts -vsync -1 -codec:a:0 libmp3lame -ac 2 -ab 320000 -f segment -max_delay 5000000 -avoid_negative_ts disabled -map_metadata -1 -map_chapters -1 -start_at_zero -segment_time 3 -individual_header_trailer 0 -segment_format mpegts -segment_list_type m3u8 -segment_start_number 0 -segment_list /var/lib/emby/transcoding-temp/74f5332ba1271fcece2c3cba79a6d129.m3u8 -y /var/lib/emby/transcoding-temp/74f5332ba1271fcece2c3cba79a6d129%d.ts
1 Like

Here’s how to get hardware control with much less effort / time by building an in-tree kernel module.

Install the 4.9 kernel, headers and source. At the moment this is a meta package for linux-image-4.9.0-8, or the 4.9.110-3 kernel. This may bump in the future

sudo apt install linux-image-amd64 linux-headers-$(uname -r) linux-source \
  gcc make libc6-dev binutils-dev bc

Verify that the current kernel is 4.9.0-8-amd64 with uname -r
If it isn’t, update the grub bootloader to select the correct menuentry by setting the grub default.

Prepare kernel build directory and extract the source

mkdir ~/kbuild && cd ~/kbuild
tar xf /usr/src/linux-source-4.9.tar.xz
cd linux-source-4.9

Get the module symvers from the headers. This file is generated when you build the full kernel, so we save a few hours by skipping this.

cp /usr/src/linux-headers-$(uname -r)/Module.symvers .

Get the corresponding kernel config

cp /boot/config-$(uname -r) .config

Verify if the kernel source version matches the current version.

uname -r
make kernelversion

If these previous commands did not match, edit the first lines of the Makefile like this. (thanks @neversaydie)

SUBLEVEL = 0
EXTRAVERSION = -8-amd64

Enable the Intel LPSS UART driver in the kernel config.

Directly with an editor

Enable these 2 parameters in the .config in your favorite editor

CONFIG_SERIAL_8250_LPSS=m
CONFIG_DW_DMAC_PCI=m

Note that these parameters may change in future kernels.

or select it in the menu
sudo apt install libncurses5-dev
make nconfig

Enable support as a module.

   -> Device Drivers
     -> Character devices
       -> Serial drivers
        -> <M> Support for serial ports on Intel LPSS platforms. 

Save and exit.

Now compile the module

make prepare
make modules_prepare
make M=scripts/mod
make M=drivers/tty/serial

And install it

sudo make M=drivers/tty/serial modules_install
sudo depmod
sudo modprobe 8250_lpss

Verify it’s active

lsmod | grep 8250_lpss

This lighter module is easier to keep in sync with the mainline kernel.
All that’s left is to put all this in a post-install script.

I’d suggest a 4GB image file with OMV already installed and just inflate the partitions on first boot.
Then the user only needs to update OMV to the latest version and change the password.
The image can be installed on a disk but I’d recommend to run it from a USB drive.

Thank you, that didn’t work for me on Stretch:

root@unassigned-hostname:~# apt install linux-image-4.9-amd64 linux-headers-4.9-amd64 linux-source-4.9
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-image-4.9-amd64
E: Couldn't find any package by glob 'linux-image-4.9-amd64'
E: Couldn't find any package by regex 'linux-image-4.9-amd64'
E: Unable to locate package linux-headers-4.9-amd64
E: Couldn't find any package by glob 'linux-headers-4.9-amd64'
E: Couldn't find any package by regex 'linux-headers-4.9-amd64'

I was able to do this instead:

sudo apt install linux-headers-amd64 linux-source-4.9

Then everything else worked except for the last step:

debian@unassigned-hostname:~/kbuild/linux-source-4.9$ sudo make M=drivers/tty/serial modules_install
  INSTALL drivers/tty/serial/8250/8250_lpss.ko
  INSTALL drivers/tty/serial/8250/8250_moxa.ko
  INSTALL drivers/tty/serial/8250/serial_cs.ko
  INSTALL drivers/tty/serial/jsm/jsm.ko
  INSTALL drivers/tty/serial/rp2.ko
  DEPMOD  4.9.130
debian@unassigned-hostname:~/kbuild/linux-source-4.9$ sudo depmod
debian@unassigned-hostname:~/kbuild/linux-source-4.9$ sudo modprobe 8250_lpss
modprobe: FATAL: Module 8250_lpss not found in directory /lib/modules/4.9.0-8-amd64

I fixed that by starting over and modifying the following two lines in the Makefile first (as explained in How to recompile just a single kernel module?):

SUBLEVEL = 0
EXTRAVERSION = -8-amd64

Hi @Tfl, would you please update your guide? I followed the instructions and my PR4100 shut down immediately and disabled SSH. :frowning:

2018-11-18 14:55:05,309 - main - ERROR - WdHwDaemon: Daemon failed with PMCCommandRejectedException: ; exiting
2018-11-18 14:55:11,733 - main - ERROR - FanControllerImpl: Overheat condition requires immediate shutdown

The happy solution is to use the fork of wdnas-dl2100-hwtools (which took me hours to find :roll_eyes:): https://github.com/WDCommunity/wdnas-hwtools

Here’s how to create an installation drive from macOS:

Format a USB drive using Disk Utility:
Format: MS-DOS (FAT)
Scheme: Master Boot Record

$ hdiutil attach -nomount debian-9.5.0-amd64-netinst.iso
/dev/disk3              Apple_partition_scheme
/dev/disk3s1            Apple_partition_map
/dev/disk3s2            Apple_HFS
$ mkdir -p /tmp/debian-installer
$ mount -t cd9660 /dev/disk3 /tmp/debian-installer
$ cp -L -R /tmp/debian-installer/. /Volumes/UNTITLED/
cp: /tmp/debian-installer/./debian: directory causes a cycle
$ umount /tmp/debian-installer/
$ hdiutil eject /dev/disk3
$ cp preseed.cfg /Volumes/UNTITLED/
$ cp grub.cfg /Volumes/UNTITLED/boot/grub/
$ diskutil unmount /Volumes/UNTITLED/

Hehe, sorry again :slight_smile:
I’ll add the link to the original guide. I didn’t do it yet as editing the posts makes it a bit more difficult to follow this thread. I’ve barely tested my fork (even though it has the required changes to use it on a PRx100).

Thanks for contributing the instructions for macOS!

Edit: regarding your kernel issues: you need the kernel headers, image and source of the same version (linux-header-xxx, linux-source-xxx and linux-image-xxx). Check your /boot/grub/grub.cfg and current kernel with uname -r: my guide requires you to run the same version as you’re building for.
Or simply use @dswv42’s kernel…

I added some new features in the wdhw tools:

  • Set the LCD text and brightness with the wdhwdaemon.client module
  • Run scripts when buttons are pressed
  • Added a dsm branch. Note that I won’t make a guide nor provide support on this subject.

Cool, thank you!

WARNING: this doesn’t work. To be updated in the future.

Instructions to run the installer in a local VM, installs debian to a local disk. Then plug the disk to boot the My Cloud device.
FIrst make sure the usb flash drive is not mounted anymore.
Then create a file with the full preseed config from the first post. It needs to be named preseed.cfg, otherwise you’ll need to use extra-args for the kernel.

sudo apt install qemu-kvm libvirt-bin virtinst
sudo virt-install --name wdnas \
           --memory 256 --boot uefi \
           --location=http://ftp.be.debian.org/debian/dists/stable/main/installer-amd64/ \
           --disk /dev/sdc \
           --initrd-inject ./preseed.cfg

Note: select a nearby ftp mirror from https://www.debian.org/mirror/list

When the install finishes you can install the WD hw-tools and OMV and whatever you like, no need to use SSH even.
When you’re done, shutdown the VM

sudo virsh destroy wdnas
sudo virsh undefine wdnas

Unplug the drive from your pc and plug it the My Cloud NAS. Boot the My Cloud NAS and enjoy!

1 Like

Hi :wave:

I tried the QEMU install on USB but I never managed to make the NAS boot from USB.
I tried every ports (the front one and both back).
Een when I remove the 4 hard drives, the NAS still boot on the internal firmware and never boot from the USB stick (GPT formatted, using a Debian Stretch bootable system).

Is there something to do to be able to boot from USB ?

Hello.
Thanks for everyone hard work. :slight_smile:
Been following forums and github for months now. My WD dl4100 did the crash again and cold not find the firmware. Got it working and backed up everything. Then installed debian 9 via serial and then OMV. Setup everything and was ready to dive into Micheal Rolands github for x64 WD systems. Everything was kind of secful after the script would not run because of the double brackets. Ran the script and it deleted the files from wdhwd install dir. After recreating all the files and scripts, the script kept handging so I did it by hand. Got it in and running. Rebooted her and the daemon won’t run. here is my error.
2018-12-29 19:21:56,285 - main - ERROR - WdHwDaemon: Daemon failed with SerialException: Could not configure port: (5, ‘Input/output error’); exiting

any help to get her running correctly would be greatly appreciated.
Thank you
Tony

@noirbizarre I used the libvirt installation to deploy Ubuntu 18 (which needed some additional steps) and only did a quick run with Debian without running it on my NAS. I’m also having troubles with booting so I’ll revisit that post when I figured it out.

@Tonysch on a DL4100 you need the original configuration by Michael Roland, as my version for the PR2100/PR4100 has some other parameters. First try to use screen to validate communication with the PMC. For a DLx100 it is

screen /dev/ttyS0

Type VER and STA a few times, it should show 0x6A or 0x6C.
Then get the wdhw tools somewhere in your home directory. Copy what you need to /usr/local/lib/wdhwd like the instructions are indicating.
I’d recommend to start with a sudoers file without shutdown rights (if you run as wdhwd user) or comment all shutdown calls in the daemon.

Thanks Tf1.
Followed your suggestions and output of screen on ttyS0 was VER=WD PMC v19 VER=WD PMC v19. So I copied over the files from MR DL2100 github. Followed his install file. On reboot my system fan and power light are correct.
I viewed my wdwhd log file and ]
2018-12-30 10:14:25,737 - main - ERROR - WdHwDaemon: Daemon failed with PMCCommandRejectedException: ; exiting
Also my LCD buttons are not working.

Thanks again for your help. :slight_smile:
Tony

If fan and power light are fine, it means the service works as intended.
I also get the failure on boot… seems like an initialization issue, I’ll create a github ticket for that.
Possibly resolved with pcm_test_mode=on in the config file.

To get LCD buttons working, checkout my fork but make the necessary changes in the config file.

Feel free to create tickets on github if you have other questions.

Here’s how I got it working.

I also hardened the wdhw tools install script a bit… please let me know if you still face issues.