Linux Terminal Server for Home Media PCs

March 7, 2006 on 2:28 am | In Blah Blah, Sysadmin |

AOpen Pandora MiniPCSo I bought this new AOpen Pandora box (yes - a beige box Mac Mini ripoff). I got a Pentium M 1.73GHz and 512Mb of RAM. It comes with a DVD Reader/CDRW and I didn’t buy a harddisk or anything else. My goal was to run a single terminal server for all the Media PCs in my apartment (I have 1 in the living room & 1 in the bedroom… thinking of putting one in the bathroom).

I figured my main computer can be the Terminal Server, but as I started building it I realized that building an i386 client image on an AMD64 box was an utter pain (the script that generated it complained all the time, even after I hardcoded my arch values into it). So I figured I will just create it inside VMWare running a i386. Luckily I had latest flight of Dapper there already.

The result is a VMWare image of a Terminal Server for Media PCs (running Freevo or MythTV) that can be deployed anywhere with the free VMWare player or just by coping the files to a bootable filesystem.

Preparation

To setup a Media PC Terminal Server: I installed the latest Ubuntu Dapper Flight 4 release i386 under VMWare. It is still very rough, but usable. I figured that running a terminal server in VMWare should be sufficient for testing, and if it is too slow I can always transfer the client images to be served from my main computer.
I started by reading this:

The key line I was looking for is how to use the local resources for certain applications, in my case a video player. I found it in the section about local applications:

In an LTSP environment, you have a choice of running the applications locally on the workstation, or remotely on the server (Source).

Actually it turned out that this wasn’t what I would need, but would still be useful for running Firefox, Amarok, etc using local resources, rather then the Terminal Server’s. Nevertheless, I decided to get my hands dirty.

Hit the command-line

AOpen Pandora MiniPC
This post is not intended as a HowTo - it is more of a journal of my adventure and notes to avoid my mistakes. While I talk about Freevo & VMWare a lot - they are not required. This same process will work for any application you want to run on the local resources of a terminal client or server. I imagine many people, who setup Linux media PCs, would benefit from a centralized client image and PXE boot ability.

I will not willy-nilly around the process. Here is the meat of setting it up:

On the Terminal Server box (in my case VMWare VM):

  sudo apt-get install ltsp-server-standalone \
           ltsp-utils student-control-panel \
           openssh-server
	
  sudo ltsp-build-client
  sudo ltsp-update-sshkeys

Configure the DHCP server (turn off any other ones if you have them):

/etc/ltsp/dhcpd.conf
	
  authoritative;
  default-lease-time            21600;
  max-lease-time                21600;
	
  subnet 10.0.0.0 netmask 255.255.255.0 {
    range 10.0.0.10 10.0.0.50;
    option domain-name “domain.com”;
    option domain-name-servers 10.0.0.1;
    option broadcast-address 10.0.0.255;
    option routers 10.0.0.1;
    option subnet-mask 255.255.255.0;
	
    filename “/ltsp/pxelinux.0″;
    option root-path “/opt/ltsp/i386″;
  }
	
  group   {
    use-host-decl-names       on;
    option log-servers        10.0.0.2;
	
    host pandora {
        hardware ethernet     00:00:00:00:00:00;
        fixed-address         10.0.0.3;
    }
  }

For the sake of this example my gateway is 10.0.0.1, my terminal server is 10.0.0.2, my terminal client (new AOpen box) is 10.0.0.3. All other terminal clients will get an address from .10 to .50

The picture there is my test environment. Laptop booted of PXE running Freevo on the right, 1TB storage computer under the desk, main computer running VMWare in the center & the AOpen Pandora box on my desk powering the right screen - showing the login prompt to the terminal server.

First Tests & First Problems

Now simply reboot the Terminal Server (or just restart tftp, nfs, portmap, dhcp, etc services). When the terminal server comes up - check that DHCP server is up too.

Pick any other computer (or another VMWare machine) and boot it off the network (PXE only). You should see it talk to the tftp server, get and IP and start to boot a kernel.

Now, this is where the problems will start.

