This guide will step you through the process to install Debian 7 to either a new hard drive or to replace the original OS of your MyBookLive NAS.
I built this guide after researching multiple sources trying to get a detailed step by step, but all of the sources I found either built off other guides with confusing instructions or were very broken and hard to follow. So this is what I have come up with. I’ve tested this many, many times as I was changing configurations and just trying out different things to see what the MyBookLive could handle and a lot of the time it ended with the system no longer responding on the network. Since I don’t have a JTAG device to access the device I have just found it easier to just reload the drive with a new system.
There are some limitations to what you can load onto the drive since the processor is a PowerPC, but the stuff that could be loaded in the OS makes it a pretty useful network device.
WARRANTY WARNING: The following steps will void your warranty, if you still have one!
There are steps to reset your drive back to factory if you so desire to, a quick search on Google will guide you through that.
DISABLE ANY AUTO RESTART APPLICATIONS on your host system. I’ve had this happen a couple of times where the host system installed new updates and decided, hey there isn’t anything going on let’s restart your computer! Nothing is really lost, but it leaves you wondering where at in the processes did it restart!
You need to be able to connect to the hard disk and therefore you must open the MyBookLive case. There’s a nice video how to do this on YouTube.
Debian Linux 8 – 64bit (Either a physical system or through a virtual machine) installed.
NOTE: All of the code listed below is done from a virtual machine setup. You will need to make sure that you attach the hard drive to the virtual machine.
USB to SATA Unless you can connect your drive directly to your computer Note: Depending on how old your USB to SATA adapter is you might noticed when you go to partition the hard drive the drive size is only reported as about 750GB, this doesn’t stop anything but you will want to wait on making all of the partitions on the hard drive since you technically won’t be able to configure all of the space during the initial setup.
Active Internet Connection (You will be downloading files from the internet, so this is important)
If you run into major problems it is also very helpful to attach a serial converter to debug the boot process. Again you can search online to find out more information about this. Otherwise you can connect the drive to your computer to look at the logs and figure out where the problem is during boot up are.
Partition the hard disk
Partition your hard disk with GPT partition table e.g. using parted or gparted if you have the gui installed.
I created a 10 Gb EXT3 disk for the system as the first partition, you are welcome to create whatever size you’d like but I recommend no less than 5 GB.
Note: The actual drive letter of the hard drive might be different based on the amount of other hard drives you have connected to your system. Just substitute the drive letter in the commands below.
user@debian:~$ sudo parted /dev/sdb
(parted) mklabel gpt
Partition Name? ? (optional, I entered OS just for reference)
File system type? [ext2]? (press enter)
End: (this is up to you, if you want 10 GB enter 10.00GB)
user@debian:~$ sudo mkfs.ext3 /dev/sdb1
If you are using a USB to SATA adapter and it isn’t showing you the correct volume size then you need to wait on creating the other partitions later.
Otherwise, create a second partition that is ext4 that uses all but 1 GB of space and then create the swap partition of 1 GB at the end of the drive.
If you didn’t follow the first guide on setting up your Virtual Machine, then you will need to complete the following command. If you setup your Virtual Machine using the guide, then you can skip this next command and move on to the mounting of the partition you just created.
You should have partitioned and formatted your hard disk by now because you need to mount the partition next.
The directory “mbl” used below is just an easy reference, you can make the directory whatever you’d like. But I found this to be the easiest because it is short. You will be using the path a LOT! So if you decide to use a different directory name, just use it in place of the “mbl” that is used throughout this guide.
No status will be shown, you will just be back at the command prompt.
Configuring the new system
The system you have just created needs a few tweaks so you can use it for specific tasks.
Change the MyBookLive hostname
Your new system will assume the name from the computer that you used to build the OS for the MyBookLive. For example I named my virtual machine installation “debian” so looking at the hostname file on the new system will show the same hostname.
user@debian:~$ sudo vi /mnt/mbl/etc/hostname
Of course you can change the name to whatever you’d like, just as long as it is something different than any system on your network.
Mounting dev and proc:
This step is needed for the next steps to work properly
user@debian:~$ sudo mount -o bind /proc /mnt/mbl/proc/
user@debian:~$ sudo mount -o bind /dev /mnt/mbl/dev/
Chroot into the new system
This command will launch a CHROOT environment of your new OS allowing you to interface with the new system as if it was currently running. This is very important!!!
One of the first things I did was to set the password for the new system, this will be the root password. Change it to something that is secure, unless you just don’t care about security.
(I have not needed to do this step during the installation of Wheezy, this has to be done for Jessie. But I left it here for reference just in case!)
Newer versions of openssh in debian disallow password based login for the root user. Therefore we have to change the following line in /etc/ssh/sshd_config:
Alternatively, you can place the public part of your ssh key in /root/.ssh/authorized_keys.
Prepare /boot and compile a kernel
Compile a kernel according to the guide update using a cross compiler (one dos not need to build the modules, uImage is fine). Place the resulting uBoot image in /boot and the apollo3g.dtb from the original harddisk as well.
Create a boot.scr with the uboot-tools package as described in the original guide. Since the bootloader is on a separate flash, one doesn’t need to install it as on several other arm boards. Just as a warning – the default kernel config does not support booting using UUIDs as root parameter for the kernel.
Kernel & UBoot
Preparation and Patching
root@debian:/# mkdir /boot/kernel
root@debian:/# cd /boot/kernel
In our chroot, we now install all the tools we require for kernel building and creation of the u-boot bootloader entrypoint.
You will see a warning scrolling through near the end, it will go on for a while. Just let it go, this has to do with the certificates being installed. Since when are in a jailed environment I suspect that is the reason for the failure.
Download and patch the kernel
So I am going to put this information out there right away. I don’t know what is done differently on the kernel for the original OS for the MyBookLive to allow the mounting of a large partition but I have found that if you compile the kernel 2.6.32-65 as listed below you will NOT be able to mount a large partition. I have the 3TB MyBookLive and when it is all said and done I have about a 2.9TB partition for storage. So if you have a smaller MyBookLive hard drive, then you might be able to use kernel 2.6.32-65. I will list out the directions to compile a 4.0.x kernel as I have found files to compile kernel 4.0.x and has worked quite well! I suggest compiling 2.6.32-65, finish all the steps and then compile the 4.0.x kernel using the steps at the end of this guide. I think in my testing it didn’t work too well to compile the 4.0.x kernel now.
root@debian:/boot/kernel/linux-188.8.131.52# make distclean
root@debian:/boot/kernel/linux-184.108.40.206# make mrproper
root@debian:/boot/kernel/linux-220.127.116.11# make 44x/apollo_3G_nas_defconfig
root@debian:/boot/kernel/linux-18.104.22.168# make uImage
For good measures I also update the hosts file to reflect the name of the server.
root@debian:/boot/kernel/linux-22.214.171.124# vi /etc/hosts
I add a line just below the 127.0.0.1 line to reflect the static address and name I’ve assigned to this server.
Save the file and exit the editor
This will take you out of the chroot environment for the next step.
The final and kind of a pain step is to copy the apollo3g.dtb file to the hard drive, this is necessary for the system to boot up. The only way to get the file is to extract it from the image. It could be hosted somewhere for all I know, but it is just easiest for me to download the firmware file from WD, extract the package, mount the image and then copy the file to the hard drive. Yeah sounds like a lot of steps, but I’ve done it a bunch of times so… If you already have the file extracted somewhere then copy it to the /boot directory on your MyBookLive hard drive. Otherwise here are the steps I used to get it downloaded and extracted.
After you have copied over the apollo3g.dtb file to the hard drive you now need to unmount the partitions you mounted earlier before you disconnect the drive and mate it with the mainboard from the MyBookLive.
Once you have unmounted the partitions, then you can disconnect the hard drive (if you used a USB to SATA adapter) or shutdown your system to remove it from your computer.
Connect the Hard Drive back to the mainboard
Once you have the mainboard connected to the hard drive and secured to the hard drive, you can power it on to see if everything worked. The easiest way to find out is to start a ping to the address you assigned to it above. Once it starts replying then you should be able to SSH into the drive.
As I mentioned above you can now compile the 4.0.x kernel for the system. You will do this all via SSH (unless you have a serial device connected), otherwise you are free to customize the system as you like. You will need to finish the partitioning of the hard drive as I mentioned at the start, this is completely up to you on how you partition the drive.
(Optional) Compile 4.0.x kernel
These are the steps for kernel 4.0.x which will be performed from an SSH session
root@yourservername:/boot/kernel/linux-4.0.2# make distclean
root@yourservername:/boot/kernel/linux-4.0.2# make mrproper
root@yourservername:/boot/kernel/linux-4.0.2# make 44x/apollo_3G_nas_defconfig
root@yourservername:/boot/kernel/linux-4.0.2# cp ../kernel-4.0.x/config_mbl .config
root@yourservername:/boot/kernel/linux-4.0.2# make uImage
Aaron has an AS in Network Technology and a BS in Information Technology - Security. He has been active in the Information Technology field for almost 20 years and is always learning. He likes to tinker with devices and his home network experimenting and solving problems!