Raspberry Pi setup / configuration stuff

I keep forgetting the stuff and always start over when I have to reformat or the SD card breaks, so here's a collection of useful tidbits when setting up and configuring a Pi. I'll expand this page whenever new stuff pops up...

Adding a root password

When you try to su, you can't when no password is set for root. Do:
sudo passwd
enter a password and su should work.

The Atrix Lapdock

is a great piece of hardware and great interface for the Pi. A 1366x768 screen, HDMI (sound over HDMI too) speakers, keyboard, touchpad, USB hub, even a battery, effectively converting the Pi into a laptop. This page has some nice information about it where I also found the ethernet / WiFi adapter information.

The resolution is 1366x768. To set up video, use these settings in /boot/config.txt (leave the rest at default):
hdmi_group=2 (DMT)
hdmi_mode=86 (1366x768@60Hz, reduced blanking)
hdmi_drive=2 (HDMI mode, sound over HDMI)

When attaching a USB WiFi card via the Lapdock USB hub you run into problems on older Raspian versions (pre-spring 2013) when the ethernet adapter is on. You might not be able to use the network/internet. Also the card uses power unnecessarily. To disable the ethernet adapter run (as root, see above):
echo 1-1.1:1.0 > /sys/bus/usb/drivers/smsc95xx/unbind
You might need to remove and re-insert the WiFi adapter now and should be able to access the network.
There is a script floating around the net which lets you do that automagically when starting up the Pi. Download the script and save it to /etc/init.d/disable-ethernet and then run:
sudo chmod 755 /etc/init.d/disable-ethernet
To make it readable/executable for all users. To enable the script during boot, run:
sudo insserv disable-ethernet
To disable the script from running during boot:
sudo insserv -r disable-ethernet
To disable ethernet by hand, run:
sudo service disable-ethernet start
To enable ethernet by hand (remove the WiFi device before running), run:
sudo service disable-ethernet stop

The rpi-update script

is pretty handy as it gives you the latest firmwares for your Pi. The script resides here, but you can get it with a simple:
sudo apt-get install rpi-update
and run it with:
sudo rpi-update
Makes sure to read the troubleshooting section if youre having problems with your updates.

Install gcc/g++ 4.7

Harder, better, stronger, faster and just a:
sudo apt-get install gcc-4.7 g++-4.7
away. Read here how to switch compiler versions after that.

Add a user to video/audio/input group

This is useful when you want to play games on the Pi. Lots of emulators and frontends need it. Do:
add_user_to_group $user video
add_user_to_group $user audio
add_user_to_group $user input

Install joystick support on the RPi

If you have inserted a joystick, but "/dev/input/js0" does not exists, try:
sudo apt-get install joystick
Now you might need to reboot and "/dev/input/js0" should exist. You can test the first joystick with:
jstest /dev/input/js0