A collection of notes for setting up a clean image of XBian (1.0 Beta 1) on the Raspberry Pi.
Jump to first login tasks if you have already set up terminal access to the Pi.
- Connecting to the Pi
- Pre-setup; on PC, laptop, etc.
- Transfer files
- First login tasks
- Change Hostname
- Fake a hardware clock
- Link settings to root profile
- Generate new RSA host keys
- Configure WiFi and Bluetooth
- TTL serial console
- Build and install WiringPi
- Remove the desktop environment
- Install Mono
- Install aircrack and related tools
- Regional system settings
- Install dbox (dropbox tool)
- Setup XBMC
- Useful extras, not always used
- Troubleshooting and backup
- Not used with recent versions
Connecting to the Pi
XBian names the default user account
xbian, other distributions normally use
pi. The default password is
raspberry. XBian includes support for zeroconfig (via avahi-daemon), so it’s easier to find your Pi on the network1.
If zeroconfig can’t be used, you can find the Pi’s network IP address and use that to login.
Note: If multiple Pis are active on the same network, they should be given unique hostnames.
Pre-setup; on PC, laptop, etc.
Before setting up the Pi remotely, there are some things to do locally to ease logging in when using SSH. This will obviate the need to enter a password, or specify the full host name each time we access the Pi.
Copy public key to Pi
If generating a new key pair, accept the default key location as suggested by
ssh-keygen below. While a passphrase is optional, anyone can use a copy of the unencrypted private key to authenticate with your identity. Many operating systems are preconfigured to use
ssh-agent or a similar utility, to avoid having to enter a passphrase multiple times (if at all).
The easiest way to append a key to the remote user’s
~/.ssh/authorized_keys file is to use
ssh-copy-id as shown above. Download ssh-copy-id from source if your system doesn’t already have it (installation instructions), this alternative method should also work in most situations.
Add an alias to .ssh/config
Locally define the alias
xb, to be used in place of
email@example.com with commands such as
ssh xb and
sftp xb. Enter the text below as a single command, or manually paste the quoted text into
nano or similar (the IP address can be used for Hostname if preferred).
If you have previous files from your Pi stored locally, you can transfer them using
scp, etc. For easily transferring many arbitrary files , a GUI sftp client is recommended.
First login tasks
Most of the commands below need root privileges on the Pi, as they alter the system configuration. To run a single command with root privileges, prepend the
sudo command to it. To run many commands this way without typing
sudo each time, first start a root shell with
sudo -s; remember to logout with ‘exit’ or ctrl+d when finished.
If it’s likely the Pi won’t be the only one using the local network, then it should be given a unique host name.
Fake a hardware clock
The Pi doesn’t have a real time clock, so it usually defaults to some point in the past until the time can be set correctly using the Internet. To make the clock more consistent across power cycles, it can be initialised using the last recorded date and time. (note: previous distros required the unabridged instructions.)
Link settings to root profile
Occasionally you’ll want to use a root shell, and then be annoyed that your aliases etc. are not configured for the root user. You can either copy the profile files into ~/root or, as shown here, link them symbolically so that any future modifications will be reflected.
Generate new RSA host keys
These keys confirm the identity of the Pi, to prevent a malicious host from intercepting the remote login process. Not so important for your HTPi, but good standard security practice. Also recommended if you have more than one Pi.
If you’re using dropbear instead of openssh, then use:
Configure WiFi and Bluetooth
XBian now includes simple WiFi configuration as part of the xbian-config setup menu. See the manual configuration if you want finer control over the network settings (e.g. connecting to multiple networks).
My bluetooth adapter is not supported in the current build of Raspbian/XBian, but here is the procedure I used when trying to get it running (confirmed working on a laptop running Ubuntu).
TTL serial console
The display of full screen terminal programs becomes corrupted when using a TTL to USB serial connection to the Pi from Mac OS X. Changing the terminal type enables use of programs such as
Build and install WiringPi
WiringPi is a library to access the Pi’s GPIO, SPI, and I2C headers, modelled on the Arduino Wiring system. It also includes the
gpio utility for use of the libraries from the command prompt.
Remove the desktop environment
If you only plan to run the terminal environment (including self-hosted programs such as XBMC), then a lot of space can be recovered by removing x11 and related packages.
Note: this task is not normally required for distros such as xbian.
Install Mono development tools, runtime, and interactive shell.
Install aircrack and related tools
Taken from blog.petrilopia.net.
Regional system settings
Both XBian and Raspbian have system setup menus, but neither seem to setup the console keyboard correctly for the en_GB layout. The current solution I use is to install
keyboard-configuration, which only seems to work once
console-setup is also installed.
The latter package will change the console font, but this can be reverted during the commands shown below. Just choose the font you prefer, or choose ‘Do not change the boot/kernel font’.
Install dbox (dropbox tool)
wget to download the latest versions from the links below, then open the zip files directly from xbmc’s addons page.
If you are storing media in the root folder of an NTFS formatted hard drive, you may see some system folders while using the video/audio file views. You can hide these system folders, change other advanced xbmc behaviour, or preset/lock standard settings in advancedsettings.xml.
Useful extras, not always used
Stuff used infrequently, or currently being tested
Packages from Raspbian
Some standard packages that are usually excluded from the xbian distro, as they are not required for use of xbmc only.
Other useful packages
Find the IP address
You can get the IP address from your Pi, by running either of the following commands locally on the device.
Connect to the address that has the same subnet (starts similar) as the IP address you will be connecting from, ignoring the localhost address (127.0.0.1).
If it isn’t possible to run a command locally on the Pi (e.g. there is no monitor or keyboard attached), you can either scan the network, run
nmap 192.168.0.1/24 -p 22, or view ‘Attached Devices’ in your Router’s setup. Look for a matching hostname or MAC address (which will start with
b8:27:eb for the on-board LAN).
Manually configure WiFi adapter
lsusb to check that the adapter is recognised, and
lsmod to check the kernel module (e.g.
8192cu) is loaded.
Make sure the following lines exist in the interfaces file, adding them as needed:
You may have the line
wireless-power off in this file, which relates to power management only. I’ve commented it out as it resulted in errors logged during
ifup and power management remained off without it.
Add your network details to wpa_supplicant.conf, using the following template:
Reinitialise the adapter, and check it’s connected.
iwconfig to view wifi adapter info and
ifconfig for general network info.
Configure bluetooth adapter
*Note: a bluetooth adapter may be listed in
hciconfig, without being recognised by
hcitool. This is the case with the belkin dongle I have, so use
hcitool to check that a device is working properly.
Use ‘motion’ or ‘fswebcam’, motion may need a default cfg copying
Troubleshooting and backup
Some useful commands and procedures
- You can detect hdmi audio modes:
- Setup CEC remote over hdmi from console:
- Settings, addons etc. are in ~/.xbmc
- .xbmc/userdata - preferences etc
- .xbmc/addons - binaries, themes
- .xbmc/addons/packages - original downloads, can use with “install from zip”
Or using tar..
Not used with recent versions
Previously useful functionality or workarounds
Clear cached network adapter
(needed for switching cards between devices)
Fake a hardware clock (unabridged)
More complicated instructions, as used on previous versions of XBian.
Fix ssh access using public key
Download OpenSSH sftp server
If sftp is not already on your system (such as when using dropbear), it can’t be installed manually without installing the entire openssh package.
Update firmware without kernel
Allow XBMC to unmount USB drives
XBian used to include the usbmount package to mount USB devices as soon as they are connected. This prevented XBMC from bring able to use the udisk service to mount and unmount USB drives itself, due to root privileges being required to unmount devices mounted by usbmount.
Drives can be unmounted manually using
udisks without needing to be root, and members of the
plugdev group can also use
More recent instructions: http://lifehacker.com/5978594/turn-a-raspberry-pi-into-an-airplay-receiver-for-streaming-music-in-your-living-room
A change in IOS 6 requires Perl Net-SDP module to installed.