[GUIDE] How to install Ubuntu 18.04 Server on the My Cloud PR4100 NAS

This post may help:

I think you need to install grub-efi with the --removable flag. Also it’s best to pin your network interfaces.

Hi Tfi,

Yesterday evening I reinstalled everything again and at the end I made a ISO image of the Ubuntu USB.

Thank you for help and I will read your post :slight_smile: there is always something to lern…

Have a good day!
Best Regards

I’ve also got stuck recently because apt update … so here’s what I did to get out of it.

First a short introduction I want to keep as reference:

How to setup QEMU on mac

As of recently I’m working on a Macbook Pro.
I’m still learning the ropes a bit but slowly getting there.
After you got brew / ohmyzsh

brew install qemu

Get the OVMF debian package

Unpack and get the UEFI bios file.

ar -x ovmf*.deb
tar -xf data.tar.xz
mv usr/share/OVMF/OVMF.fd bios.bin

Power Down your WD NAS.
Attach your Ubuntu boot drive to your Mac.

diskutil list

It shows up as /dev/disk2
On a Ubuntu host, the commands are blkid and lsblk and the disk is usually /dev/sdb or so.

Debug your Ubuntu boot disk on your laptop

sudo qemu-system-x86_64 -bios ./bios.bin -boot menu=on \ 
   -drive format=raw,file=/dev/disk2 -m 2G -nographic

For me, it stopped in a GRUB 2 shell.

How to exit QEMU shell

To pull the virtual plug on your virtual machine, type CTRL-A and Q - Q

Check the current boot option

echo $root
(hd0,gpt2)

This is fine.
There are usually 2 EFI boot entries.

cat (hd0,gpt1)/efi/boot/grub.cfg

search.fs_uuid 302a9397-2593-11e9-bce8-525400123456 root hd0,gpt2
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg

cat (hd0,gpt1)/efi/ubuntu/grub.cfg

search.fs_uuid 302a9397-2593-11e9-bce8-525400123456 root hd0,gpt2
set prefix=($root)'/boot/grub'

Hmmmm… the ubuntu boot option doesn’t have the configfile command!
That’s probably the reason for the NAS not booting anymore.

Start the OS manually and correct it.
To do this, load the kernel and initialize the ramdisk manually.

linux /vmlinuz console=ttyS0,115200n8
initrd /initrd.img
boot

Once booted, login and fix the failed updates.

sudo dpkg configure -a

Fix the missing configfile line in ubuntu EFI grub.

sudo cp /boot/efi/EFI/BOOT/grub.cfg /boot/efi/EFI/ubuntu/grub.cfg

Fingers crossed!

sudo reboot

Hi all - have been having a lot of fun with this, but I did have some trouble getting the bonding to work. These are the steps I used to get it to work.


1 - Check if bonding is even on, turn it on, then set it to start automatically on boot

Used this link to get this to work: Click here

Run sudo lsmod | grep bonding … if you get no output, then bonding isn’t turned on!

Run sudo modprobe bonding … if you run sudo lsmod | grep bonding again after this, you should see bonding appear below.

To make sure bonding starts automatically on boot, run sudo nano /etc/modules, then add 1 line to the end of the file that simply says: bonding. Save and exit.


2 - Install ifupdown

Actually, I wasn’t sure if this was necessary. But, when I went to edit the file /etc/network/interfaces, I saw the following:

# ifupdown has been replaced by netplan(5) on this system.  See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
#    sudo apt install ifupdown

So I went ahead and installed ifupdown with sudo apt-get install -y ifupdown.


3 - Check name of current interfaces:

Used this link to get this to work: This link and this link

When I did this, I found out that “eno2” wasn’t even an interface on my system! Not sure how this happened, eno1 was present, but eno2 had been changed to “rename3”. Very weird. Bonding isn’t going to work if the interfaces have the wrong names.

To even check this, I ran a combination of:

lspci
and
ip link
and
ifconfig -a
and
ifconfig

lscpi showed me that I did have 2 ethernet interfaces, as expected. I believe ip link showed me that one of my ethernet interfaces was named “eno1” as expected, but the other was named “rename3”.

The important thing about ip link was that it also gave me the MAC address of the “rename3” interface. Example output:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 7a:73:df:33:26:a1 brd ff:ff:ff:ff:ff:ff
3: rename3: <BROADCAST,MULTICAST,DOWN,LOWER_UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether 7a:73:df:33:26:79 brd ff:ff:ff:ff:ff:ff

First, I brought “rename3” back up: sudo ifconfig rename3 up

To change the name of interface eno2 back from “rename3”, I did this:

Edit the “/etc/udev/rules.d/70-persistent-net.rules” file (if you need to create it, that’s ok):

sudo nano /etc/udev/rules.d/70-persistent-net.rules

Add the following line, based off the information you get from the output of ip link:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="<PUT YOUR DEVICE'S MAC ADDRESS HERE>", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="<PUT NEW NAME FOR YOUR INTERFACE HERE>"

So for me, it was: SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="7a:73:df:33:26:79", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eno2"

