Posts tagged Raspberry Pi

Enable IPv6 on the Raspberry Pi


By default, Raspian comes unconfigured for IPv6. What a shame. To enable IPv6 support just follow these steps:

Enable the IPv6 kernel module by typing this in your shell:

sudo modprobe ipv6

Now, enable IPv6 by default after boot:

sudo echo "ipv6" >> /etc/modules

If needed, adjust your network configuration file by adding IPv6 here. Options are auto or dhcp. In my case, the modem acts as an IPv6 router (XS4ALL fiber). So adding this to the network options enabled DHCP:

sudo echo "iface eth0 inet6 dhcp" >> /etc/network/interfaces

Now reboot with:

sudo shutdown -rf now


Stream audio with Raspberry Pi


I was looking for a cheap solution to stream audio. Cheap does not only mean the costs of the computer where the encoder is running, it also includes the costs to keep it running. With that I mean power consumption and maintenance time. And there is the Raspberry Pi as cheap and energy saving computer. There is only one problem: the Pi does only have audio out. Not audio in.

When you need cheap electronics, Deal Extreme comes into place. If you don’t know the webshop: it’s cheap-ass stuff from China and pricing includes free delivery. Yes, order a $2,09 USB audio card and shipping is free. But be warned. When browsing, you always order more stuff then you need. Delivery takes up about two weeks.

Shopping list:

First things fitst. It’s a known issue that the Raspberry Pi can create some noise with audio playback. To start off, I’d suggest to update to the latest firmware where this issue is resolved. Follow the steps below to install packages needed and upgrade the Raspberry Pi firmware. Don’t forget to reboot afterwards.

sudo apt-get -y install git-core
sudo wget -O /usr/bin/rpi-update
sudo chmod +x /usr/bin/rpi-update
sudo rpi-update
sudo reboot

Now we have to disable the internal audiocard so things get less complicated. First type aplay -l to find your audio device. You shout see something as “bcm2835 ALSA”. This is the onboard card (out) we want to disable. To do this, at the command line, enter “sudo vi /etc/modprobe.d/alsa-base.conf“. Look at the last line which reads “options snd-usb-audio index=-2”. You need to “comment this out” by inserting a “#” at the beginning of the line, which makes it a non-executing or information-only line. Exit vi by pressing [esc] and type :wq!. Now reboot your Raspberry Pi with sudo reboot.

Choose your favorite cup of cake to stream, either IceCast, ShoutCast or something else. Keep in mind that the Pi isn’t the fastest computer so try encoding with low bit rates like 11 or 22 kHz sampling rate to test.

Raspberry Pi with cooling fan and USB audio in

Raspberry Pi with cooling sink and USB audio in

Headless Raspberry Pi with VNC


Okay. There you are. You have your Raspberry Pi. You’ve connected it to your Smart TV with HDMI but wan’t to run it headless, so without a monitor (with expensive HDMI to VGA adapter) and you don’t want to get in trouble with your wife by claiming the TV while she’s watching the daily soaps. If you’re somewhat familiar with SSH, you can install VNC server to the Pi and remote desktop to it’s graphical interface.

Log in to your Raspberry Pi via SSH and install a VNC server with the command: sudo apt-get install tightvncserver. Now start it with the command tightvncserver and set a password if needed. Now we are going to create a startup script and run the service automatically when the Pi boots up. Do this with sudo vi /etc/init.d/vnc, press i to insert text and paste the output below in the editor.

#! /bin/sh
# /etc/init.d/vnc

export USER HOME
case "$1" in
        echo "Starting VNC Server"
        #Insert your favoured settings for a VNC session
        su - $USER -c "/usr/bin/vncserver :1 -geometry 1024x768 -depth 16 > /tmp/vncserver.log 2>&1 &" &
        echo "Stopping VNC Server"
        /usr/bin/vncserver -kill :1
        echo "Usage: /etc/init.d/vnc {start|stop}"
        exit 1
exit 0

Save the file with [esc] :qw! and make it executable with sudo chmod +x /etc/init.d/vnc. Now type this so the VNC server starts when the Pi boots up: sudo /usr/sbin/update-rc.d vnc defaults. Now reboot your Pi to test it. You should be able to create a VNC remote desktop connection to your Raspberry Pi. Use Chicken of the VNC as VNC viewer, both available for Windows and Mac.

Raspberry Pi via VNC

Raspberry Pi via VNC

Locale errors on Raspberry Pi


When loggin in to my Raspberry Pi, just reinstalled with Raspbian, I noticed these errors when connecting via SSH:

locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory

The fix is quite easy. Just regenerate the locales with the command below.

localedef -v -c -i en_US -f UTF-8 en_US.UTF-8
Go to Top