Very briefly:

  • If nothing happens - be sure your BIOS settings are set to PXE boot or network boot (if on a laptop use the onboard lan, not the wireless)
  • If PXE comes up but doesn’t pick up the kernel - check TFTP and dhcp settings;
  • If kernel boots and you see the ubuntu boot splash - you are on the right track.
  • If it crashes mounting the root fs - check your NFS config (/etc/exports) also check that your are not binding portmapper on to localhost /etc/default/portmap).
  • If X doesn’t start check out the /etc/X11/xorg.conf on the client system (because the host’s version gets modified in the process of the boot). I personally hate configuring X (I’ve been doing it since 1999, when it was hip) so if looking at that file gives you a headache - here is a good trick: boot Ubuntu Live CD and copy it from there (presuming it booted fine). In case you do need to replace the xorg.conf file - don’t bother editing it on the system - it is running in a tmpfs and your changes will be lost. Instead read on to how to configure lts.conf file.
  • If you got a login prompt, but it doesn’t let you log in - well you’re on your own… read some logs… check the ssh keys…

If you are lucky (or careful) you will just get a prompt - login using an account that works on the terminal server - and enjoy the remote desktop. Also try the CTRL-ALT-F1…F6 - you should get vterms and be able to login locally (but only as the user that exists on the terminal client image - you will have to create one)

Configuring Terminal Clients

My Terminal Server is not solely for MediaPCs. I am planning to use for just general desktop as well (if it works well). So I decided to get a client working the way I like it.

First off, it doesn’t hurt to read over the ltsp setup script: /opt/ltsp/i386/etc/init.d/ltsp-client-setup. Refer to this script to understand why crazy things are happening to your client. Also, this is a the place to include /etc/hosts information and /etc/fstab what will be used by the clients - these files are generated by the script (among others).

Next I configured the /opt/ltsp/i386/etc/lts.conf with the following info:

[Default]
        SERVER = 10.0.0.2
        SOUND = Y
        SOUND_DAEMON = esd
        VOLUME = 75
	
# Pandora Specific
[10.0.0.3]
        XF86CONFIG_FILE = /etc/xorg.conf.pandora
        LOCAL_APPS = Y
        LOCAL_DEVICE_01 = /dev/hdb:cdrom
        LOCAL_DEVICE_02 = /dev/sda:usb
        SCREEN_01 = freevo

As you can see - I enable sound by default, but for the AOpen Pandora (my MediaPC) I issues a custom xorg.conf file (which is actually placed in that location on the client image), local cdrom and USB. I also set the SCREEN_01 to start freevo.

To enable the freevo screen script - go to this folder: /opt/ltsp/i386/usr/lib/ltsp/screen.d and add this script:

/opt/ltsp/i386/usr/lib/ltsp/screen.d/freevo
	
   #!/bin/bash
   killall esd
   su - tv /usr/bin/xinit /usr/bin/freevo
	

Be sure the script is chmod’ed 755.

In the script I kill esd (which I start it in the terminal server setup) this may seem silly, but it works such that if you boot into the desktop you have sound over esd, and if you start Freevo you have sound over oss.

Both sound & local media were rather problematic. I googled around and settled on following the advice of these pages:

Local Media Config - http://wiki.ltsp.org/twiki/bin/view/Ltsp/LocalMedia#Configuration
Sound Config - http://wiki.ltsp.org/twiki/bin/view/Ltsp/Sound

Getting Freevo into the Local Client Image

Installing things to the client image couldn’t be easier. On the host system, just update the sources.list in /opt/ltsp/i386/etc/apt/sources.list and chroot to the image:

   sudo chroot /opt/ltsp/i386
	
   apt-get update
   apt-get dist-upgrade

This is assuming you have the sources for freevo and mplayer as well as universe and multiverse. If you don’t know what I mean - check out this sources.list file.

After chrooting to the system and upgrading - I just ran this:

  apt-get install freevo mencoder tvtime xine-ui \
                           w32codecs libdvdcss2 libdvdcss \
                           libxine-extracodecs libjpeg-progs \
                           exiftran lame flac cdparanoia
   freevo setup
   freevo plugins -a

Last command lists all the installed modules. Most are not activated, but look over them and pick what you might think is useful.

Configure your Freevo as you like - edit the /etc/freevo/local_conf.py (if you are still chrooted). This post isn’t really about Freevo, as much as LTSP. You should have the same success with MythTV (also an excellent piece of software) or any other such application (for Linux, or course).

Just as a small tip, if you are using Freevo, add this to your local_conf.py

    plugin.activate('headlines', level=45)
    HEADLINES_LOCATIONS = [
       ('Slashdot', 'http://rss.slashdot.org/Slashdot/slashdot'),
       ('Digg', 'http://digg.com/rss/index.xml'),
       ('BBC World', 'http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/world/rss.xml'),
       ('CNN', 'http://www.cnn.com/services/rss/')]

(Note: Freevo config (Python) doesn’t allow leading spaces - the parameter has to be the first character of the line)

