[LINUX] HOW-TO create a XBMC server for diskless PXE network booting clients

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Thumbs Up  [LINUX] HOW-TO create an XBMC server for diskless PXE network booting clients
Post: #1
What does this package do?
The xbmc-diskless-server package installs the server software that is needed to let any PC boot from the network and start XBMC on that PC, the same as XBMC live.

It works by creating an image of an Ubuntu installation with XBMC on a server and having your clients boot that (read only) image. The client's configuration and media databases are stored via NFS, so they won't be lost when you reboot your client.

This brings us some nice advantages:
  • no noisy harddisks in your media player is needed
  • if you want to upgrade XBMC on multiple clients, you will only have to install it once to upgrade them all
  • centralised configuration of all media players (think about things like having the same video database on all media players)
  • any normal work pc can be turned into a media center within seconds. Just reboot it and choose "boot from network" and it's done. Nothing is changed on your harddisk.

Installation
If you want a diskless XBMC installation, you'll need a server to host it's files. On that server, you'll install the 'xbmc-diskless-server' package. It contains some scripts to create a disk image for your clients and it makes sure the required server components get installed and update the configuration.

Follow these steps to install the server software.

  1. open a terminal window on your server or log in via ssh
  2. install the server software
    Code:
    sudo apt-get install -y python-software-properties
    sudo apt-add-repository ppa:lars-opdenkamp/xbmc-diskless
    sudo apt-get update
    sudo apt-get install -y xbmc-diskless-server
  3. start the gui by typing
    Code:
    sudo xbmc-diskless.sh
    This will show you the administration menu:
    [Image: menu.jpg]
  4. to create or update a client's installation, choose "create" first


Create an image
  1. the first step shows you some general information about the process:
    [Image: create1.jpg]
  2. press ok and you'll be asked for a distribution to use for your clients. I only tested lucid myself:
    [Image: create2.jpg]
  3. next you can enter a PPA to use for the installation. choose 'none' if you don't want to use any PPA and 'custom' to enter your own choice:
    [Image: create3.jpg]
  4. this script only installs the minimal Ubuntu installation and XBMC with all it's dependencies. if you want to install some extra packages, enter them in the following screen, delimited by spaces:
    [Image: create4.jpg]
  5. enter some password for the 'xbmc' user so you can log in on the console or log in via ssh. the minimal password length is 3 characters:
    [Image: create5.jpg]


... continued in the next post

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
(This post was last modified: 2010-11-02 01:21 by opdenkamp.)
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #2
Create an image (2)
[LIST=6]
[*]verify the data you entered in the final screen. if you made any mistake, press 'no' and start the wizard again:
[Image: create6.jpg]
[*]pressing 'yes' will start the installation process. this will take a couple of minutes, depending on the speed of your internet connection and server:
[Image: create7.jpg]
[*]if everything went well, you'll see the following screen. Proceed to the next paragraph:
[Image: create-ok.jpg]
[/LIST]

Pack an image
  1. choose the second option in the administration menu: 'pack'
  2. this will first clean the target and next it will be compressed with squashfs:
    [Image: pack1.jpg]
  3. this will also take a few minutes, and will show the following screen once completed:
    [Image: pack2.jpg]
  4. continue to the next step, installing your new image


... continued in the next post

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
(This post was last modified: 2010-10-23 16:32 by opdenkamp.)
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #3
Install a new image
  1. after completing the previous steps succesfully, we're going to install our new image. Choose 'install' in the menu.
  2. first, you're asked to shut down all your clients, because replacing the image of an existing installation will crash running installations (yes they will crash, really, don't try).
  3. next, the kernel and initrd are copied, the new squashfs image is installed and the configuration of inetd and NFS are adapted (if needed).
  4. if everything worked correctly, you'll see the following image:
    [Image: alldone.jpg]
  5. you're almost done. continue to the final step.


Adding your server to the DHCP options of the clients
You only have to do this once.

Your clients have to know where to find the files it needs to boot. This is done by adding it to the DHCP of the clients. If you are using ISC dhcp, the default dhcp server on Ubuntu, add these lines to your host's configuration lines:
Code:
next-server XXX.XXX.XXX.XXX;
filename "/pxelinux.0";
Replace XXX by your server's IP address.

Example:
Code:
subnet 192.168.64.0 netmask 255.255.192.0 {
        range 192.168.90.100 192.168.90.125;
        next-server 192.168.64.1;
        filename "/pxelinux.0";
}

