dimitris kalamaras

math, social network analysis, web dev, free software…

Revive your Asus EeePC 701 4G and build a media server and torrent client

So, I had this EeePC 701 4G waiting patiently in a box and decided to make something useful with it: A media server + a remote torrent client.

First things first, I decided to install Lubuntu 13.04 in our EeePC. It is a simple, light but ‘full’ linux distro, since it is 100% compatible with Ubuntu. I downloaded the alternate ISO, burned it to a USB flash and rebooted the machine. The installation was smooth (it took ~40 minutes) and after rebooting to LXDE I was happy to see 1GB of free space in the 4GB SSD disk. Furthermore, everything worked OK: sound, graphics, greek support, etc. It was time to start the real fun part…

After an apt-get update && apt-get upgrade, I installed lubuntu-restricted-extras to be able to play flash etc in case someone needs to use the EeePC as a normal computer:

sudo apt-get install lubuntu-restricted-extras

Since my real purpose is to make the EeePC act like a media server, I installed ssh-server and samba:

sudo apt-get install openssh-server samba

Now, I want Transmission to start each time the machine starts. But Lubuntu by default wants each user to login. To enable autologin I opened the LXDE configuration file: lightdm.conf

sudo nano /etc/lightdm/lightdm.conf

and added two lines


where “eleni” is the user of the EeePC.

Next, I enabled remote administration in Transmission torrent client, through port 9292 and added Transmission to autostart when LXDE starts:

ln -s /usr/share/applications/transmission-gtk.desktop .config/autostart/

Nice. Now I can to the Transmission web interface.

Next, I wanted a simple way to automatically export usb drives over samba. That is, every time someone plugs a USB flash to our EeePC, the flash disk should be shared automagically over the whole LAN, without any further configuration. Someone [1] had already done it nicely and using his instructions was a breeze:

Install usbmount. This utility will create our usb shares over samba:
sudo apt-get install usbmount

Create a subdirectory inside /etc/samba:
sudo mkdir /etc/samba/auto

Add a few lines in smb.conf:
sudo nano /etc/samba/smb.conf

The lines I added were:

include = /etc/samba/auto/usb0.conf
include = /etc/samba/auto/usb1.conf
include = /etc/samba/auto/usb2.conf
include = /etc/samba/auto/usb3.conf
include = /etc/samba/auto/usb4.conf
include = /etc/samba/auto/usb5.conf
include = /etc/samba/auto/usb6.conf
include = /etc/samba/auto/usb7.conf

Now, it’s time to create a couple files for automount to do its tricks.

First, create a configuration file so that usbmount knows how to export a usb flash over Samba when it is plugged in:

sudo nano /etc/usbmount/mount.d/50_add_samba_export

and add

cat > /etc/samba/auto/$SHARENAME.conf << EOF
comment = $UM_VENDOR $UM_MODEL
read only = no
guest ok = yes
browseable = yes

As you see, I have enabled guest access, so that all data in the USB disks are shared without passwords in our LAN. Note: For this to work, I changed the security option in smb.conf from ‘user’ to ‘share’ (see [2]). Then, save the new file and make it executable:

sudo chmod +x /etc/usbmount/mount.d/50_add_samba_export

Now, we need a similar file for the unmount procedure:

sudo nano /etc/usbmount/umount.d/50_remove_samba_export

with these lines:

rm -f /etc/samba/auto/$SHARENAME.conf

Again, save and make it executable:
sudo chmod +x /etc/usbmount/umount.d/50_remove_samba_export

One more step to go. We need a failsafe procedure in case a share is not cleanly unmounted:

sudo nano /etc/init.d/auto-share-clean

#! /bin/sh
# Provides: auto-share-clean
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Cleans auto samba shares

rm -f /etc/samba/auto/*

Now we save and make it executable:

sudo chmod +x /etc/init.d/auto-share-clean

Finally, we make the script run when the EeePC boots:

sudo update-rc.d auto-share-clean defaults

This is it. Just restart Samba and test it. Plug any usb disk. It should appear mounted under /media/usbX and a proper samba share should be created.

Note: You can test your configuration and see all your shares with the testparm utility. Just run it, after you plug the USB disk in, and see if you have something like this:

comment = Seagate FreeAgent GoFlex
path = /media/usb0
read only = No
guest ok = Yes

So, after a couple hours of setting up, our EeePC is finally in good use again. It sits alone with two external USB disks attached to it, and we can stream our photos and movies from them over samba (browse with \\eeepc in Windows or smb://eeepc in Linux machines), while it patiently downloads torrents which we add to it remotely… And if we need to use it as an ordinary laptop, Lubuntu is more than ready for web surfing and e-mail….

[1] http://www.davidc.net/automatically-exporting-usb-drives-over-samba

[2] http://www.debuntu.org/samba-how-to-share-files-for-your-lan-without-userpassword/


Perfect day


Rain Room: Ενα δωμάτιο όπου βρέχει αλλά δεν βρέχεσαι

1 Comment

  1. sam

    How did you get past the PAE requirement. I’m installing with the forcepae boot option, but the install craps out toward the end.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Powered by WordPress & Theme by Anders Norén