1. Home

Anil

< Blog />

Dreambox 800 HDSE setup & configuration

in

This is a guide for setting up and maintaining a dreambox satellite set top box.

A dreambox runs a small subset of Linux called busybox. Unlike a full blown linux installation, busybox is built for embedded devices and so has a much slimmer set of pre-installed tools.

When managing software on a busybox embedded system you have to be careful not to use up all the internal flash storage memory. In this post, we manage to install all our required packages, and still keep several megabytes free.

I installed everything below on a fresh OpenPLI image, the full install consists of pretty much everything you’ll need on your Dreambox, after the install we still have a whopping 7.6mb free!

Free Space after fresh OpenPLi 4 Install:

# `df -h` straight after a fresh OpenPLi Install
Filesystem   Size    Used    Available  Use%  Mounted on
/dev/root    60.0M   46.7M   13.3M      78%   /

Free Space after full install (everything below) + reboot (important!):

# `df -h` after installing everything below
Filesystem   Size    Used    Available  Use%  Mounted on
/dev/root    60.0M   50.1M   7.6M       84%   /

Considering how much we are installing, I think that’s a result!

You could increase this further by removing the OpenSSH install if you’re happy with dropbear, this should leave you around 9mb free.



Full basic install of common libraries

Create a file called setup.sh on your Dreambox in your /tmp directory and give it executable permissions.

cd /tmp/
touch /tmp/setup.sh
chmod +x /tmp/setup.sh

Paste the below contents into this file, make sure the #!/usr/bin/env bash is the first line in the file setup.sh, this is the shebang and tells Linux which interpreter to use when executing this file.

#!/usr/bin/env bash

# Show our disk usage before we start
echo && df -h

# We could do a opkg update && opkg upgrade enigma2 && reboot
# then continue with the script, we can update enigma2

# Basic Config for UK (HDMI, 1080i, ac3 false, sat simple single)
#cat <<EOF >> /etc/enigma2/settings
# Removed - causes issues with multiple boxes
#EOF

# Change the Hostname
echo "Anil-DM800HDSE" > /etc/hostname

# Change the default password
passwd

# Install all basics
opkg update && opkg install curl rsync bash libcurl4 libfuse2 kernel-module-fuse \
sambaserver openssh-sftp-server enigma2-plugin-systemplugins-crossepg enigma2-plugin-softcams-cccam

# Install transmission (torrent client)
# TODO - Write up transmission config
opkg install transmission

# Switch our default shell
chsh -s `which bash`

# Create our .bash_profile
cat <<EOF >> ~/.bash_profile
# Custom Bash Profile Commands
alias ls='ls -alh'                        # Better ls output
HISTCONTROL=ignoreboth:erasedups          # no duplicates
HISTIGNORE='vim:vi:ls:bg:fg:history:exit' # Ignore other
HISTIGNORE=' *'                           # Ignore all commands starting with a space
EOF

# Create our ssh config file (Forward our agent for all hosts)
mkdir -p ~/.ssh/
cat <<EOF >> ~/.ssh/config
Host *
ForwardAgent yes
EOF