Restart your dhcp server to make the new configuration active:
Code:
sudo /etc/init.d/dhcp3-server restart

On your clients, enable "boot from LAN" in the BIOS. Check your motherboard's or network card's manual on how to do that.

Provisioning (optional)
You might want to distribute some files to one or more clients without adding them to the image. Think about your video database, lirc config files, etc.

That's what the provisioning mechanism is for. In the directory /var/lib/xbmc-diskless/provsion you can create a directory 'default' with files you want to have copied to all clients on the first boot. Those files will be copied to the client's /home/xbmc directory on the first start of each client.

You can also add directories for each separate client by creating a directory with the mac address of the client as name (without the colons).

Please make sure you have the permissions set correctly:
chown 1000:1000 to each of the files.


/etc is symlinked to /home/xbmc/config so you can add files there too.

To update the provisioning package, start the xbmc-diskless.sh GUI and choose "provision"

Upgrading (optional)
If you created an image before, you can upgrade it without creating a new image. Choose "upgrade" from the menu to run "sudo apt-get -f dist-upgrade" on the target.

If for some reason the update failed, you can manually fix it by running these commands (this will be simplified in the next version):
Code:
sudo mount -o bind /dev /var/lib/xbmc-diskless/target/dev
sudo mount -t proc none /var/lib/xbmc-diskless/target/proc
sudo mount -t sysfs none /var/lib/xbmc-diskless/target/sys
sudo mount -t devpts none /var/lib/xbmc-diskless/target/dev/pts
sudo cat << EOF > /var/lib/xbmc-diskless/target/usr/sbin/policy-rc.d
#!/bin/sh
exit 101
EOF
sudo chmod +x /var/lib/xbmc-diskless/target/usr/sbin/policy-rc.d
sudo chroot /var/lib/xbmc-diskless/target apt-get -f install
sudo umount /var/lib/xbmc-diskless/target/dev/pts
sudo umount /var/lib/xbmc-diskless/target/sys
sudo umount /var/lib/xbmc-diskless/target/proc
sudo umount /var/lib/xbmc-diskless/target/dev

Extras (optional)
There are a few more options available by editing the configuration files. Check the readme file in /usr/share/doc/xbmc-diskless-server, or choose 'help' in the GUI.

Checklist
  • if you have multiple network cards, the hostmask and server ip might not have been detected correctly with this version. verify the contents of these files:
    Code:
    nano /etc/inetd.conf
    nano /etc/exports
    nano /var/lib/tftpboot/pxelinux.cfg/default
  • verify that the required software is running correctly by executing the following command.
    Code:
    sudo xbmc-diskless.sh check
    If everything is alright, it should show this output:
    Code:
    Loading the default configuration
    Checking your configuration:
    image present:            yes
    inetd running:            yes
    tftpd running:            yes
    tftpd (69) listening:     yes
    nfsd running:             yes
    mountd running:           yes
    statd running:            yes
    portmap running:          yes
    /etc/exports has overlay: yes
    portmap (111) listening:  yes
    nfs (2049) listening:     yes

If anything went wrong, go back to the first post and verify each step. If it still doesn't work, report it here.

Source
The latest sources can be found at http://github.com/opdenkamp/xbmc-diskless

Disclaimer
Not every advanced option from the config file is working correctly at the moment, because this is still in beta stage. e.g. the option for the nbd server port that is used is not read and port 2000 is always used. All the functions described here are working fine and have been tested using various setups, but all of them are using nvidia video cards. I haven't tested any others since I don't have any.

I have a lot of things that I want to add later. Think about a centralised user database, the ability distribute one client's config to others, wake on lan for clients, resetting a clients config from the GUI, etc. Since this version is usable and tested already (I'm using this system for months on all my clients now), I didn't want to wait till all those features are added before releasing it. Be sure to check for updates regularly!

If you're having trouble, be sure to check the log file /var/log/xbmc-diskless.log for information about what went wrong. If you need more help, post your question here or ask me on irc.

This software is based on mythbuntu-diskless-server, which is based on ltsp-client-core. Their copyright notices can be found in /usr/share/doc/xbmc-diskless-server

