8 Tricks for your Artbox RPi

I thought I would share a few of the bash tricks I have developed while programming the ARTBOX. These are little timesavers that “should” work on any Raspberry PI (and many unix-like systems) The first one might actually save your day (I know it saved me countless times!)


You forgot your password on the ARTBOX and neither ssh nor the web-interface let you in? Use this trick to regain control.  Just plug a keyboard into the ARTBOX and use trick #2 to get to the command line.

 exec ` sudo htpasswd -b /var/.passes pi “${password}”`

 exec ` sudo su -c "echo 'pi:${password}' | chpasswd"`

(Note the empty space in front of sudo: it prevents bash from saving the command to its history!)



I use the following magic system requests in order to get out of the LOOP (but be careful not do do this via SSH, because it will reboot your computer!!!) If you do this on an artbox, I would recommend letting it boot to the point where the logo finally disappears…

Alt + Print + [letter]

GET TO THE COMMAND LINE: R-E then Alt F2 then Alt F1

But remember, after you do this you will need to

 sudo service apache2 start; sudo service ssh start

because the E command stops all running processes.

REBOOT: R-E-I-S-U-B (busier backwards – as a way to remember it.)


More info: http://en.wikipedia.org/wiki/Magic_SysRq_key



How I like to make images and their backups.

# unmount the SD card
umount /dev/sdb1
umount /dev/sdb2
# become root
sudo su
# make a backup from working image
sudo dd bs=4M if=/dev/sdb | pv -tpreb -s 8G | \ 
dd bs=4M of=/var/www/Rpi_Backup/Artbox_0.5.iso
# make an image from a backup
dd bs=4M if=/var/www/Rpi_Backup/Artbox_0.5.iso | pv -tpreb -s 8G | \ 
dd bs=4M of=/dev/sdb
# sync the SD before removal
# leave root



Want to mount your USB Stick?

sudo mkdir /media/usb
sudo mount /dev/sda1 /media/usb



Find everyone on your network – including your ARTBOX. (you need netcat!)

 for i in {2..255}; do nc -v -n -z -w 1 192.168.1.$i 80; done



Got problems with hfs+ formatted USB Sticks? You are not alone. In order to fix this we had to:

 sudo apt-get install hfsprogs
 sudo mount-t hfsplus -o remount,force,rw /dev/sdx# /mount/point



How I make our screencasts (On Ubuntu 12.4.2)

# make a little webcam window
# fullscreen: k / quit: q
mplayer -cache 128 -tv driver=v4l2:width=200:height=200 -vo xv tv:// -noborder -geometry "95%:95%" -ontop

# show the keystrokes / mouse stuff
key-mon --scale=0.631
# you need to install
# https://code.google.com/p/key-mon/downloads/detail?name=keymon_1.16-1_all.deb

#record everything
ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab  -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 25 -i :0.0 -c:v libx264 -pix_fmt yuv420p  -f mp4 -y intro.mp4



These gems will give you better control over your HDMI / Video output.

# turn all video output off
/opt/vc/bin/tvservice -o

# turn all video output on
tvservice -p
# get info about current screen tvservice -s # turn on the composite, e.g. tvservice --sdtvon="NTSC 4:3" # but if you turn on composite, you'll want to turn it off tvservice -o # but then you can't just turn on hdmi, because it will fall back to # vga (640x480) aka mode 1 or pal (720x480) aka mode 2 # so you'll have to look up your screen's preferred size (or just restart.) tvservice --modes=CEA # and then if 16 (1080p) is your mode: tvservice --explicit="CEA 16 HDMI" # or like a bash ninja who always wants native resolution of the original # device and laughs in the face of those who merely restart tvservice -o;mode=$(tvservice --modes=CEA | grep native | cut -d":" -f1 | cut -d" " -f5); tvservice --explicit="CEA $mode HDMI"