How-to: Debian on MyBook White Light

Summary:

Install Debian on the MBWE White Light without unplugging the hard drive(s)

 

his will install debian on the mybook white light.

Update 2010-02-11: v2.1 released.

— Disclaimer —
All information and files are provided "as is" without a guarantee of any kind.

— Installation Procedure —
If you want to upgrade from a previous version of my firmware, check out this post. Otherwise, if you're still running the original vendor's firmware, do the following to install debian:
1. Download one of the images here. There are both lenny and squeeze versions avaliable.
2. Extract the upgrader by running

mkdir /var/upgrade/
tar xzf debian-*-for-white-light-v2.1.tar.gz -C /var/upgrade/

3. If you want, verify that nothing's become corrupt

md5sum -c /var/upgrade/upgrade.md5

4. Perform the upgrade by running

sh /var/upgrade/upgrade.sh

It will take a few minutes to install, please be patient and do not unplug the device or press the power button.

— Things you should know —
- The installed system is extremely minimal. You will have to use apt-get to install extra software for things like nfs, ftp, smb, etc.
- Any data on /dev/md2 should remain untouched and intact (although backups still don't hurt). In debian, it will be mounted on /mnt/data/ by default, edit /etc/fstab if you don't like this.
- The default root passwork is "mybook", but please change it with the "passwd" command.
- The default network configuration is DHCP, edit /etc/network/interfaces if you use a static ip.
- The default mirror for apt is ftp.debian.org, you can change it to somewhere closer to home in /etc/apt/sources.list (at least change it to ftp.##.debian.org where ## is your country code). You should run "apt-get update" as soon as you install, whether you change the mirror or not.
- The IP address of your mybook shouldn't have changed, but if it has, find it using your router's configuration page or an ip scanner.
- If your mybook still has the same IP, the ssh on your PC will refuse to connect because the mybook will be using new ssh keys. You can fix this by running "rm ~/.ssh/known_hosts" on your Linux PC. Putty probably doesn't have this problem, but I haven't tested it.
- Debian doesn't seem to be able to restore the system time from the RTC clock on startup, so ntpd is installed and will set the clock on every startup. Also, the timezone is not set, so all times are given in UTC. You can set the timezone by running "dpkg-reconfigure tzdata".
- By default, one LED is on at all times, even when you power the device down. I disabled the LEDs on my own device by putting "echo 15 > /sys/class/leds/oxnas-wd810-leds\:st/brightness" in /etc/rc.local.
- If you hold the power button down for less than 3 seconds, /etc/rc.power_button_short_press is executed. If you hold the power button down for more than 3 seconds, /etc/rc.power_button_long_press is executed. By default, both those scripts just turn off the LED's and run the "halt" command, but customize them if you want.
- /dev/md3 remains untouched but has no use in debian, you can delete it if you want but it's probably easiest and safest to just leave it there (it's only 1GB after all). Also, if you ever want to use the upgrade mode of the mybook again, it will look for an upgrade image at {md3}/upgrade/rootfs.arm.ext2, so I recommend keeping it.
- The recovery button will execute /etc/rc.recovery_button if it's held down for 3 seconds or longer. By default, this script will reinstall debian, wiping any changes you may have made since first installing. This will only work if you don't delete /dev/md3.
- This is optional, but you should probably regenerate your SSH keys. Do this by running

rm /etc/ssh/ssh_host_*
dpkg-reconfigure openssh-server

Do not run the rm command without the reconfigure command or else ssh will no longer work!
- The images run on the original vendor's kernel, which is very old (2.6.24.4). Unfortunately, squeeze's udev refuses to run on such an old kernel so the squeeze image actually has lenny's udev installed and apt-get has been told not to upgrade udev.
- The hard drive does not spin down (go into 'standby') as often as it should because various programs are constantly writing logs and performing other actions. This is not a major problem, but I'm planning on writing a short guide about how to get the device in stand-by mode as often as possible. I'm hoping to release the guide before the end of Feb 2011, depending on how much free time I have. I recommend you check back for it because it will slightly reduce power consumption, noise and hard drive wear.

— Root filesystem generation script —
The script which I used to generate the root filesystem can be found here. It is intended mainly as a demonstration of how to get a proper linux distro working on the white light, in case you want to get a different distro working. However, it can be used to install debian if the above link goes dead.

— Other guides —
How-to: Install Debian on a Clean Hard Drive for the White Light - do this if you've bricked your mybook or if you want more than the default 2GB of space for the root filesystem.
Coming soon: How-to: get HDD spin down working

— References —
http://zeroone.homeunix.net/~blip/computer/mbwe/ [only online during certain hours]
http://devnull.samersoff.net/pub/MyBook_me/
http://mybookworld.wikidot.com/forum/t-163056/mylenny-firmware
WD GPL source code

A huge thanks to the people behind those resources :)

— Change Log —
v1.1
- Disabled fsck in /etc/fstab. If you're running v1.0, replace any 1's on the end of any line in /etc/fstab with 0's. If fsck runs, it could pause the boot process waiting for user input which cannot be provided.
v2.0
- Completely new installation procedure that doesn't require an official WD upgrade first
- The IP address of the mybook shouldn't change after installing debian
- The power button and recovery button now work [thanks to ilovemynas for the initial implementation on the blue ring and to alllexx for helping implement it on the white light]
- ntfs-3g is installed by default
v2.1
- added kernel modules to support mounting nfs and windows shares [thanks to bourgeoa for making me look into this]. Note that you'll still need to install packages like nfs-common, portmap, smbfs and smbclient before you can actually mount any shares.

I'd love to hear any feedback, suggestions or bug reports.

http://mybookworld.wikidot.com/forum/t-304045/how-to:debian-on-mybook-white-light