Some useful Freevo pages:

If you are going to be starting freevo after a login (as a session or from a specific user) - this may be helpful. To have the user auto-login:

/etc/X11/gdm/gdm.conf
	
   AutomaticLoginEnable=true
   AutomaticLogin=USER

Where USER is the Freevo-enabled user. Then add this script:

AOpen Pandora MiniPC

/usr/share/xsessions/freevo.desktop
	
  [Desktop Entry]
  Encoding=UTF-8
  Name=Freevo
  Comment=Freevo
  TryExec=/usr/bin/freevo
  Exec=/usr/bin/freevo
  Icon=
  Type=Application

Last you will need to add a ~/.dmrc file to the home dir of the freevo users that says:

  [Desktop]
  Session=freevo

Now just restart gdm (/etc/init.d/gdm restart) and freevo will just come up.

To make the folder look nice - follow this advice:

Moreover you can specify an image to display in the folder’s parent menu by adding an image to the folder called cover.jpg or cover.png. The size of the image depends on the current type of the menu. For movies you have something like DVD covers or movie poster, for audio a cd cover. So the image will be resized to 280×200 for movies, 200×200 for audio and 200×160 for images. These sizes will also be used for the directory images. (Source Freevo Wiki)

The picture is my finished bedroom setup. The Pandora box boots off PXE, mounts root filesystem and all the media shares (music, videos, pictures). Headlines are provided by the rss streams described above.

All your remote are belong to lirc

I will shoot myself before I finish my lirc setup… but lots of people online talk about it working… Sooner or later I will fill in this section. For now I got a USB keyboard and a long cable. UPDATE: I just got a wireless keyboard with multimedia buttons - I think it is even better then a remote - because I can type emails or just browse the web with it.

Can’t blog anymore… Gotta go watch something.

If this helped someone - I am glad… I sure tried to find a guide like this while reading every script in ltsp. In the end - it works! And it works great! Uses 5% on my client system resources to play video and uses the VMWare terminal server for NFS only (1-2% occasionally). Everything is fast, the sound is synced, video is crispy.

Now, am I going to keep it on VMWare or move it to the main system? I sort of did this in VMWare as a testbed, but now I think I will keep it. It runs fast. It is portable, so I can have it setup on several computers. I can take to a friend’s house. The whole image (both server and client) works out to be just under 3Gb - easily fits on a DVD with the free VMWare player.

Post a comment if you have questions.

Alex Pachikov - 2006 - Digg this Page