This howto is updated for xbmc-diskless v0.4.9.1

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
(This post was last modified: 2010-11-02 01:33 by opdenkamp.)
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #4
<reserved>

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
(This post was last modified: 2010-10-23 16:39 by opdenkamp.)
find quote
vikjon0 Offline
---
Posts: 2,500
Joined: Apr 2009
Reputation: 8
Location: Sweden
Post: #5
Interesting!

I was actually looking into installing xbmcLive over PXE this very day.
It is proving a bit too hard for me, I think I need to build a netboot initrd and perhaps rearrange the installer.

I spent a loot of time on the pxe server though and I got it working with dnsmasq proxydhcp. You might want to add proxydhcp to your server, I assume many of your potential users have a cheap router with dhcp not a linux dhcp. I would offer to help, but by the look of it you are a bit more advanced than me and probably dont need it.
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #6
I'm not doing anything with dhcp in my scripts, just describing what you have to do to set it up in this howto. I don't know proxydhcp, so if you can tell me how to add a "next-server" and "filename" directive to that one, I'm happy to add it to this howto.

My "potential users" will need some linux machine to host the image and client specific files and the scripts focus on that machine. If you're running dhcp on a different machine, you'll have to edit it's configuration manually.

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
vikjon0 Offline
---
Posts: 2,500
Joined: Apr 2009
Reputation: 8
Location: Sweden
Post: #7
The reason I went with a proxy is that I use dhcp on the router which does not support pxe. I don't want a server running all the time to have dhcp for the laptops.
I guess since your setup require a permenent server it is a bit differrent. Still, assuming you want to turn off it sometimes it could still be usefull.
(I also predict you will get a lot support issues on dhcp that will be avoided if you include a proxy)

I posted my notes here:
http://vikjonlinuxhowto.blogspot.com/201...proxy.html
It is working as is but I intend to clean it up.
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #8
vikjon0 Wrote:The reason I went with a proxy is that I use dhcp on the router which does not support pxe. I don't want a server running all the time to have dhcp for the laptops.
I guess since your setup require a permenent server it is a bit differrent. Still, assuming you want to turn off it sometimes it could still be usefull.
(I also predict you will get a lot support issues on dhcp that will be avoided if you include a proxy)

I posted my notes here:
http://vikjonlinuxhowto.blogspot.com/201...proxy.html
It is working as is but I intend to clean it up.
I'll look into that tonight or tomorrow and will come back on that. Thanks for the pointer Smile

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #9
That proxydhcp looks good. I'll run some tests later today and if it works correctly I'll include it in the next release.

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #10
Little update: amd64 package fixed. new packages are uploaded and will be published within 30 minutes.

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
vikjon0 Offline
---
Posts: 2,500
Joined: Apr 2009
Reputation: 8
Location: Sweden
Post: #11
if you decide to include it, I have now created a auto config of dnsmasq (well, stole most of the code of course)

http://ubuntuforums.org/showpost.php?p=1...ostcount=3

Needs run on start as root..not sure how to do that.
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #12
I'll look into it before the next release. thanks for the info Smile

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
Anastrophe Offline
Donor
Posts: 260
Joined: Mar 2004
Reputation: 0
Location: Dubai, UAE
Post: #13
Amazing stuff, thanks so much for working on this!
find quote
Anastrophe Offline
Donor
Posts: 260
Joined: Mar 2004
Reputation: 0
Location: Dubai, UAE
Post: #14
are there any log files to check as I get to 25% of compressing image and it stays there for >24hrs?

no PPA selected if that helps
find quote
opdenkamp Offline
Team-XBMC PVR Developer
Posts: 2,224
Joined: Feb 2009
Reputation: 29
Location: Heerlen, The Netherlands
Post: #15
you can check a log of the installation in /var/log/xbmc-diskless.log for a complete installation log. the "mksquashfs" itself isn't logged.

if you want to see what the compression does, execute this:
Code:
rm -f /var/lib/xbmc-diskless/images/xbmc.img-new
mksquashfs /var/lib/xbmc-diskless/target /var/lib/xbmc-diskless/images/xbmc.img-new -e cdrom -no-recovery

opdenkamp / dushmaniac

xbmc-pvr [Eden-PVR builds] [now included in mainline XBMC, so no more source link here :)]
personal website: [link]

Found a problem with PVR? Report it on Trac, under "PVR - core components". Please attach the full debug log.

If you like my work, please consider donating to me and/or Team XBMC.
find quote
Post Reply