Boot, ur og email

Når BBB starter op vil jeg have den til at stille uret og sende mig en email.

1. Installer exim4 (email program):

apt-get update
apt-get install exim4

2. konfigurer exim4:

dpkg-reconfigure exim4-config

Mail Server: “mail sent by smarthost; no local mail”
Mail Server configuration: “”


dc_local_interfaces=' ; ::1'

3. opret script til at sende email:
nano /root/

#sleep 60
IP=`hostname -I`
HOSTNAME=`hostname -f`
echo "$HOSTNAME online. IP address: $IP" > /root/email.txt
echo >> /root/email.txt
date >> /root/email.txt
mail -s "$HOSTNAME online" -r root@$HOSTNAME < /root/email.txt
#cat /root/email.txt
rm -rf /root/email.txt

4. Opdater ur og kør email-script:

nano /etc/rc.local

#!/bin/sh -e
# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.

# update clock
ntpdate -b -s -u

# email

exit 0

5. genstart


6. Kontrol:

tail /var/log/exim4/mainlog

BBB Node og RS232

Gør ttyO1 tilgængelig fra boot (bemærk det er ttyO1, ikke tty01, altså et stort o, ikke et 0 (nul)):

# ls -l /dev/ttyO*
crw-rw---- 1 root tty 247, 0 Jul 18 21:42 /dev/ttyO0

Rediger /boot/uEnv.txt

# nano /boot/uEnv.txt


# reboot


# ls -l /dev/ttyO*
crw-rw---- 1 root tty     247, 0 Jul 18 22:13 /dev/ttyO0
crw-rw---T 1 root dialout 247, 1 Jul 18 22:13 /dev/ttyO1

Installer node-serialport, express og

cd /var/lib/cloud9
npm install serialport && npm install express && npm install

Virker under node v0.10.38, npm v1.4.21

BBB Debian static IP

Rediger /etc/network/interfaces

nano /etc/network/interfaces


auto eth0
iface eth0 inet static

Fjern wicd:

wicd er måske installeret og vil OGSÅ bestemme over ip config.
Ved afbrydelse og gentilslutning af netværk bestemmer wicd, ikke /etc/network/interfaces !!!

apt-get remove wicd-daemon
apt-get autoremove



Diverse BBB Debian kommandoer


dpkg-reconfigure tzdata
Stil klokken automatisk:
ntpdate -b -s -u

-b Force the time to be stepped using the settimeofday(2) system
 call, rather than slewed (default) using the adjtime(2) system
 call. This option should be used when called from a startup file
 at boot time.

-s Divert logging output from the standard output (default) to the
 system syslog(3) facility. This is designed primarily for conve-
 nience of cron(8) scripts.

-u Direct ntpdate to use an unprivileged port for outgoing packets.
 This is most useful when behind a firewall that blocks incoming
 traffic to privileged ports, and you want to synchronise with
 hosts beyond the firewall. Note that the -d option always uses
 unprivileged ports.

Stil klokken manuelt:
date -s "Aug 3 17:41 CEST 2015"

400 bad request

So today I decided to work on a pet project of mine, where a Raspberry Pi is controlling a LED light. The Pi is controlled by a website.



When the Pi tries to connect to my local running iis express server, the response is 400 bad request.

Why ohhh why.

IP address… Yes, the servers ip has changed, but I did change the connection url on the Pi, so what then?

A little digging with fiddler didnt show anything. I mean that literally, the connection attempts didnt show on the server, at all.

It turns out it was the %userprofile%\My Documents\IISExpress\config\applicationhost.config that needed a small update to reflect the new ip address.


<binding protocol=”http” bindingInformation=”*:52591:localhost” />
<binding protocol=”http” bindingInformation=”*:52591:″ />


<binding protocol=”http” bindingInformation=”*:52591:*” />

wohooo, no ip address needed, asterix for the win 😀

More on

iis express enable external request

Shameless ripping of info from

Add <binding protocol=”http” bindingInformation=”*:52591:*” />

to the <bindings> section of

%userprofile%\My Documents\IISExpress\config\applicationhost.config

<?xml version="1.0" encoding="UTF-8"?>
      <site name="iCentral" id="1580449741">
          <binding protocol="http" bindingInformation="*:52591:*" />

The snippet above is not a nearly a complete applicationhost.config, it just shows where the binding line is supposed to be in the hierarchy!

Hearthbleed (Raspberry Pi)

The affected versions of OpenSSL are OpenSSL 1.0.1 through 1.0.1f (inclusive). Later versions (1.0.1g and ulterior[60]) and previous versions (1.0.0 branch and older) are not vulnerable. Installations of the affected versions are vulnerable unless OpenSSL was compiled with OPENSSL_NO_HEARTBEATS.

Check openssl version:

$> openssl version -a
OpenSSL 1.0.1e 11 Feb 2013
built on: Sun Mar 24 12:44:00 UTC 2013

That’s bad, update needed!

$> sudo apt-get update
$> sudo apt-get install -y libssl1.0.0 openssl

Check version again:

$> openssl version -a
OpenSSL 1.0.1e 11 Feb 2013
built on: Sun Apr 20 11:41:41 UTC 2014

Version is still one of the affected versions, but build-date indicates a patch.

According to debian backported a patch to 1.0.1e-2+rvt+deb7u5

$> sudo apt-cache show openssl
Package: openssl
Version: 1.0.1e-2+rvt+deb7u7

We are good, just reboot now:

$> sudo reboot

Oh, also replace any and all certificates and make all users replace their passwords, you know the drill.