Debian Buster with UEFI boot
This guide applies to WD My Cloud PR2100, PR4100, DL2100, DL4100.
I’m running Ubuntu 18.
Debian Installation in VM
Get the buster amd64 netinst iso from the official sources.
Get KVM
apt install qemu-kvm ovmf
Prepare work dir
mkdir isos && cd isos
Setup bios binary for UEFI support. See here for some more info.
cp /usr/share/ovmf/OVMF.fd bios.bin
Find your USB device, usually /dev/sdb or /dev/sdc. I’ll use /dev/sdX here.
lsblk
blkid
Now start a virtual machine with the buster ISO and your usb drive and 2GB of ram.
kvm -bios ./bios.bin -cdrom <buster.iso> -hda /dev/sdX -boot once=d -m 2G
It should boot with an image with “TianoCore”.
If you didn't see it, try this instead
kvm -L . -cdrom <buster.iso> -hda /dev/sdX -boot once=d -m 2G
Install Debian with the graphical installer.
My recommendation:
- setup your location for closer mirrors
- accept defaults for most of the other settings
- deselect the Debian desktop environment
- select SSH server and standard system utils
The virtual machine will boot from disk after the installation.
Prepare to run on WD NAS
Your drive now has Debian installed and it’s running as a virtual machine on your PC, but you need a few more fixes before plugging it in your NAS.
Some optional SSH tricks
To ssh into your qemu session, start the VM with these additional parameters
-net nic -net user,hostfwd=tcp::10022-:22
Source
Add this to your local ~/.ssh/config
Host qemu
Hostname localhost
User debian # adapt this to the user you created during install
Port 10022
Now simply setup your keys and then connect
ssh-copy-id qemu
ssh qemu
Root access (required for rest of the guide)
su
Alternatively, install the sudo package and add your user to the sudo group.
Setup Networking
Automatic
In the VM, create /etc/systemd/eth0.network
[Match]
Name=eth0
[Network]
DHCP=v4
Static IP
Create /etc/systemd/eth0.network
[Match]
Name=eth0
[Network]
Address=192.168.0.10/24
Gateway=192.168.0.1
DNS=8.8.8.8 # use a DNS server of your choice
Create a similar file for eth1
.
Now create udev rules to pin ethernet interfaces to eth0
and eth1
. Note the PCI addresses of your NICs first.
lspci -D | grep Ethernet
0000:01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
0000:02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)
Now create a udev rule to set the interface names. Create /etc/udev/rules.d/60-persistent-net.rules
# add eth0
ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:01:00.0", NAME:="eth0"
# add eth1
ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:02:00.0", NAME:="eth1"
Source
Update network driver
Add the non-free repo to /etc/apt/sources.list
(simply append non-free
to the first line)
apt update
apt install firmware-realtek
Setup bootloader
You need to help the PRx100 bootloader to pick up this disk.
Add this to /etc/default/grub
.
GRUB_CMDLINE_LINUX_DEFAULT="acpi_enforce_resources=lax console=ttyS0,115200n8 net.ifnames=0"
If you did create the udev rules for the ethernet interfaces, you may drop net.ifnames.
Run
grub-install --removable
update-grub
Shutdown the virtual machine and eject the USB drive.
Boot the NAS with the USB drive and ssh into your box.
Now install the kernel module for fan/lcd control.
Rename this attachment to 8250_lpss.ko and move it to /lib/modules/4.19.0.6-amd64/extra
8250_lpss.txt (420.2 KB)
depmod
modprobe 8250_lpss
dmesg | tail
Building the kernel module
First read this and you may need these extra steps.
Extra required packages to build kernel modules:
apt install bison flex libelf-dev libssl-dev
Also copy the System.map to your kbuild directory before using modules_install
cp /boot/System.map-$(uname -r) System.map
Enjoy.