Save and reboot the system! sudo reboot

When the machine comes back up, run ip link again:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 7a:73:df:33:26:a1 brd ff:ff:ff:ff:ff:ff
3: eno2: <BROADCAST,MULTICAST,DOWN,LOWER_UP> mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000
    link/ether 7a:73:df:33:26:79 brd ff:ff:ff:ff:ff:ff

Yay! I went ahead and ran sudo ifconfig eno2 up here to get the interface up. Ran ip link again to make sure this worked.


4 - Setting up bonding in netcfg.yaml

Firstly, make a backup of whatever your netcfg.yaml file is, in the directory /etc/network (for me, it was 01-netcfg.yaml)

sudo cp /etc/netplan/01-netcfg.yaml /etc/netplan/01-netcfg.yaml.bak

Edit netcfg.yaml: sudo nano /etc/netplan/01-netcfg.yaml

I changed my file to look like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: yes
      optional: true
    eno2:
      dhcp4: yes
      optional: true
  bonds:
    bond0:
      interfaces: [eno1, eno2]
      addresses: [192.168.1.14/24]
      parameters:
        mode: 802.3ad
        lacp-rate: fast
        mii-monitor-interval: 1

Please note how important it is to keep the indentation and spacing of everything the same as what is already in the file you have. You can also change the “addresses” ip address to whatever works with your network.

Save and exit.

Run sudo netplan generate to make sure there aren’t any errors.

Make sure your router is set up to accept a bonded connection, and a bonded connection in 802.3ad mode. If it isn’t, change whatever settings you need to to make that happen.

There is no netplan try for bonded connections. I tried, it gave me an error, I searched online for it and found that netplan try will never work to try out a bonded connection.
So, when you’re ready, run:

sudo netplan apply

I was ssh’d into my system, and this kicked me out of the system. I gave it maybe 3 minutes, and pinged to the IP address I had set above. When the pings started connecting, I re-ssh’d into my system.


5 - Checking if it worked

I was able to ssh back into my system, so that’s good! Ok, now I ran ip link again … this is what I got.

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno1: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP mode DEFAULT group default qlen 1000
    link/ether 7a:73:df:33:26:a1 brd ff:ff:ff:ff:ff:ff
3: eno2: <BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP> mtu 1500 qdisc fq_codel master bond0 state UP mode DEFAULT group default qlen 1000
    link/ether 7a:73:df:33:26:a1 brd ff:ff:ff:ff:ff:ff
4: bond0: <BROADCAST,MULTICAST,MASTER,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 7a:73:df:33:26:a1 brd ff:ff:ff:ff:ff:ff

ifconfig gave me more information than this, but everything seems to be working!

Hope this helps someone.

Yeah, the major issue is that the 2 NICs have the same ID. Systemd trips during discovery, causing them to be renamed, breaking your netconfig.
The udev rules fix it or use legacy ifnames=0 boot option.
But those are workarounds to use legacy udev hardcoded paths. The :sunglasses: solution would be to figure out how to make udev device discovery consistent.

1 Like

@Tfl Yes, the bonding is super finicky. I haven’t QUITE figured out how to get it to work completely, but I’m playing with it (when I’m not doing other things).

One option I was thinking might work is to actually get DHCP4 off for eno1 and eno2, so that they only have ip6 addresses and dont mess with ip4 addresses (and is consistent with stuff I’ve seen on other places online, and on the Ubuntu online manuals). So, the config file might end up like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
    eno2:
      dhcp4: no
  bonds:
    bond0:
      interfaces: [eno1, eno2]
      addresses: [192.168.1.14/24]
      parameters:
        mode: 802.3ad
        lacp-rate: fast
        mii-monitor-interval: 1

But right now, I haven’t figured out how to get that to exactly work.

Additionally, I had issues with DNS resolution, so I had to specifically define nameservers for my interfaces. I like cloudflare, which has IP addresses of 1.1.1.1 and 1.0.0.1. Gonna post my “real” config file in a second, but 2 small points first:

PLEASE NOTE: In the below code, there is a wifis section, which most of you should ignore. This is specifically for me and my system - I only left it before because there are some learning points there.

  1. Sometimes I take the USB out and run it on my laptop, and the interface name for my laptop wifi is wlp2s34. So, I put info in the 01-netcfg.yaml file to be able to use the wifi off my laptop if I’m running the USB stick on my laptop. That’s how I configured Ubuntu 18.04 to use the wifi correctly.

  2. People reading carefully will notice that under the configuration section for my wlp2s34 wifi, there’s a nameserver address which is 192.168.1.90. This is not a mistake but is specific to my network. If anyone copies my code, please do not include that address lol. That address points to a pi-hole on my network lol - I don’t think it’ll hurt you, but it won’t do anything for you. Just include the other two addresses, or better yet, change them to something you want instead.

     network:
       version: 2
       renderer: networkd
       ethernets:
         eno1:
           dhcp4: yes
           nameservers:
             addresses: [1.1.1.1, 1.0.0.1]
         eno2:
           dhcp4: yes
           nameservers:
             addresses: [1.1.1.1, 1.0.0.1]
       wifis:
         wlp2s34:
           dhcp4: yes
           optional: true
           nameservers:
             addresses: [192.168.1.90, 1.1.1.1, 1.0.0.1]
           access-points:
             "*****************":
               password: "****************"
    