19 Comments

  1. really really sweet! something ive thought about but not realised as you have done.

    how many clients can the main computer support at one time?

    Comment by Matthew Smith — March 8, 2006 #

  2. So far I tried 4… but I imagine many more shouldn’t be a problem… The deal is - with my setup I rely on the local resources rather than just the terminal server… The terminal server only really serves nfs for the root fs.

    Comment by admin — March 8, 2006 #

  3. As long as the terminal server is not doing any heavy number crunching you will be fine (i.e. I wouldn’t do a whole lot of graphics stuff over the network). Having worked with the LTSP before at college, it can become bogged down quickly when users are on thin clients and do not have access to local resources. If you are planning on running LTSP as a true terminal server for several thin clients, then be prepared to have a lot of computing power in that box (dual procs, lots of ram, etc.). If you are using it for one more PC though any decent computer would be good for the server. I love the LTSP and this is a really cool use for it, too bad I didn’t have the chance to try this out at school though, it would have been really cool.

    Comment by Jonathan — March 8, 2006 #

  4. Jonathan,

    Thanks for your comment. You are absolutelly right. At first when I wanted to set this up - people told me it wouldn’t work - and they would be right if I wanted to run a video player off of the terminal server. But the trick is using the local resources as much as you can (if you can). LTSP has a whole article on “Local Applications” - it is useful in any TS env. so you can run a local version of Firefox, xmms, etc…

    -Alex

    Comment by admin — March 8, 2006 #

  5. nice post! hope to put this to work sometime soon. :)

    Will link your blog up to mine :)

    Comment by hardwyrd — March 8, 2006 #

  6. Thanks! I digg your blog too.. added you to my list.

    Once you try to get this going - hit me up - I plan on making the guide more complete.

    -Alex

    Comment by admin — March 9, 2006 #

  7. Any chance of having this image available for download ? This would be a great jumpstart into the LTSP adventure. (Torrent perhaps ?)

    Comment by Martijn — March 9, 2006 #

  8. Well… I have thought about it. The issue is the image I have is hacked to bits. This post seems long, but the actual time and the number of commands that it took to figure out how to do this - is far more.

    So, what I should do is create this image from scratch again following my own instructions (D’oh) and post that image.

    I will try to do this in the near future… but I am afraid I’ll be stuck supporting it too. Then it will need a configuration wizard, etc… We’ll see… ;-)

    Comment by admin — March 9, 2006 #

  9. Would we be able to download this any time soon?

    It’s really sweet! Awesome

    Comment by Steven Roberto — March 9, 2006 #

  10. […] Esta es una de las mejores ideas que he visto, se que es un poco difícil de encajar con la temática de Gizmología pero es genial. Desde que poseo un Mac Mini digo y repito que es perfecto en cuanto a tamaño, tienes en una cajita todo lo necesario para navegar, editar, jugar, etc… Pero si no te van las mac siempre puedes hacerte con un AOpen mini PC. Es del mismo tamaño que el mac mini, y al igual que el mac tiene todo lo necesario para ser un PC competente (teniendo en cuenta su tamaño, claro). Pero lo curioso es que teniendo este tipo de PC puedes crearte por un precio bajo un servidor casero preparado estar activo 24/7. […]

    Pingback by Gizmología » AOpen mini PC — March 9, 2006 #

  11. Gracias, amigo. Una ventaja del mac excesivo de AOpen MiniPC mini es cerca de $150 de ahorros - y la diversión del edificio él usted mismo.

    Comment by admin — March 9, 2006 #

  12. This is so cool. Let me just get this straight. Youi have a LTSP Server that loads a TFTP image on a PXE bootable client, this client then map local devices and apps through to the server. So this allows the client to watch tv(with all the recording features of myth/freevo, ie pause, record, rewind), listen to music from an NFS mount using the LOCAL audio player to play the music as it would be too slow through LTPS, watch divx movies from the NFS mount using local app and watch DVD’s using the local app. Have I got that right? Does that mean that even though freevo/myth is running on the ltps server when you launch the music/dvd/movie apps it actually loads the apps locally from the client and plays it no problem. If thats right it almost sound too good to be true. Does that mean that less resources are being used on the client compared to loading myth/freevo completely on the client as some application are not running on the client and only the ones that need to run from client. small example:

    server: ubuntu, ltps, freevo/myth, dhcp, tftp, tv cards.
    client: pxe booted image, ltsp client, audio apps, video apps, dvd player

    let me know if i have lots the plot ;)

    Comment by Psypher — March 10, 2006 #

  13. Good information. Another way to get ltsp working is to install from k12ltsp.org. The project provides terminal servers for educational situations. I have used this technology successfully. A dual xenon 3.0 server will power at least 12 workstations.

    Comment by James Musil — March 10, 2006 #

  14. DRBL(http://drbl.sf.net) may be another choice for diskless workstation.

    Comment by Bill — March 10, 2006 #

  15. Psypher,

    You are almost right. The only difference is that I don’t actualy spawn the application from the terminal server. I share all the NFS from the terminal server - and when a client mounts the NFS - it can start an application right off of it.

    Try this if you have an LTSP setup - on the client just do Ctrl-Alt-F1 - and you will get a vterm where you can login locally. So if that image has freevo/mplayer on it - you can start it without using your terminal server resources.

    James, Bill, - thanks for the links… Most of what I do on my system can be done with those as well.

    Comment by admin — March 10, 2006 #

  16. […] Linux Terminal Server for Home Media PCs This is a dretailed howto on setting up a central media terminal server so that other PCs can act as thin Media clients. Super cool stuff. (tags: media_audio_video software_hardware_services_technology howto_references_tutorials_resources) […]

    Pingback by lemasney.com » Blog Archive » links for 2006-03-10 — March 24, 2006 #

  17. […] Dans le même genre, cet auter blog. […]

    Pingback by Emile “iMil” Heitor ’s home » diskless — March 25, 2006 #

  18. I’m not 100% sure: does that unit include an infra-red port? I don’t think I see it on the unit, and I was most disappointed to find that my travla 137 case’s ‘planned’ IR add-on was discontinued.

    Or are you simply hanging/gluing a dongle nearby when you wrestle with LIRC?

    Comment by Bish — April 11, 2006 #

  19. No, this unit does not have an IR port. But I personally like the RF remotes better. And this is exactly what I have. Using xbindkeys to manage the buttons insread of LIRC… I like it better that way.

    Comment by admin — April 11, 2006 #

Sorry, the comment form is closed at this time.

Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds. Valid XHTML and CSS. ^Top^