Home Blog CV Projects Patterns Notes Book Colophon Search

MyBook World

5 Jun, 2008

I've been hacking the MyBook World Edition recently (it runs a fairly standard linux with LightHTTPd, Perl etc). Here are some notes.

First, here is the main site with all the tips: http://mybookworld.wikidot.com/hacks-and-howto

Installation

Follow either of the two setup methods. I used this:

http://martin.hinner.info/mybook/sshaccess.php

You need to create a user first though and then log in as that user. In my case that meant SSHing in as JAMES@... because the username was created in upper case.

Installing the Software

You don't need the included CD-ROM at all. The MyBook runs samba already so you just mount the share as normal using the username and password of the user you set up. For example on the Mac in finder you choose Go->Connect to server and type smb://<ip-address>/PUBLIC to mount the PUBLIC share which is already created. Files created here are actually stored at /shares/internal/PUBLIC.

Because the MyBook supports SSH once you've set it up you can also mount the drive via MacFUSE.

Since you aren't using MioNet it is possible to disable it http://martin.hinner.info/mybook/disable_mionet.php. The script is a bit longer on more recent MyBook World's like mine but the line to comment is still there.

Copying Files

Copying files to the MyBook is very slow over Wifi with Samba (1TB is a lot of space after all) but using rsync seems a little faster than samba. Using a network cable is a lot faster. It would be nice if Western Digital threw in a USB cable for the 150 pounds but they don't so I'm not sure how fast transfers would have been over USB. Either way it can take a couple of days of transferring files to fill the MyBook.

Dynamic DNS

The file is shown below:

# Basic configuration file for ddclient
#
# /etc/ddclient.conf
daemon=600
cache=/tmp/ddclient.cache
pid=/var/run/ddclient.pid
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
login=mybook
password=xxxxxx
protocol=dyndns2
server=members.dyndns.org
wildcard=YES
mybook.dontexist.org

You can also install ddclient as a package I believe. One thing to note is that if for any reason the network isn't working when the MyBook is turned on, the program won't be able to update the IP and since we're not running it as a daemon it won't keep checking so you will be left with the domain pointing to an IP address which isn't correct.

Useful Links:

Tip

For testing on a Mac OS X Leopard you can flush the DNS cache with dscacheutil -flushcache

Static Routing and Port Forwarding

Once dynamic DNS is working you will probably want to be able to access the box from the outside world. If you have plugged the MyBook into your home network you are almost certainly running behind a NAT router which is responsible for routing requests sent to the IP of the ADSL modem to the correct IP of the home private network. This means that the IP just assigned via dynamic DNS is the IP of the ADSL modem/router, not the MyBook so you can't yet access the MyBook from outside the home network to do this use port forwarding,

Log in to your router's admin web interface (it will be on port 80 at the IP the dynamic dns configuration has just set) and look up the LAN clients. There will be one with a hostname of MyBookWorld. Now go to the port forwarding screen of the web interface and forward port 22 to the IP address of the MyBook. Now all requests to the router on the SSH port will go to the MyBook so you can access it from the outside world.

The MyBook gets its IP address via DHCP so every time you turn off your router and MyBook you might get a different IP address on the local network. To fix this go to the MyBook's web interface and run the networking wizard to set up static routing. Choose the IP address the MyBook already has (or another one if you don't mind setting up port forwarding again) and be sure to enter the IP address (on the local network) of the ADSL modem/router (usually 192.168.1.1 or 192.168.0.1) in the gateway section otherwise the dynamic DNS client won't know how to resolve domain names and will therefore fail.

Tip

Setting up things manually via /etc/network/interfaces doens't work since these settings seem to get over-written.

Setting Up Package Management

feed=http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable
ipk_name=$(wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}')
wget $feed/$ipk_name
tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
sed -i -e 's|/stable|/unstable|' /opt/etc/ipkg.conf

Add a new library path:

echo "/opt/lib" >>/etc/ld.so.conf
ldconfig

Check it is there:

ldconfig -v

Then it's all fun:

Update local feed lists - you need to issue this from time to time to get package updates:

/opt/bin/ipkg update

See what's available, sort descriptions included:

/opt/bin/ipkg list

See what's already installed:

/opt/bin/ipkg list_installed

Install or upgrade packages:

/opt/bin/ipkg install <foo> <bar>

Installing Python

I want to install Python 2.5 so I type this to output all packages with python in the name or desciprtion:

/opt/bin/ipkg list | grep python

The package I want is called python25 so it is installed like this:

/opt/bin/ipkg install python25

The downloading part seems to take a long time, maybe the packages are on a slow server:

[root@MyBookWorld ~]#   /opt/bin/ipkg install python25
Installing python25 (2.5.2-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/python25_2.5.2-2_arm.ipk
Installing readline (5.2-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/readline_5.2-2_arm.ipk
Installing bzip2 (1.0.5-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/bzip2_1.0.5-1_arm.ipk
Installing openssl (0.9.7m-4) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/openssl_0.9.7m-4_arm.ipk
Installing libdb (4.2.52-3) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/libdb_4.2.52-3_arm.ipk
Installing zlib (1.2.3-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/zlib_1.2.3-2_arm.ipk
Installing sqlite (3.5.9-1) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/sqlite_3.5.9-1_arm.ipk
Installing ncurses (5.6-3) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/ncurses_5.6-3_arm.ipk
Installing libstdc++ (6.0.3-6) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/libstdc++_6.0.3-6_arm.ipk
Installing ncursesw (5.6-2) to /opt/...
Downloading http://ipkg.nslu2-linux.org/feeds/optware/gumstix1151/cross/unstable/ncursesw_5.6-2_arm.ipk
Configuring bzip2
update-alternatives: Linking //opt/bin/bzip2 to /opt/bin/bzip2-bzip2
Configuring libdb
Configuring libstdc++
Configuring ncurses
update-alternatives: Linking //opt/bin/clear to /opt/bin/ncurses-clear
Configuring ncursesw
Configuring openssl
Configuring python25
Configuring readline
Configuring sqlite
Configuring zlib
Successfully terminated.
[root@MyBookWorld ~]# /opt/bin/python2.5
/opt/bin/python2.5: can't load library 'libpython2.5.so.1.0'
[root@MyBookWorld ~]# ldconfig
[root@MyBookWorld ~]# /opt/bin/python2.5
Python 2.5.2 (r252:60911, Feb 26 2008, 19:30:31)
[GCC 3.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Notice that I had to run ldconfig again before the python2.5 executable worked. I also link /usr/bin/python to the current executable so I don't have to keep typing the path to /opt/bin:

[root@MyBookWorld ~]# ln -s /opt/bin/python2.5 /usr/bin/python
[root@MyBookWorld ~]# python
Python 2.5.2 (r252:60911, Feb 26 2008, 19:30:31)
[GCC 3.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

Edna MP3 Server

wget http://surfnet.dl.sourceforge.net/sourceforge/edna/edna-0.6.tar.gz
tar zxvf edna-0.6.tar.gz
cd edna-0.6.tar.gz
cp edna.conf edna.conf.bak

Then edit edna.conf to set the paths to look for MP3s. Mine was:

# Unix example:
dir1 = /shares/internal/PUBLIC/Music = MP3 CDROM

Now serve it:

[root@MyBookWorld edna-0.6]# python edna.py
edna: Ogg Vorbis support disabled, to enable it you will need to install the "pyogg" and the "pyvorbis" modules
edna: serving on port 8080...

and visit the server at http://<your-myboook-ip>:8080/ It does run very slowly but it works.

Copyright James Gardner 1996-2020 All Rights Reserved. Admin.