@Tfl - I’d like to ask you:

  1. If you wanted to use bonding on my system (obviously ignoring the wifis section), how would you configure the bonds section? Basically, would you only put a nameservers section there under bond0, and not under the eno1 and eno2 sections? Any other options you would put under bond0?

  2. Also, the “fix” I did to get the eno2 name to stick like I talked about a few days ago - would you keep that fix or not? I’m not sure how that would affect anything, or not.

This has been a fun hobby, for sure! I’d like to try installing TrueNAS on the machine at some point, but messing w/ Ubuntu has been fun first.

Btw, I used virt-customize and virt-edit to make persistent edits and changes to the original image by @Tfl, for things I wanted to be on there every time I installed this image to a USB stick. You get these amazing tools by installing libguestfs-tools: sudo apt-get install -y libguestfs-tools

The changes I mage to @Tfl’s original image include things like pre-installing packages everyone needs when they run ubuntu (i.e, build-essentials), to pre-installing other packages I wanted like apt-fast and webmin, so I don’t have to reinstall these every time I burn the image to a new USB.

Might talk more about this later (especially because I had to do 1 specific thing to get the virtual machine inside of virt-customize to get DNS resolution to work inside of virt-customize, but that starts getting into more detailed ubuntu stuff, might be a little outside of what this forum is about.

1 Like

Sorry, I’ve been working on an other project to replace mksapkg … I’ll revisit the wdhw-tools when I’m done. vidmate insta save

Here’s my /etc/netplan/01-wdnas.yaml with a static IP
It uses my providers nameservers

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
    eno2:
      dhcp4: no
      optional: yes
  bonds:
    bond0:
      interfaces: [eno1, eno2]
      addresses: [192.168.10.200/24]
      gateway4: 192.168.10.1
      nameservers:
        search: [home, telenet.be]
        addresses: [195.130.130.5, 195.130.131.5]
      parameters:
        mode: 802.3ad
        mii-monitor-interval: 1

It depends on these /etc/udev/rules.d/70-persistent-net.rules

# add eno1
ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:01:00.0", NAME:="eno1"
# add eno2
ACTION=="add", SUBSYSTEM=="net", KERNELS=="0000:02:00.0", NAME:="eno2"

@Tfl - Excellent, quite helpful.

What are your thoughts on using Network Manager instead of networkd? And what about going to Ubuntu 20.04 instead of 18.04?

NM vs networkd – I didn’t really examine this and it’s been more than a year since I truly played with these configurations. I have a vague memory of networkd being the way to go… but don’t know anymore why.
I should have some free time this week so I want to migrate my wdcommunity website to OS5 at last. That’d be a good time to upgrade to Ubuntu 20.04 too.

1 Like

Thanks @Tfl @dswv42 ,I sucessed to install ubuntu server 20.04.2 LTS on my pr4100 follow this guide. I used proxmox ve instead of kvm, everything is OK

Hi @silenker, do you mean you have installed proxmox on you wd or used a proxmox vm for the ubuntu installation?

@potter-91 I used a proxmox vm for the ubuntu installation,after that I tranfer the disk image from proxmox vm and flash the *.img to a USB drive.
I use proxmox because it has a quite convenient GUI

I’ve created more detailed guide based on that, it also includes some automation: GitHub - aamkye/ubuntu_on_WD_PRx100: Ubuntu Server on WD PRx100 tutorial with extras.

I’m guessing this doesn’t work on mycloud os5 ? (no apt…)

Thanks for quick reply. Hmm OP’s guide seems like it uses apt to install kvm, than replace the entire underlying OS? Any way to get “apt” on os5?

It is quite some time since I was the last time here…
the default e-mail notification setting is no - what a stupid default value…

Since 2022 I have Proxmox running on my PR4100 (16GB RAM - rootfs on usb3 m.2 nvme)

It runs perfectly with a OMV, Home Assistant and NextCloudPi VM.

@potter-91, I am actually keen on getting some more feedback on that.
I am considering replacing the OS on m pr4100 and was considering proxmox or trueNAS.
Have you encountered issues with controlling the fan ? How straightforward was the installation process ?

sry for the later answer…
For the fan I am using the wdnas-hwdaemon - it works like a charm.

Regarding the installation: My Install was back in the PVE6 days. There the pve.iso was not capable to be installed over serial - since PVE8 it is (but not tested).
I have installed Debian over serial on it and after provisioning how I like my disk and partition layout I postinstalled pve.

I recommend that you build a serial cable for the NAS serial port (It is a JST-PH connector) to be able to access it if you misconfigured your network etc.
Also you can access the BIOS with it and can disable the internal mainboard flash that you do not accidently erase the stock OS.