Tuesday, July 22, 2008

the home media bug

Home Media Solutions
Anyone who has visited this blog before may now notice a strange change, 30 posts have disappeared and been combined into just a single one post.

Basically, in an effort to clean up the write up I've moved from doing what is effectively date based blogging,

(where reading from the top means that you're seeing solutions before the problems are discussed) into a much more article based write-up.

That's a limitation of using blogger to do project write-ups.

If the question is why I don't just move away from blogger, well...
I've tried free hosts before, and I've lost work when I haven't signed in for a while and the free host decides that I'm not using the site any more.
I've tried hosting at home, and relying on my own computer/internet connection doesn't end well. Either the computer or connection fails. or the site gets hammered and I can't get on-line reasonably at home, or I or other people in my house are using the internet perhaps excessively and the site become slow or inaccessible.
So in the best hacking tradition, I'm taking a tool, (an on-line diary/blog), and working around some limitations to provide me with what I want. It's not ideal, but it's fast, it's free, it's stable available and as it's owned by Google, it's unlikely to disappear overnight.

So here is a combination of posts that were made earlier, written and re-written to a shorter more concise format.

I'll keep (most of) the dates intact, this was almost a year of tinkering in my limited spare time.
Lets start from the beginning.

7/22/08 8:50am (The home media bug)

Well the long story short is that I've been well and truly bitten by the home media bug...
Suddenly taking CD's out of their cases, or loading DVD's into a drive seems like a little too much hard work, if I

Want to watch a movie in anywhere but the living room of my house I'll watch it on a computer, but sitting in bed. watching a DVD means that I don't want to have to get up, go downstairs, find another movie, get the DVD take it upstairs put it into the drive and remember to have to replace the DVD afterwards. This is the 21st century taking DVDs out of their cases seems a little, well, pedestrian.

So what to do...

Clearly the start point is to rip CDs and DVDs to the computer.

To rip MP3s I use the awesomely feature rich (and free) FreeRipMP3 available from http://www.freerip.com/
To rip DVDs I've been using a tool called DIVX Video Duplicator, this is not so feature rich, but it gets the job done. (Note from 2011, I've not started using Handbrake, which is better and works with windows 7).

The only trouble with ripping to a computer is that the files are only available on one computer, which is a little limiting, it means if anyone else in the house wants to watch a movie in bed they'd have to use my computer it also means that I need massive amounts of space, which just isn't really available on a laptop hard drive.

Network Attached Storage

The solution is to get a NAS device, that can plug into the network router and share films by either wired or wireless network straight to my computer and other people's computers in the house.
There are many solutions available however, I wasn't feeling too flush at the time and I went for the cheapest option, (which I later found out to be a mistake).
I bought a device called a LANDISK, this was on sale at the local maplin for a mere £30. I had a large spare IDE disk from my recently dead desktop computer, so this seemed like a great idea.

I bought the disk enclosure, plugged the disk in, formatted it, and created some file shares on it.

What these LanDisks have going for them is that they are cheap, have USB or LAN connectivity. and you can add some

security controls to the shares to have private and public files. As I later found out, going against these disks is: there's no cooling, there's no sound dampening, the Samba implementation on them is pretty cut down and an old version, the IDE to USB bridge isn't all that it could be.

But they are in a brushed aluminium case, and there are blue LED's so I was quite happy at first. (oooh pretty, oooh shiney, oooh blue light).

The blue LEDs are rather bright, and will illuminate a whole room in blue glow when the lights are out. but you can put the drive into the case upside down so that the LEDs are blocked by the case, admittadly you loose the indication of what's going on power and connectivity wise, but at least the room get dark at night.