# Remove all other languages (backup en, delete all, copy en back)
cp -a /usr/share/enigma2/po/en /tmp/
rm -rf /usr/share/enigma2/po/*
cp -a /tmp/en /usr/share/enigma2/po/

# Remove all other language icons
cp -a /usr/share/enigma2/countries/en.png /tmp/
cp -a /usr/share/enigma2/countries/missing.png /tmp/
rm -rf /usr/share/enigma2/countries/*
cp -a /tmp/en.png /usr/share/enigma2/countries/
cp -a /tmp/missing.png /usr/share/enigma2/countries/

# User Specific
# Add a custom host to our hosts file for the DM's
echo "192.168.1.10 dm1" >> /etc/hosts
echo "192.168.1.20 dm2" >> /etc/hosts

# Echo a blank line and our disk usage before the reboot
echo && df -h
reboot && exit

User specific upgrades

# All in one
opkg --force-remove remove dropbear && opkg install openssh openssh-misc enigma2-plugin-extensions-screengrabber enigma2-plugin-extensions-autobouquets-e2 enigma2-plugin-extensions-httpproxy enigma2-plugin-extensions-openwebif

# Individually

# Remove dropbear for OpenSSH
opkg --force-remove remove dropbear
opkg install openssh openssh-misc

# After reboot your can optionally install other user specific libs
# Install Other apps
opkg install enigma2-plugin-extensions-screengrabber
opkg install enigma2-plugin-extensions-autobouquets-e2
opkg install enigma2-plugin-extensions-httpproxy

# Upgrade OpenWebIf
opkg upgrade enigma2-plugin-extensions-openwebif

Swap space

A Swap file is not required, it will do more harm than good, If you need swap space, (cat /proc/meminfo), you should have a look at your installed plugins and what’s hogging your processor and memory.

Here’s an example of setting up a custom swap space partition.

# Do this only if you are adjusting swapfile size, adjust this to where you have a swapfile at the moment if any
/sbin/swapoff       /hdd/swapfile
# adjust /hdd to where the device is mounted that you want the swapfile on; adjust count=32 to size of swap in MB
/bin/dd if=/dev/zero of= /hdd/swapfile bs=1048576 count=32
/sbin/mkswap /hdd/swapfile
/sbin/swapon /hdd/swapfile

Debugging issues on your dreambox

You can run the following command on your Dreambox (through telnet or ssh) to restart your box and log everything happening to your screen, this can help immensely in debugging problems with your DM.

init 4; sleep 4; enigma2;


Common directories and locations for your dreambox

These are some of the common locations you may use whilst administering your Dreambox.

# Plugins
/usr/lib/enigma2/python/Plugins/Extensions/

# Global Settings - (a File)
/etc/enigma2/settings

# Skins
/usr/share/enigma2/

# Delete unused languages
/usr/share/enigma2/po/

Change the root password

The very first thing to do after installing a new image is to change the root password, you can do this using:

passwd

You’ll be prompted to change the password of whoever you are logged in as.


Setup SSH key’s for password-less access

You can setup SSH keys between your devices so you can log into your machine without a password.

# Create an SSH keypair (save it into ~/.ssh/dreambox)
ssh-keygen

# Add that keypair to your identity file
ssh-add ~/.ssh/dreambox

# Next, copy the public ssh key to your box's authorized_keys file
cat ~/.ssh/dreambox.pub | ssh root@192.168.1.10 "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"

# Now you should be able to ssh into your box without a password
ssh root@192.168.1.20

You may also want to setup an SSH key between 2 Dreamboxes. OpenPLi uses dropbear as it’s SSH client and so has some quirks in it’s usage compared to OpenSSH, mainly that you have to provided the identity file when connection (it does not find it like with OpenSSH).

You can configure a dropbear SSH key like so:

# We need to convert our dreambox key to a dropbear format
dropbearconvert openssh dropbear dreambox dreambox.db

# The other host already has this key in their authorized_keys file

ssh -i ~/.ssh/dreambox.db root@192.168.1.20

# You can setup a alias in your `.bash_profile` to make things easier
alias ssh='ssh -i $HOME/.ssh/dreambox.db'

# You can also add an entry in your `/etc/hosts` file to clean it up further
192.168.1.20 dm2

# Now to connect.. (from one box to another)
ssh root@dm2

Install bash shell

I like using Bash shell over the default Bourne Shell (sh) provided in OpenPLi, you can install this using:

# Install Bash
opkg install bash

# Make Bash the default for the current user
chsh -s `which bash`

# Logout and log back in

# You can now create a ~/.bash_profile file to hold your configuration
cat <<EOF >> ~/.bash_profile
# Custom Bash Profile Commands
alias ls='ls -alh'                        # Better ls output
HISTCONTROL=ignoreboth:erasedups          # no duplicates
HISTIGNORE='vim:vi:ls:bg:fg:history:exit' # Ignore other
HISTIGNORE=' *'                           # Ignore all commands starting with a space
EOF


CrossEPG not working or downloading EPG listings

I’ve found that after a clean install of OpenPLi 4, I couldn’t get CrossEPG to work with the Sky UK EPG (I can get Rytec feeds to work). After a little debugging (using the debug command above), I found this was down to libcurl4 not being installed.

# Install CURL to fix CrossEPG issues
opkg install libcurl4

# If you haven't already, install CrossEPG
opkg install enigma2-plugin-systemplugins-crossepg

After installing libcurl4 go back to the CrossEPG download menu and try another download.

tada!


How to mount a NTFS USB HDD to your dreambox

Plug your USB device in and run the following command sfdisk -l, you should see all the partitions of the detected devices.

Your USB devices will most probably be under /dev/sdb1, /dev/sdb2.

Read more info here on auto mounting: http://unix.stackexchange.com/questions/72393/mounting-all-partitions-on-hard-disk-automatically-on-linux-mint

You can mount your USB device/HDD using:

# /dev/sdb1 - The drive your mounting
# /mnt/usb1 - Where you want to mount it to (directory must exist)
mount -t ntfs /dev/sdb1 /mnt/usb1

I had the following error when trying to mount a USB NTFS drive using OpenPLi 4:

modprobe: FATAL: Module fuse not found.

I solved it by installing the packages kernel-module-fuse and libfuse2.

opkg install libfuse2 kernel-module-fuse

After this you should be able to just restart your Dreambox and the drives should auto mount into /mnt/DRIVE_NAME. If it does not you can manually mount it using the above command.

The /mnt/usb1 directory should exist, if it does not you will see the following error.

ntfs-3g-mount: failed to access mountpoint /media/usb1: No such file or directory
mount: mounting /dev/sdb1 on /media/usb1 failed: No such file or directory

Install OpenSSH SFTP server

If you want to SFTP to your box to copy files amongst other things, you’ll need to install an SFTP server, you can install this using:

opkg install openssh-sftp-server

Now you should be able to SFTP to your box, the standard port to connect to is 22, username root (or another user if you created one), and password dreambox (default).


Install a samba server

You can install a samba server using:

opkg install sambaserver

After installation you can edit /etc/samba/smb.conf to add your own servers.

$ vi /etc/samba/smb.conf

# Example
[USB]
  comment = External USB HDD
  path = /media/SAMSUNG
  writable = yes
  valid users = root
  read only = no
  public = no
  guest ok = no

Install rsync

rsync is awesome, I wish it was bundled with the OpenPLi installation. Luckily you can install it easily using:

# Install rsync
opkg install rsync

Example shell script using it:

#!/bin/sh

# rsync [-options] [source] [dest]
# -a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
# -z : compress file data
# -v : verbose
# -h : human-readable, output numbers in a human-readable format
# -r : indicates recursive
# -P : equivalent to --partial --progress
# -n, --dry-run perform a trial run with no changes made
# View `rsync --help` on your own box for more options (copy symlinks, etc..)

# `Directory` has `file1.txt, file2.txt, etc..`
# Note: I have removed the `-z` (compression) flag when copying locally

# Will copy the CONTENTS of `Directory` (but not the directory itself) into `LocalDirectory`
rsync -avhrP "/media/EXTUSB/Directory/" "/media/hdd/movie/LocalDirectory/" -n
# `LocalDirectory` will now contain `file1.txt, file2.txt, etc`

# Notice no trailing slash `/` after `Directory`
# Will copy the DIRECTORY ITSELF (and recurse `-r`) into `LocalDirectory`
rsync -avhrP "/media/EXTUSB/Directory" "/media/hdd/movie/LocalDirectory/" -n
# `LocalDirectory` will now contain `Directory` (which is a directory) that contains `file1.txt, file2.txt, etc`

Copying files

You can also copy files and directories using the traditional Linux shell command cp. You should stick with rsync, it only copies the changed files and also gives you progress information, if your getting slow speeds copying locally (using rsync), make sure you remove the z (compression) flag from the rsync command.

# Usage: cp [OPTIONS] [SOURCE] [DEST]
# `-a` (Same as -dpR) -d = Preserve symlinks, -p = Preserve file attr, -r = Recurse

# Copy the directory from the externally mounted HDD to the internal dreambox HDD
cp -a "/media/EXTUSB/Directory" "/media/hdd/movie/"

# `movie` now contains `Directory` (with all it's files)