With this NAS in place I can now access my media wirelessly all over the house, and added advantage is that the network storage lets me use stuff like synctoy (http://www.microsoft.com/download/en/details.aspx?id=15155) to keep my files on my computers backed up.

LanDisk
The Trouble With Wireless B
It might seem crazy now, but back in 2008 wireless B was ok for home internet, I didn't really share a lot of files between PCs, the internet was only a 2Mbps line, so 11Mbps wireless was perfectly fine for accessing the internet.
Anyway, wireless B is not fast enough for streaming media (DVDs at a decent resolution) wirelessly, it's enough for streaming music, or compressed video.

At that time my phone was an HTC Wizard running windows mobile (that I'd had for about 3 years), that only supported wireless B, so I bought a new Belkin wireless G router, and set it up to use both wireless B and G.

Home Media Bug Is Still Bugging Me
The thing with making something easy to use, is that it makes you realise how difficult everything else is.
Despite having ripped all my CD's and DVDs to this NAS box I'm still having to keep them out to watch them downstairs. What I need is a media PC...

Except I don't want a PC in the living room. PCs are big, and noisy, I don't have a lot of money to spend on this solution, so I'm not going to be investing in a new PC, especially not investing in a PC with the kind of specification I want, (nice sleek case, remote control that is like a normal TV remote, ultra quiet).

In the end I found a device called an Emprex ME1 on ebay for around £50, this came with a 200GB hard drive, is able to access network shares -to streak movies from PCs to the TV, the storage can be expanded by connectting USB drives, it can play video and music, and it can record TV. It's also tiny (not a lot bigger than a 3.5" disk), and has a remote control that looks and works exactly like a TV control.

The Emprex ME1

Out of the box, this is what you get...

A small box, silver in colour with a nice black front. it's just big enough to fit a 3.5" disk in.
It comes with a remote, which at first I thought would be pathetic as it is very slim and powered by only a coin cell (CR232?) type battery.

Also in the box you have the PSU and enough cables to choke anyone who tries to play with your new toy without your permission, but also slightly not enough cables... this is my only out of the box gripe. The unit is capable of doing HD, and thus has a HD out, the leads that come with the unit are RCA sockets at one end of the lead and 4 pole jack sockets at the other.

(much like the Ipod Video out leads).
the unit comes with 2, one has red/white/yellow for compasite video in or out
the other has red/green/blue leads for HD, the unit does comp video/audio in and comp AV out, and HDD out, all these are done with the 3.5mm jack sockets. (there are three holes, but only two leads).

The trouble is, that when using HD you'd use the HD red/green/blue lead to connect to your TV, and the use the other lead to take the audio out of the comp out... this leaves you without a lead to have cmp AV in... no matter, I don't have a HD TV (yet) so I just use the HD lead for composite AV in.

The unit has in terms of connections/sockets
a power socket
comp AV in
comp AV out
HD out
USB B (for connecting to a computer)
USB A (for connecting another disk/usb stick/memory card reader) as a slave to the main HDD

so far so good...

Emprex ME1
Turning the beast on
I say beast, but gentle mouse might be more accurate.

There are a few reports that fan noise is a problem with these units, that has lead people to run their drives naked without the shiny enclosure and disconnect the fan. I'm having no such trouble. the disk inside is quite, the fan is quiet. so it's all good...

For my first test I plug the thing into a TV and turn it on, it comes to life with a screen that simply says System

Loading . . .

The shows 4 icons that you can scroll between using the directional arrows on the remote.
video in, playback, browse and settings.
There is nothing on the device, so I plug it in via the USB to my computer...
The screen goes black.

OK, so you can't watch TV whilst uploading stuff to the device, not a big thing per-say... but if you're planning to watch TV, fed through the device, whilst you put on a film to watch after your show has finished. this could be a real problem...
So forgetting about that I put the network cable in. find out the IP address and try to browse to the device to upload a file...

No dice, this unit streams from the network, it doesn't let you browse to or from the device...

So it seems that (at the moment) there is no way to copy things to the device which watching TV.

Anyway, that aside, drop a movie file/mp3/picture onto the device when connected with USB.
unplug the USB and the system loading screen comes back,
now I can use the browser to browse to and watch/listen to my files...
good stuff...

Space issues
That's the brilliant thing, with the device able to stream from the network/other usb devices there are just no space issues. The drive in the device is a 200GB drive. split into a fat32 partition that a windows computer can see, the rest are linux partitons (a clue to what makes the little thing work).

The FAT32 partition is about 90GB, so I already know from running out of space on the 80GB NAS drive that I can't squeeze all my media onto the box, but the NAS devices that I have should enable me to have the rest of the media not located on the box.
The recording partition is again about 90GB, this is 137hours of recording in the SLP quality.
and about 32 hours in High quality (hd I assume). There are some other recording qualities, off the top of my head I think is HQ SP EP LP and SLP quality of the recording dropping as the list decreases, but the amount of recording hours increasing.

So I have enough space for 137hours of TV, (that's a fair few series of whatever you want to watch there,) and 90GB is about enough room for a hundred of so 700MB DVD rips, the player can play DIVX files and these files do actually scale quite well to a 26" TV.

If you run out of space on the recording drive, the box has a menu driven way of transferring recordings to the PC accessible partition to move them elsewhere. (once you've brought the box to your PC though, or your PC to the box,

(only really practical with a laptop)).


Do what I tell you to do!

Well, the relatively simple life of a box that just works wasn't going to last long was it!?
So the great rush to change everything about it starts...

I'm in no way going to claim that I've figured it all out... just extensively Google searched stuff...

first the box does run Linux. and you can telnet to it... (I did find this out by port scanning it -it's also running a web server).

yes that's right Telnet.. it's running linux, my IT snobbery makes me just want this to run SSH, I'll see if I can change that later.


Uploading content to the box
So the first grip I had was uploading content to the box.

I'd found that the partition that you can see when the device is attached via UBS to the computer wasn't shared on the network share, in fact nothing was shared on the network, the network port is for streaming to the box only. there is no file server.

There does appear to be a way around this.

The way I found myself was to turn on the FTP server on my LanDisk NAS boxes (that's right, plural, I bought another one) and make the directories on there as well as SMB type shares, also FTP shares as well.

Now I just need to telnet to the box and issue the following commands.

ftpget -u [username] -p [password] 192.168.0.99 "/mnt/hda/music/RATM/RATM/killing in the name.mp3"

"/music/RATM/RATM/killing in the name.mp3"

the quotes are needed as there are spaces in the filenames.

Once this command is issued the ME1 box silently logs into the NAS box via FTP and copies the files.

This is frankly a pretty rubbish solution, and it's not one that's friendly to the less tech savy... ...not that I'm that tech savy myself.


Headaches...

Getting this box to work properly (well the way I want it to) is now becoming a headache.

Basically, the first problem that I had with the box was opening shares on my NAS box(s).
The ME1 fresh out the box has the rather strange setup that on the browser screen you can choose NET.
The box then goes off in browser mode and looks for devices on the network, it's flakey to say the least, sometimes it finds the workgroup and devices inside the workgroup, sometimes it doesn't even if it does find the workgroup, and you open the folder workgroup and to your delight you get greeted with the folders

/workgroup/myPC
/workgroup/NAS1
/workgroup/NAS2

when you click on the links you sometimes get a folder listing, sometimes not.
and even if you do get a folder listing,

e.g.
/workgroup/NAS1/films
/workgroup/NAS1/music
/workgroup/NAS1/tv

when you browse into the folders they are empty.
I'd have thought this was a permission error, (except there are no permissions/usernames/passwords setup on my NAS boxes).

but the ME1 has a solution. you can add shortcuts.
from the setup menu, you can add shortcuts and add a username and password, so this gets around the flaky browser problem because you can access your shares, however, you can only add one shortcut. shame, cause I've got two NAS boxes...


Multiple shortcuts
I guess the lesson learned here is to make sure that you run the latest version.

I've found that there is updated firmware for the ME1, and this will let you use multiple shortcuts for accessing remote disks.
All you have to do is get the firmware from the Emprex website

http://www.emprex.com/03_support_02.php?pg_no=10&group=84&kind=1

you then put it onto a USB drive. (unzipped in the root folder)

unplug the device power, plug in the USB drive with the firmware update on it, then put the power back in whilst

holdng the power button.

bonza...

unless your USB drive is an Ipod shuffle original version. these can and do act as lovely 1GB pen drives. Unfortunatly there aren't linux drivers for these loaded onto the box, so if you do want to upgrade the firmware you'll have to use something else that does have Linux drivers.
Also the NAS box from Maplin didn't work when plugged into the USB socket, so I guess there are no drivers for these either.

Eventually I borrowed an external HDD and found that it did work. One of those grey Seagate boxes.
So now I have updated firmware I can add multiple shortcuts.
No more having to go back and forth through menus to access the shortcut properties screen...
(and even more helpfully.)

BUT...
Now the device tells me when I try to browse to the shortcut that there is a permissions error...

So I'll have to have a look at what the username/password might be.

I seem to remember (because I got my NAS boxes before I got my ME1 box) that there was a popup box asking for a password and I just typed password...

The default would have been guest and then password.

I tried this and it didn't seem to work, but the unit helpfull suggested that the username might be Guest, (rather than guest).

I tried that, also didn't work...

Well... that's great, I can now map multiple non-working shortcuts... (my life is complete)...


Uploading more content to the box.
After the frankly pathetic idea of using FTPGET and FTPPUT to manage uploading and downloading content to and from the box, I've now discovered the obvious solution.

Make the ME1 box a samba server.

credits to this guide go to this site
http://rtd1261.wikidot.com/forum/t-51556/autostart-of-samba-on-me1-install-guide


I recently followed the guide on the blogspot of the ME1 to install a debian image and a samba server to my ME1.

(makes it act like a NAS)
Unfortunatly this requires you to log in to the box and chroot each time you power cycle, I have written a little startup script that you can hook into the /usr/local/etc/rcS file that chroots and starts the samba server automatically each time you power cycle the box.

Here is a complete guide (allows copying and pasting ;))
I've enclosed the commands to be done in the telnet window by —— to make it easier to understand the commands.
Each command is one line and they must be done one at a time.

Some of this has been directly copied from the blogspot page (http://emprex-me1.blogspot.com/2008/03/setup-me1-as-bt-downloader.html)

So first download the debian environment from:
http://cid-09ea019cecf560ad.skydrive.live.com/self.aspx/Set%20up%20ME1%20as%20a%20BT%20dwonloader

unzip it to the fat32 partition on the ME1 when connected through USB. (the fat32 partition is the one you put the videos on)

In Windows, go to the Start menu, select Run,at the command line, type
telnet 192.168.1.3

Assuming the ME1's IP address is 192.168.1.3
The login is just 'root' and doesn't require a password

The IP of the ME1 can be found in its setup page.

So to start:

cd /usr/local/etc/hdd/volumes/HDD1/
mkdir chroot
mount -o loop -w ./debin-4g.ext2 ./chroot
chroot ./chroot
mount -t proc proc /proc

now you need to find out what your hard disk is assigned to:

fdisk -l

should give you something like this:

Disk /dev/hdb: 320.0 GB, 320072933376 bytes
255 heads, 63 sectors/track, 38913 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 2 34049 273490560 b W95 FAT32
/dev/hdb2 34050 35097 8418060 83 Linux
/dev/hdb3 35098 38857 30202200 83 Linux
/dev/hdb4 38858 38909 417690 5 Extended
/dev/hdb5 38859 38878 160650 82 Linux swap / Solaris
/dev/hdb6 38880 38899 160650 83 Linux

so my fat32 partiton is /dev/hdb1, on the blogspot his was hda1, whatever yours is whenever /dev/hdb1 is mentioned

replace it with the appropriate letter.

mkdir /mnt/hdb
mount -t vfat /dev/hdb1 /mnt/hdb
apt-get update
apt-get install samba

Answer all the defaults to the questions samba asks, it doesn't matter as I have my own config file.
Which we will setup now:

rm /etc/samba/smb.conf
nano /etc/samba/smb.conf

Paste the following into that nano window, nano is a nice standard text editor.

#
[global]
workgroup = workgroup
netbios name = ME1
server string = video-server
include = /etc/samba/dhcp.conf
dns proxy = no
log file = /var/log/samba/log.%m
max log size = 50 syslog = 0
guest account = root
security = share
encrypt passwords = false
hide unreadable = yes

[ME1 HDD]
comment = NAS Video Share
path = /mnt/hdb
read only = no
public = yes
veto files = /chroot/debin-4g.ext2/
#

Change the workgroup above to be whatever your windows workgroup is
Then press ctrl+o and ctrl+x to save and exit.
Now to restart the samba daemon and see if the share works:

/etc/init.d/samba restart

What a few minutes and with a bit of a luck you should see the ME1 on your windows network and within that you should see your Video share folder.
Now its time to setup the auto boot script.
First we need to add the drive info to the fstab to make it easier to mount:

nano /etc/fstab

and paste the following line at the end of the file:
/dev/hdb1 /mnt/hdb vfat defaults 0 0

Obviously changing to /dev/hdx1 if yours is different.
Now that's all setup its time to make the init script.

here's my script:

filename: ME1_init_deb.sh
#
sleep 60
mount -o loop -w /usr/local/etc/hdd/volumes/HDD1/debin-4g.ext2 /usr/local/etc/hdd/volumes/HDD1/chroot
chroot /usr/local/etc/hdd/volumes/HDD1/chroot mount -t proc proc /proc
chroot /usr/local/etc/hdd/volumes/HDD1/chroot mount /mnt/hda
chroot /usr/local/etc/hdd/volumes/HDD1/chroot /etc/init.d/samba start
exit
#

I saved this into my samba share at the root and then manipulated it in the telnet session.

So we need to exit the Debian session and back into the plain ME1 system

exit

That should leave us with the prompt like so:
/usr/local/etc/hdd/volumes/HDD1 #

Then we need to move the ME1_init_deb.sh script to the /usr/local/etc directory

mv ME1_init_deb.sh /usr/local/etc/

and we need to make it executable

cd /usr/local/etc
chmod aog+x ME1_init_deb.sh

and finally add that to the initialisation script (rcS)

vi rcS

vi is quite a hard to learn text editor but is the only one available on the ME1 system, luckily you dont have to do a lot.

first press 'i' on your keyboard to enter insert mode
then scroll to the bottom with the down arrow key and paste the following line:
sh /usr/local/etc/ME1_init_deb.sh &

then press escape to exit insert mode and type :wq and press enter to save and quit.
Now the setup is complete, time to test it out so type:

reboot

To reboot the system, in a few minutes the samba server will be running and you should be able to see all your videos as if it were a NAS drive.


Connecting to those damn NAS boxes.
As I mentioned earlier, I'm having one hell of a headache getting this unit to connect to the NAS boxes. I've tried changing the username/password combination, changing the share folder, adding user access control, removing user access control, it didn't work, nothing seems to work.

A few sites regarding the NAS boxes now have me believing that it's not the fault of my media box, but actually the crappy implementation of Samba on those boxes. Apparantly it's a problem for a lot of people connecting from Linux to those boxes.

I guess I can atleast stop worrying about trying to mount the shares using samba now. which isn't supported by the distribution of linux on the system, and also isn't actually supported in the little debian distro that I'd linked in an earlier post.

so, onwards and upwards.

I'm now attempting to mount the shares on the box by sharing them over FTP and using curlftpfs to get onto them, as yet there is still now joy. curlftpfs doesn't appear to be supported on that distro, and I'm running out of ideas about how to get this damn thing working.

At the moment it's looking like I might have to recompile the kernel of the debian 4 that I have running on the box.
I guess this would be fine if it was all just standard, but I'm not sure what tweaks and twists the last person put into it to get it to run how it is at the moment.

There is always the option that I could use a PC to access the flaky NAS boxes, and then share them via the PC. but to be honest, if I'd wanted to use a PC as a media server I wouldn't have bought the ME1 box.

the whole point of this exercise is that I could move away from using PCs as media servers. it was a choice I did consider, and a choice I rejected as just not clean enough.

There is some good news.

Of the 2 (identical) landisk drives I've got, I found that I can plug them into the USB socket for a slave drive on the ME1.

well, I say that I can plug them in, when in actual fact, I can plug one of them in whilst the other still remains elusive, the EM1 can't see the other when it's plugged in by it's self or when it's on a hub.

It seems that the USB IDE bridge just presents the drive as if it were connectted directly to the device, but it doesn't work, almost as if the linux distro on the box doesn't recognise the specific HDD in one of the boxes.

I've swapped the hard drives inside the NAS boxes around and confirmed that both boxes definitly work (recognised by the ME1) with the one hard drive, and both NAS boxes defintily don't work with the other hard drive -aren't recognised by the ME1.

At the moment my setup is.

ME1 with a slave drive connectted via USB. samba installed on the ME1 to enable network access of the ME1 and the slave drive, and a NAS drive still sat on the network, I guess I'll just be putting programs and non-media files on this and accessing only from a PC...

Also, I'll have SSH installed on the ME1, that way if I need any files from the NAS connected box, not available to the ME1, I can SSH to the ME1 and copy a file to the ME1 to be access externally.

Ideally I want to have both NAS drives accessible by the ME1 so that the ME1 can see media and files off both drives, and so that the ME1 can share both these disks via FTP to the outside. and so I can access both disks with a PC, (this isn't a problem if they are setup as NAS disks, the share themselves, when put through the ME1 I'll have to make some mount points and share them via samba)

current storage is
80GB LANDISK 1
320GB LANDISK 2 (connectted via USB and visible to the ME1)
200GB ME1 (so 600GB in total)

I'd like to get a new disk to replace the 80GB disk, and have both disks connectted with a USB hub to the ME1 such that it can see both disks, and have good access speeds to both disks, but without knowing that I can get the ME1 to access the drive of network, or via USB as that seems to depend on the disk, do I really want to buy another disk that I don't know for sure will work?

besides which, the 320GB disk with the landisk unit only cost about £60, so I also reason to myself I'd do better searching for a whole new unit if I needed over 1TB of space. there are 4 ports on the USB hub attached to the ME1

(if I can shift all the data off of the 80GB disk, I might try putting the 80GB disk in the ME1 and formatting that, then seeing if I can put the 200GB disk into a landisk unit and see if that'll work. it's a compramise on the amount of space I have available to record live TV. but lets face it, will I really record some 300hrs of TV? there's shit all on worth wathcing anyway, -and that's why I invested in this home media extravaganza to start with.

Installing FTP daemons on the ME1

now that i have the media drive working. playing files on the TV, accessing files on the USB disk, and sharing files from both the ME1 internal drive and the attached USB disk via Samba...

I've decided that I'll need FTP access so that I can get to files from the outside world.

I've just chroot-ed back into the Debian install and am installing pure-ftpd

hopefully this will work better than the crappy FTP server on those Landisk NAS boxes that only allows two simultaneous connections at a time. (i.e two file downloaded at once, try for a third and it just fails, try to browse whilst this two are downloading and it fails).

I guess that the note to self is as follows.
those boxes were cheap for a reason.
the samba inplementation is crappy
the ftp functionality is crappy
and the USB connecivity is crappy

sure they are fine for simple home use (the one my dad has is serving him very well). but if you want to try to do anything more with them, well you can just forget about it


Pure FTPD
I wish that there was a package that I could install that'd look a little like this
apt-get install an-ftp-server-that-works-with-minimal-fuss

I'm having no end of trouble getting PureFTPD to actually work, I don't really care what server is actually running, so I'm going to investigate another server solution.

http://www.debianhelp.co.uk/pureftp.htm
It's not the first time it just plain hasn't worked. and I don't really care what FTP server I'm running, so Im going to look at yet another FTP server this one is vsftpd.

installing now...

http://www.brennan.id.au/14-FTP_Server.html

works like a charm.

I've created a local user and can now just ftp in as the local user.

now all I want to do is change the local user home directory from /home/user to / or possible
/mnt so I can get to /mnt/hda /mnt/usbdisk1 and hopefully in time /mnt/usbdisk2 also I'll need to add a new line to my start up script to start the server when the box reboots.

but this is as simple as /etc/init.d/vsftpd restart
things are looking quite good now.

Only thing left to do is test the server in anger to make sure that it doesn't bum out after 2 consecutive connections,

usermod -d / username

that was easy enough!

One last bug bear is system time. everytime the ME1 resets, so does the clock.

Which is as simple as putting ntpdate pool.ntp.org in the startup script
(assuming ntpdate is installed, if not then do an apt-get ntpdate first!)

Actually make that two last bug bears, my user account only has permission to upload to it's home directory that was originally created, so now I'm going to want to upgrade my user account to be able to write anywhere.
again that's easy...

Edit your /etc/passwd

A tipical root user looks like this:
root:x:0:0:root:/root:/bin/bash

My user, petur, looks likek this:
petur:x:1000:1000:petur,,,:/home/petur:/bin/bash

0 means ROOT
Any account 1000+ means the username represents a normal user.

If i want to make my user, petur, a ROOT user i'd change my line to:
petur:x:0:0:petur,,,:/home/petur:/bin/bash
and save.

Log out your user if he's logged on and log back in.

so, reooted, and found that I forgot a little bit.
you don't just add, for example ntpdate pool.ntp.org
or indeed chroot ntpdate pool.ntp.org

you add chroot /usr/local/etc/hdd/dvdvr/chroot ntpdate pool.ntp.org

One more thing, remember to spell these things right!

having now checked I can get quite a few simultanious downloads now, it doesn't flunk out at two though the upload speed of my home connection I believe is now comming into play more than the FTP server. It took about 8 minutes to upload a 35MB folder of MP3s. estimated time to download is 30 minutes from the outside world. Not speedy, but better than nothing.

Update 1/6/09 2:24 AM
I've been leaving the dates off of some of these posts, that I've be re-drafting, but I thought I'd leave this one in, it's basically half a year since I first got the device.

Since then the device has been running pretty well, almost too well, almost predictably I've not used a lot of the features on it. I'm still having some issues of annoyance with the guys in my house turning the box off so that I can't connect to it this pretty much renders it pointless to have a web server, as it'll almost always be down, also what the point of an unavailable FTP server... Still I won't always live in a shared house, and I'm fairly sure that my trusty little media centre box will be with me long after the house, and even TV have been replaced and upgraded...

Also I think I've finally figured out a few of the bugs that have been plaguing my uber installation.

noip... 1/9/09 8:52 AM

Some time ago, to make things a little easier for connecting from outside I installed the noip DUC inside the debian chroot environment. this way I could only have to remember my registered address rather than the IP address. Only touble is that the noip dynamic update client, which I'm sure is meant to install as a daemon, wasn't running at startup. My IP address recently changed meaning that I've been unable to get to my ME1 remotely.

today I've fixed that.

I found a script that gets the client to be registered as a daemon on this page.
http://www.togaware.com/linux/survivor/No_IP.html

you need to create a new file in the /etc/init.d directory called /etc/init.d/noip2

that script should look like this,

#! /bin/sh
# /etc/init.d/noip2

# Supplied by no-ip.com
# Modified for Debian GNU/Linux by Eivind L. Rygge

# . /etc/rc.d/init.d/functions # uncomment/modify for your killproc

DAEMON=/usr/local/bin/noip2
NAME=noip2

test -x $DAEMON || exit 0

case "$1" in
start)
echo -n "Starting dynamic address update: "
start-stop-daemon --start --pidfile /var/run/noip2.pid \
--make-pidfile --exec $DAEMON
echo "noip2."
;;
stop)
echo -n "Shutting down dynamic address update:"
start-stop-daemon --stop --pidfile /var/run/noip2.pid \
--oknodo --retry 30 --exec $DAEMON
echo "noip2."
;;

restart)
echo -n "Restarting dynamic address update: "
start-stop-daemon --stop --pidfile /var/run/noip2.pid \
--oknodo --retry 30 --exec $DAEMON
start-stop-daemon --start --pidfile /var/run/noip2.pid \
--exec $DAEMON
echo "noip2."
;;

*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit 0

After this you need to make the script executable

chmod a+rx /etc/init.d/noip2


The aritcle goes on to tell you how to get the client to start on boot, but I found that these instructions didn't actually get the client to start after a reboot,
So instead I've once again modified the ME1_init_deb.sh script to include a line to get it to start

chroot /usr/local/etc/hdd/dvdvr/chroot /etc/init.d/noip2 start

Now I have my box starting, running the venus linux environment, a Debian environment on top of that, including the noip Dynamic Update Client, a web server, an FTP server and a samba server.

Whilst trying to record some programs last night, (actually when trying to pause live TV) I found that the playback was a little choppy.

This may be due to the relativly slow processor in the ME1 (~200MHz) getting a little strained under the load... to this end, I'm thinking that I might look at the services that are running on the ME1 and see about rationalising those services. perhaps seeing if I can get samba/apache/noipDUC installed under the venus linux environment, and get rid of the FTP server, (so I can't remotely upload to the device unless I make a web uploader), but taking some strain off, (like the second linux distro)... in the three months I've had the FTP server running, I've uploaded to the box remotely once, (that was only to test the speed) and have downloaded from the box only once, that was to get a program that I knew was there and didn't want to search for. I've used the web interface a lot more, listening to music with quicktime to stream MP3s in firefox.

Don't get me wrong. the little box is coping well as a server it's 200MHz MIPS processor is enough to run all these things, and it has an ultra low power draw of only a few watts, but like anything, if you push it too far it'll start to show the strain.

Starting Again... 1/12/09

There comes a time in any trial and error process where you reach a point where you need to start again. with the ME1 this is as easy as either just formatting the device, or removing and recreating that chroot Debian installation.
You may find that you need to start again not because it's necessarily gone wrong, but because you'd explored one avenue pretty much as far as it can go, and you want to try another.

For me the other avenue is getting all the set-up that I have accomplished thus far to be working on the box without having a separate OS installed on there.

The reason for this, whilst having a friend to stay at the weekend, (sleeping on the sofa after a night of drinking), they asked how could they stop the annoying whirring noise, it was simple, press the power button on the front of the ME1, the whirring stopped as the hard disk inside spun down. That extra OS was really caining the hard drive.

Some searching has revealed that unlike other boxes based on the same chipset the ME1 is a bit awkward, the OS is loaded from flash memory, which is good if you want to run the box without a hard drive, but not so good if you want to run other things on the ME1...

The reason that the copy of debian is so vital is that this enables you to install stuff on the hard drive.

Sadly, it's also the reason that the box makes so much noise, the constant drive spinning is the result of constant activity in the debian installation.

I see two solutions to this problem, either have a program specifically installed on the device to spin down the disk whilst it's not being used, OR, (the approach I much prefer) get an IDE to CF adapter and use a compact flash hard drive. solid state drive = no noise...

Of course, the problem there is that you can't get a 200GB compact flash card, not even a 80GB, or 40GB... the biggest I've been able to find is a fiendishly expensive 32GB at (£50 GBP) so I'll be looking at a much more reasonable 16GB for ~£20.

According to the ME1 support forum on Google groups it is possible to run the ME1 with no disk at all, assuming that you only want to stream media from one part of your house to another. (this may mean that in future I get a second to go into my bedroom if I get a TV there). So I don't think that disk space is an issue, but without the record facility I'd have been able to buy a much cheaper unit, the ability to record TV is one of the reasons I actually bought this box in the first place.

An 8GB card would do the trick, but any smaller than that and you'll run into some real space issues and take away some of the functionality, (like the ability to pause live TV.

A little disponded I took another long break away from tinkering with this box.

An interesting idea 1/15/09 6:14 AM
I've started looking again at how to get this thing working,

There are a few things that I'm thinking...

first, a web server is a must have item, I want to be able to access files remotely, I want (in future) to be able to control the machine from a web page.

luckily I remember that I don't 'have' to use apache in a chroot jail environment, there was an HTTP server on the box when I got it, but this seems to have been disabled with a firmware update. -I wonder why, fortunatly, it doesn't seem to have been removed, just instructed to not start.

the /etc/inetd.conf file looks like this:

# /etc/inetd.conf A simple inetd.conf
#
#
#
# To re-read this file after changes, just do a 'killall -HUP inetd'
#
#
#ftp stream tcp nowait root /usr/sbin/ftpd ftpd -u 100
telnet stream tcp nowait root /usr/sbin/telnetd telnetd
#auth stream tcp nowait nobody /usr/sbin/nullidentd nullidentd
#www stream tcp nowait www-data /usr/sbin/httpd httpd -h /var/www
#
# End of inetd.conf

I want the line to start the HTTP server not to be commented out so that it does start.

trouble is that file lives in the read only space on the unit, only a firmware flash could change that file, (and I'm not confident that I could re-write all the firmware).

the ftpd program is removed, I think this is just sloppy on behalf of the guys at emprex. probably trying to save some space. (why didn't they clean up the config file?)

I can issue the command inetd killall -HUP inetd to make it reastart all the services and even inetd SIGHUP to reload the file /etc/inetd.conf

but how to I get inetd to use an alternative inetd.conf (default is /etc/inetd.conf).

if I could so this then I'd be happy that I was *half way* there to getting the box setup how I want it...

In other random thought news, I don't think samba is necessarily a *must have* the must have is either samba, or FTP, the reason being that I can add a folder to my web places in XP and use an FTP folder as a normal windows folder in effect, this would let me have access at home and away, and reduce the strain of having www, smb and ftp running on the machine...

That said, if I can get the http server working, I might be happy enough to just connect a USB disk to the unit and control everything that way. I mean there are must haves and nice to haves...

perhaps I'm asking too much?


Making mountains out of mole hills 1/15/09 6:43 AM
Sometimes you have to think around a problem, I can't edit the /etc/inetd.conf file as it's in the readonly squashFS partition, but I can tell the device to use a different config file.

It's really quite simple really, first I read the man pages.

http://www.fhi-berlin.mpg.de/th/locserv/alphas/DOCS/HTML/MAN/MAN8/0168____.HTM

then I copy the config file that exists to /usr/local/etc/inetd.conf

then I change the config as I want to.

then I tell inetd to use a different config, like this

inetd /usr/local/etc/inetd.conf

(simple...)
So now I have the httpd server running... from it's pre-configured binaries,
the question is now as far as I can see, can I get/compile either ftp or samba binaries to work on the box without having to use a chroot environment.

(i should probably add the inetd /usr/local/etc/inetd.conf to my /usr/local/etc/ME1_startup_script that I have, -currently it's still got all the stuff referencing my old chroot debian environment. so I'll delete/comment this out).

HTTPD 1/16/09 2:11 AM
Right, I found some problems with the HTTPD server, not least that as I started to add pages to /var/www (or rather /tmp/www) I can save changes to that space as that area of the box is read/write, but that area of the box also gets refreshed each time the box is turned on, replaced by the contents of the /tmp_orig folder, I don't know why.

Anyway, all I had to do to fix this was create another www folder in /usr/local/etc.
and tell the server to use this as a home drectory.

I did also create a new httpd.conf file, but this server is not nearly as advanced as apache. so there is not a lot of options that can be changed, I can password protect folders, which is good, as I want to create a page to playing and recording films, and don't want this open to the world to see my recordings, nor do I want to open my music/film folders to the world to download.

The http server is compiled to search for a index.html page, and if it can't find that it gives a 404 message... I was rather hoping that it could give directory listings, but at the moment i's looking like I'm going to have to make some scripts in the /cgi-bin/ folder to list directory contents.

The server can see/find all the documents, for example if I try to browse whilst typing the address into the address bar I get 404 error messaages all the way along through http://me1/recording/DVD_VR/ but then when i add VR_MOVIE.VRO to the end I can downoad the file, (I can access the file and hence stream that to mplayer to watch streaming TV).

With VLC player installed on my windows phone, I can press record on the TV and stream TV to the VLC player on my phone.

Directory listings... 1/16/09 9:59 AM
I'm wondering what the best course of action is here, in one respect I can use a script to locate directory containers, and display those as an icon on a web page, clicking on that icon would make the script explore that container. and display results.

e.g.
click browse and the script returns what's in www root
(Folder) Films
(Folder) Music

click films button/icon and the script is sent the command folder=films.
and then lists the contents of the films folder,
with a ../ button at the top to tell it to rescind from a folder into the parent directory.

Or... should I do away with the web page all together and have a complete index built when the machine is turned on, it's looking like it might be a lot easier to do this as I can dump results into a temp file and not have to use a rather horrible string to remote carrige returns and format directory listings for a page.

Just to format the ls listing I'm already having to replace line breaks with other characters to get it onto a page,

I've used sed to do this.

echo `ls /dir | sed ':a;N;$!ba;s/\n/
\n/g'`

that parcticular line is going to have to read directory listings, format them for HTML look at what things are directories and folders and diplay appropriate icons.

It's a coding challenge to say the least. (at least for me.)

If I had a script that ran at startup, I could at least use some intermediate files dumping the results to temp files whilst the final index.html is being created.

Then I can dump an index.html file in each folder, a bit messy, and I'd have to restart to get a current listing, but this also means that not as much processing is done to create pages dynamically...

I've already gone from one situation of expecting this box to do a load of things, and decode record live video at the same time.

I'll have a sleep on it, and decide later.

Media Tomb 3/27/09 10:27 AM
(The project went a long time without an update.)

Since the last update I've installed Media Tomb.
a rather natty little free App, it runs without the debian environment just on the box natively, and lets me watch the films on the box through the PS3 this has many advantages.

Firstly one of the guys I live with replaced the TV with a 42" HD TV, and the films just look poor on this, even with the HD connectors being used. the PS3 however, with upscaling turned on seems to be able to smooth things out adequately.

The second advantage it that the controller for the play station is much easier to search and select films from, - and works quicker, than the menus actually on the ME1 box.

Which brings us up to the current day.
My house mate moved out, taking his big TV and playstation with him, that's left a step backwards going to just connectting the box to a normal TV with the relevant RCA cables.

I gave up on an FTP server, but have a reduced size debian installation running in a chroot jail for samba access. the disk is still a little busy. but mostly not used.

I've developed a file browsing script that works using a cgi script bash and a few other linux utilities (grep, sed, awk) to create a browsable file structure that works in realtime and allows access to files.

Getting Samba onto the venus linux distribution is still elusive, because there isn't a way to access most of that system as most of the file system is read only and the architecture is MIPS.

Media tomb is still running as a UPNP media server, and I can access my media with either computer or phone (with relevant applications) easily.

There are still a few things that I'd like to do. but in reality I think that the box is doing as much as it can, I can transfer files to is using Samba in my house, access files using the HTTP server outside the house, and there is still enough grunt left in the box to record and play TV from the disk that is connectted by USB.

I've gotten rid of both LanDisk, (and wish I hadn't bought them to start with). now I have a 1.5TB FreeCom USB disk attached. and that works great. network access to the disk is provided through the ME1.