Here is my presentation to the Raspberry Pi Einführung @ PiAndMore 8 (Trier, 16.01.2016)
RPiEinführung_PiAndMore8.pdf (4,42 MB, PDF)
Videorecording of the talk can be found here
IT Systemelektroniker & Master of Science, IT Security, Networks, Embedded Systems, Docker Campus Ambassador and Raspberry Pi Geek
Computer Stuff
Here is my presentation to the Raspberry Pi Einführung @ PiAndMore 8 (Trier, 16.01.2016)
RPiEinführung_PiAndMore8.pdf (4,42 MB, PDF)
Videorecording of the talk can be found here
Ok, an little update on the PiZero Cluster Front:
Now, that OTG is compiled directly into the "next" kernel of RPi, we can use the OTG USB Virtual Ethernet directly - which makes it a lot easier. So I updated this :).
0. Preparing Minibian Jessie Image
I used some old Appliance Image I created from an Minibian Wheezy Image (https://minibianpi.wordpress.com/) earlier this year - for the 1.) section on the RPi Modell B pre 2.0 and RPi Modell A+. For the 2.) section, I used an special Appliance Image I made from an Minibian Jessie Image. However, I will document needed changes here, to get it running from any source. I recommend the Minibian Jessie Image as starting point, with this changes:
apt-get update
apt-get install -y raspi-config keyboard-configuration
raspi-config
# Default Configuration and Expand Filesystem using raspi-config
# Enter Finish and press Yes on Reboot the Device
apt-get install -y rpi-update sudo
apt-get -y dist-upgrade
reboot
rpi-update
reboot
# Create Default User pi
adduser pi
# Enter Password as wanted, i.e. raspberry
# Add user to default groups
usermod -a -G pi,adm,dialout,cdrom,audio,video,plugdev,games,users pi
# Add sbin Paths to pi
echo 'export PATH="$PATH:/sbin:/usr/sbin:usr/local/sbin"' >> /home/pi/.bashrc
# Add user to sudo
visudo
# Add under
# # User privilege specification
# root ALL=(ALL:ALL) ALL
pi ALL=(ALL:ALL) ALL
# Save and Exit
reboot
# Disable root login
sudo passwd -l root
or - and default RPi Jessie Image.
1. Building mpich 3
# Update and Install Dependencies, then reboot
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get install -y build-essential
sudo reboot
# Make MPICH 3.2
cd ~
wget http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gz
tar -xvzf mpich-3.2.tar.gz
cd mpich-3.2
# This will take some time
sudo ./configure --disable-fortran
# This will take several cups of tea ;)
sudo make
sudo make install
# Create SSH on Master, distribute to Slaves
cd ~
ssh-keygen -t rsa –C "raspberrypi"
Default location should be set to /home/pi/.ssh/id_rsa if you're using the standard user pi. Then choose this command to distribute the key to all your "slave maschines":
cat ~/.ssh/id_rsa.pub | ssh pi@IP_OF_SLAVES "mkdir .ssh;cat >> .ssh/authorized_keys"
( Was taken from http://www.southampton.ac.uk/~sjc/raspberrypi/ - he was the original father of the RPi Clusters and his work inspired me already years ago - so please read and support his work :)! Additional infos can be found at http://westcoastlabs.blogspot.co.uk/2012/06/parallel-processing-on-pi-bramble.html)
You could also just
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
to your own authorized files, shutdown your Master Pi after that and clone the card several times for all your Clients. This way, you would only need to do the work once - however, maybe you should release the keys in ~/.ssh/ so that only your Master Pi could command the slaves
2. PiZero on Virtual Ethernet
I build my MPICH as mentioned in 1) on an Minibian Jessie image (SDCard running on an RPi B). Then I installed the new RPi Kernel and prepared the image for OTG Ethernet, using the new information provided by NicoHood:
#install new kernel with OTG support
sudo BRANCH=next rpi-update
# This is required in the config.txt
echo "device_tree=bcm2708-rpi-zero.dtb" | sudo tee -a /boot/config.txt
# Regarding the readme this is applied automatically for a pi zero (and yes it works without) - so not really needed
# echo "dtoverlay=dwc2" | sudo tee -a /boot/config.txt
# Only use this, if the new kernel causes sd card errors
# echo "dtoverlay=mmc" | sudo tee -a /boot/config.txt
# permanently add the g_ether (or any other) module, add it to /etc/modules
echo "dwc2" | sudo tee -a /etc/modules
echo "g_ether" | sudo tee -a /etc/modules
# Add settings to network interfaces
echo '
allow-hotplug usb0
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
broadcast 192.168.7.255
gateway 192.168.7.1
dns-nameservers 8.8.8.8' | sudo tee --append /etc/network/interfaces
# Some additional tweaks:
Add
# Turn HDMI Off
/usr/bin/tvservice -o
# Turn HDMI Back On
#/usr/bin/tvservice -p
# Turn ACT LED Off on Pi Zero
echo none | tee /sys/class/leds/led0/trigger
echo 1 | tee /sys/class/leds/led0/brightness
to your /etc/rc.local before exit 0 to turn off the HDMI Interface on boot,
as well as the LED of the Pi Zero to use less energy. Found on:
http://www.midwesternmac.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy and http://www.midwesternmac.com/blogs/jeff-geerling/controlling-pwr-act-leds-raspberry-pi
This was enough to create an Pi Zero Slave Image.
Shutdown the RPi now with
sudo shutdown -h now
remove the Power and insert the SDcard into your Pi Zero.
On the Master Machine, I did following changes:
# Add settings to network interfaces
echo '
allow-hotplug usb0
iface usb0 inet static
address 192.168.7.1
netmask 255.255.255.0
network 192.168.7.0
broadcast 192.168.7.255' | sudo tee --append /etc/network/interfaces
# Allow Ipv4 Forward
echo 'net.ipv4.ip_forward=1' | sudo tee --append /etc/sysctl.conf
# Install iptables
sudo apt-get install -y iptables
# Define NATing rules
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
# Save NAT rules / load iptables on interface up
sudo touch /etc/iptables_masq.rules
sudo chown pi:pi /etc/iptables_masq.rules
sudo iptables-save > /etc/iptables_masq.rules
Add
pre-up iptables-restore < /etc/iptables_masq.rules
under the eth0 section in the network interfaces
sudo vi /etc/network/interfaces
i.e.
auto eth0
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables_masq.rules
( Info taken from: http://serverfault.com/questions/405628/routing-traffic-on-ubuntu-to-give-raspberry-pi-internet-access )
#After that, I shutdown the RPi via
sudo shutdown -h now
#removed power from it.
Then I attached the Pi Zero to the Hub of Pi B via an Micro USB Cable by using the Micro USB OTG Slot on the Pi Zero, connecting it to the Hub of the Pi Modell B. Next, I powered up the Pi B - and both booted.
I pinged 192.168.7.2 - which was the IP of the Pi Zero - and it answered. Now I only had to use cat ~/.ssh/id_rsa.pub | ssh pi@192.168.7.2 "mkdir .ssh;cat >> .ssh/authorized_keys" from Section 0 to get the SSH Key, created in Step 0 onto the Pi Zero and could use that to automatically login in into the Pi Zero.
With the new IP of the RPi B and Pi Zero in the machinefile of mpich I could then use my both RPis with higher speed and nearly zero costs for cabeling and power :)!
The clou: I don't need an additional powersupply for the Pi Zero - nor network adapters, RJ45 cabling, an switch - only one USB A to USB Micro cable per Pi Zero - and maybe an big, active USB Hub ;)!
Now, I need to get more Pi Zeros - I plan on using an Modell B as Master with an big active USB Hub to support 4 Pi Zeros - or an Modell B+ with an REALLY BEFFY USB Supply to work them all the same RPi - but that would come down to trying this... And I got only one Pi Zero - so I need some more time (or some sponsors?) to get me more RPi Zeros to try and see, whether this approach does scale ;)!
Best thing: This can also be used to try the awesome work of http://blog.hypriot.com/ to build an Docker Cluster from that - cool, ain't it?
This is a short guide to install the recent Docker Version from the official ppa on Ubuntu 14.04 LTS - along with some other great tools like docker-compose.
Please bear in mind, that Docker needs an 64 Bit System to work with :)! So no i686 plattforms from here on.
# Add Docker Key
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
# Add Repo
echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" | sudo tee /etc/apt/sources.list.d/docker.list
# Update and Install
sudo apt-get update
# Install Recommended Package
sudo apt-get install linux-image-extra-$(uname -r)
# Install Docker itself
sudo apt-get install docker-engine
# Useradd - so you can use docker with your own user without sudo
sudo usermod -aG docker ${USER}
# Install pip
sudo apt-get install python-pip
# Install docker-compose
sudo pip install docker-compose
# Test Docker Install
sudo docker run hello-world
# After an additional reboot, you will be able to use docker with your own user (also recommend because of the the new linux-image-extra 🙂
This post is outdated, the plugin in question does not exist anymore. I would recommend to use "Kee" (https://www.kee.pm/) plugin - but please as bridge to KeePass Password Safe 2 - and not in its own database mode 🙂
I really loved KeeFox, an cool tool which let you use KeePass2 as Password Safe for your Firefox Passwords.
But today, I use Chrome - so no KeeFox for me anymore. And I really do not like the "Synchronize Password" Feature of Google.
So... chomeIPass it is ;)!
Windows:
( from http://diantokam.blogspot.de/2013/12/integrating-keepass-2-with-chrome.html )
1.) Install Chrome and KeePass2 ( http://keepass.info/download.html )
2.) Download KeePassHttp.plgx from the Github Repo: https://github.com/pfn/keepasshttp/blob/master/KeePassHttp.plgx?raw=true
3.) Move the KeePassHttp.plgx to the C:\Program Files (x86)\KeePass Password Safe 2\ folder
4.) Start KeePass2
5.) Install the Chrome Plugin: https://chrome.google.com/webstore/detail/chromeipass/ompiailgknfdndiefoaoiligalphfdae
6.) Click on the new KeePass Icon in Chrome, click on Connect and check KeePass which should Ask for a "New Key Association" - aka Pairing from Chrome with KeePass2. Give it a uniqe Key name, like Chrome Windows Main PC - and klick Save.
7.) Go to a password protected website - a pop up from KeePass2 should ask wheter it is allowed to give the already saved credentials to Chromium, Allow it.
Ubuntu:
( from http://askubuntu.com/questions/130627/how-to-integrate-keepass-and-chrome-chromium-using-chromipass )
Hint: As correctly pointed out by "H.R." in the comments, it is not recommended to install software from an untrusted source, like jtaylors keeps ppa. It is correct that jtaylor does not seem to be a part of the keepass2 team, hence his ppa is flagged as outside of keepass and "untrusted" - however, his ppa linked and recommended by the keepass team to install on Ubuntu. You can always build the program from sourcecode yourself, which I will not describe here, hence this post is over 4 years old and not applicable anymore, as the Chromium Password Manager does not even exist anymore.
1.) Install Chromium and KeePass2:
sudo apt-add-repository ppa:jtaylor/keepass
sudo apt-get update
sudo apt-get install keepass2 mono-complete chromium
2.) Download KeePassHttp.dll and Newtonsoft.Json.dll from the Github Repo: https://github.com/pfn/keepasshttp/blob/master/mono/KeePassHttp.dll?raw=true
https://github.com/pfn/keepasshttp/blob/master/mono/Newtonsoft.Json.dll?raw=true
3.) Move both files to /var/lib/keepass2
cd ~/Downloads
sudo mv KeePassHttp.dll /usr/lib/keepass2/
sudo mv Newtonsoft.Json.dll /usr/lib/keepass2/
4.) Start KeePass2
5.) Install the Chrome Plugin: https://chrome.google.com/webstore/detail/chromeipass/ompiailgknfdndiefoaoiligalphfdae
6.) Click on the new KeePass Icon in Chrome, click on Connect and check KeePass which should Ask for a "New Key Association" - aka Pairing from Chrome with KeePass2. Give it a uniqe Key name, like Chrome Windows Main PC - and klick Save.
7.) Go to a password protected website - a pop up from KeePass2 should ask wheter it is allowed to give the already saved credentials to Chromium, Allow it.
As I saw Jeff Geerlings Website and his iperf Benchmarks of different RPis (Link), I wondered how the RPi Zero would perform by using the USB Virtual Ethernet Interface on my Windows 7 x64 PC.
So I got the latest iperf 2 Version (iPerf 2.0.5-3) from the iperf Website at https://iperf.fr/iperf-download.php, installed iperf from the Raspbian Jessie Packages and launched the iperf Server on my Windows 7 x64 PC via iperf -s. The PC was attached to an Gigabit Switch via an Gigabit Ethernet Interface - so no bottleneck here.
Then I started the iperf tests via iperf -c IP -t 20 -i 2.
And these are results:
RPi Modell B Version pre 2
------------------------------------------------------------
Client connecting to 192.168.2.4, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.2.98 port 37217 connected with 192.168.2.4 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 13.9 MBytes 58.2 Mbits/sec
[ 3] 2.0- 4.0 sec 13.9 MBytes 58.2 Mbits/sec
[ 3] 4.0- 6.0 sec 13.6 MBytes 57.1 Mbits/sec
[ 3] 6.0- 8.0 sec 14.4 MBytes 60.3 Mbits/sec
[ 3] 8.0-10.0 sec 14.5 MBytes 60.8 Mbits/sec
[ 3] 10.0-12.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 12.0-14.0 sec 14.5 MBytes 60.8 Mbits/sec
[ 3] 14.0-16.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 16.0-18.0 sec 14.5 MBytes 60.8 Mbits/sec
[ 3] 18.0-20.0 sec 14.5 MBytes 60.8 Mbits/sec
[ 3] 0.0-20.0 sec 143 MBytes 60.0 Mbits/sec
60 MBit/s? Well... That is not as good as thought...
RPi Modell B v2
------------------------------------------------------------
Client connecting to 192.168.2.4, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.2.161 port 55453 connected with 192.168.2.4 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 14.1 MBytes 59.2 Mbits/sec
[ 3] 2.0- 4.0 sec 14.1 MBytes 59.2 Mbits/sec
[ 3] 4.0- 6.0 sec 14.0 MBytes 58.7 Mbits/sec
[ 3] 6.0- 8.0 sec 14.8 MBytes 61.9 Mbits/sec
[ 3] 8.0-10.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 10.0-12.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 12.0-14.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 14.0-16.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 16.0-18.0 sec 14.5 MBytes 60.8 Mbits/sec
[ 3] 18.0-20.0 sec 14.6 MBytes 61.3 Mbits/sec
[ 3] 0.0-20.0 sec 145 MBytes 60.7 Mbits/sec
60.7 MBit/s - ok, the RPi Modell B v2.0 got double the RAM (512 MB) than the old version - but that did not have impact on the network speed.
RPi 2 Modell B
------------------------------------------------------------
Client connecting to 192.168.2.4, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.2.111 port 38411 connected with 192.168.2.4 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 22.6 MBytes 94.9 Mbits/sec
[ 3] 2.0- 4.0 sec 22.4 MBytes 93.8 Mbits/sec
[ 3] 4.0- 6.0 sec 22.5 MBytes 94.4 Mbits/sec
[ 3] 6.0- 8.0 sec 22.5 MBytes 94.4 Mbits/sec
[ 3] 8.0-10.0 sec 22.4 MBytes 93.8 Mbits/sec
[ 3] 10.0-12.0 sec 22.5 MBytes 94.4 Mbits/sec
[ 3] 12.0-14.0 sec 22.4 MBytes 93.8 Mbits/sec
[ 3] 14.0-16.0 sec 22.5 MBytes 94.4 Mbits/sec
[ 3] 16.0-18.0 sec 22.4 MBytes 93.8 Mbits/sec
[ 3] 18.0-20.0 sec 22.5 MBytes 94.4 Mbits/sec
[ 3] 0.0-20.0 sec 225 MBytes 94.2 Mbits/sec
94.2 Mbits/s is a good value, the matches with Jeff ones - so I am feeling a bit better after the bad measurements of the RPi 1 B pre/2.0's...
RPi Zero
------------------------------------------------------------
Client connecting to 192.168.7.1, TCP port 5001
TCP window size: 43.8 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.7.2 port 37992 connected with 192.168.7.1 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 2.0 sec 21.9 MBytes 91.8 Mbits/sec
[ 3] 2.0- 4.0 sec 22.1 MBytes 92.8 Mbits/sec
[ 3] 4.0- 6.0 sec 22.2 MBytes 93.3 Mbits/sec
[ 3] 6.0- 8.0 sec 22.1 MBytes 92.8 Mbits/sec
[ 3] 8.0-10.0 sec 22.1 MBytes 92.8 Mbits/sec
[ 3] 10.0-12.0 sec 22.2 MBytes 93.3 Mbits/sec
[ 3] 12.0-14.0 sec 22.2 MBytes 93.3 Mbits/sec
[ 3] 14.0-16.0 sec 22.2 MBytes 93.3 Mbits/sec
[ 3] 16.0-18.0 sec 22.1 MBytes 92.8 Mbits/sec
[ 3] 18.0-20.0 sec 22.2 MBytes 93.3 Mbits/sec
[ 3] 0.0-20.0 sec 222 MBytes 92.9 Mbits/sec
Finally - and that does come in as a surprise: I though the Pi Zero - attached via USB Ethernet would give me any value between some Mbit and some really odd numbers - but it closely matches an really solid 100 MBit Interface - so... Thats cool :)!
As soon as the Pi Zero came out, I started on thinking about Clusters again. I wanted to create an big - but at the same time, cheap cluster.
Yes, an Pi Zero is not nearly as fast, as an RPi 2. And yes, there are some problems with this idea - especially about the fact, that the Pi Zero is not as common as an - say - RPi Modell B v. 2.0 - but - as this is more about science and trying to just "do it" - I tried it anyway.
TLDR; Yes, it works - and better than you might think :)!
So, the basic problem about the Pi Zero are its interfaces: Yes, we got USB, but none Ethernet Port. So the basic approach would be to buy an 5€ Pi as well as an about 8€ AX88772 Ethernet Interface and some USB OTG Adapters - an we would end up with about 15€+ for each member of the cluster. Well, that is reasonable - but bulky and "not sexy".
0. Building mpich
I used some old Appliance Image I created from an Minibian Wheezy Image (https://minibianpi.wordpress.com/) earlier this year - for the 1.) section on the RPi Modell B pre 2.0 and RPi Modell A+. For the 2.) section, I used an special Appliance Image I made from an Minibian Jessie Image. However, I will document needed changes here, to get it running from any source. I recommend the Minibian Jessie Image as starting point, with this changes:
apt-get update
apt-get install -y raspi-config keyboard-configuration
raspi-config
# Default Configuration and Expand Filesystem using raspi-config
# Enter Finish and press Yes on Reboot the Device
apt-get install -y rpi-update sudo
apt-get -y dist-upgrade
reboot
rpi-update
reboot
# Create Default User pi
adduser pi
# Enter Password as wanted, i.e. raspberry
# Add user to default groups
usermod -a -G pi,adm,dialout,cdrom,audio,video,plugdev,games,users pi
# Add sbin Paths to pi
echo 'export PATH="$PATH:/sbin:/usr/sbin:usr/local/sbin"' >> /home/pi/.bashrc
# Add user to sudo
visudo
# Add under
# # User privilege specification
# root ALL=(ALL:ALL) ALL
pi ALL=(ALL:ALL) ALL
# Save and Exit
reboot
# Disable root login
sudo passwd -l root
or - and default RPi Jessie Image.
Building MPICH 3 was quite easy:
# Update and Install Dependencies, then reboot
sudo apt-get update
sudo apt-get -y dist-upgrade
sudo apt-get install -y build-essential
sudo reboot
# Make MPICH 3.2
cd ~
wget http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gz
tar -xvzf mpich-3.2.tar.gz
cd mpich-3.2
# This will take some time
sudo ./configure --disable-fortran
# This will take several cups of tea ;)
sudo make
sudo make install
# Create SSH on Master, distribute to Slaves
cd ~
ssh-keygen -t rsa –C "raspberrypi"
Default location should be set to /home/pi/.ssh/id_rsa if you're using the standard user pi. Then choose this command to distribute the key to all your "slave maschines":
cat ~/.ssh/id_rsa.pub | ssh pi@IP_OF_SLAVES "mkdir .ssh;cat >> .ssh/authorized_keys"
( Was taken from http://www.southampton.ac.uk/~sjc/raspberrypi/ - he was the original father of the RPi Clusters and his work inspired me already years ago - so please read and support his work :)! Additional infos can be found at http://westcoastlabs.blogspot.co.uk/2012/06/parallel-processing-on-pi-bramble.html)
You could also just
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
to your own authorized files, shutdown your Master Pi after that and clone the card several times for all your Clients. This way, you would only need to do the work once - however, maybe you should release the keys in ~/.ssh/ so that only your Master Pi could command the slaves
1. Frist Try: Serial (did work, but not choosen)
First idea was, to use the Serial Line of the Pi Zero for IP communication:
I wanted to have an Master Pi (Modell B) with Ethernet Port for network connectivity and connect up to 4 Pi Zero to it via Serial. And as the RPis only have one serial port, I would use an Serial to SPI Converter to keep it small and simple. But as it turns out, I could not find the MAX14830 (https://www.maximintegrated.com/en/products/interface/controllers-expanders/MAX14830.html) for sale on the net, so I got two 2 Port MAX3109 Serial to SPI Converters (https://www.maximintegrated.com/en/products/interface/controllers-expanders/MAX3109.html).
They were on the way to my home, so I wanted to already test some basic stuff by using an RPi Modell B pre 2.0 and an RPi Modell A+.
As we only had one serial port, we could only drive the one RPi Modell A+ with that. I will use the B pre 2.0 as Master, and the A+ as Slave. First, we connected both RPis via Serial (both shutdown and unpluged!). Just connect the Serial TX of RPi B to the Serial RX of the RPi A+ and vice versa. Then connect a Ground Pin of the RPi B to the RPi A+. Thats it.
Then we powered on the RPis and made some changes:
(Some ideas taken from MagPi 41: https://www.raspberrypi.org/magpi/)
Guest:
# I actually prepared the whole sdcard of the RPi A+ Guest while having that SD Card in the RPi B - because of the networking connection :).
# Install ppp
sudo apt-get install ppp -y
# Change Hostname
sudo vi /etc/hostname
sudo vi /etc/hosts
# Add DNS Server
echo 'nameserver 8.8.8.8' | sudo tee --append /etc/resolv.conf
# Remove Serial Console
cd /boot
sudo cp cmdline.txt old_cmdline
sudo vi cmdline.txt
# Normal should read about
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsc
# Remove console=ttyAMA0,115200 from that line, save and quit
# Disable Serial Console by using sudo raspi-config and the option, to be sure
# Increase Clock on the Serial Line, so drive the Serial Line at not only 115200 baud, but 1 MBit/s (taken from: http://www.thedevilonholiday.co.uk/raspberry-pi-increase-uart-speed/)
echo 'init_uart_clock=64000000' | sudo tee --append /boot/config.txt
# Add the following line to /etc/rc.local before exit 0
pppd /dev/ttyAMA0 1000000 10.0.5.2:10.0.5.1 noauth local defaultroute nocrtscts xonxoff persist maxfail 0 holdoff 1 &
# and shutdown
sudo shutdown -h now
After that, insert that SD Card into the A+.
Host:
# Now insert the real SD Card for the B into the B and power it on.
# Install ppp
sudo apt-get install ppp -y
# Enable ipv4 Forward for networking access
echo 'net.ipv4.ip_forward=1' | sudo tee --append /etc/sysctl.conf
# Remove Serial Console
cd /boot
sudo cp cmdline.txt old_cmdline
sudo vi cmdline.txt
# Normal should read about
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsc
# Remove console=ttyAMA0,115200 from that line, save and quit
# Disable Serial Console by using sudo raspi-config and the option, to be sure
# Increase Clock on the Serial Line, so drive the Serial Line at not only 115200 baud, but 1 MBit/s (taken from: http://www.thedevilonholiday.co.uk/raspberry-pi-increase-uart-speed/)
echo 'init_uart_clock=64000000' | sudo tee --append /boot/config.txt
# Reboot
reboot
# After having rebooted the RPi B, boot up the RPi A+ as well.
# Wait a little bit, then...
# Start PPP Connection
sudo pppd /dev/ttyAMA0 1000000 10.0.5.1:10.0.5.2 proxyarp local noauth nodetach nocrtscts xonxoff passive persist maxfail 0 holdoff 1
In a new putty window, you can now ping 10.0.5.2 - your RPi A+ and can SSH into it.
After that, I could use MPI with both machines, B and A+ - by entering their IP addresses into the machinefile and executing the cpi example to crunch some Pi Numbers.
But after all - it was quite ineffective and slow. So I tried to think of something better.. And then LadyAda came with her christmas present to me:
https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/ethernet-gadget - that was the moment my jaw dropped and I thought "YES! Thats it!".
2. Second Try: PiZero on Virtual Ethernet (Solution)
Now my prefered solution: As the USB Port of the PiZero is an real OTG Port, you could repurpose it as an Serial or even Virtual Ethernet port. And hell, Lady Ada striked again :)! So to sum it up shortly:
I build my MPICH as mentioned in 0) on an Minibian Jessie image (SDCard running on an RPi B). Then I installed her special kernel:
cd ~
wget http://adafruit-download.s3.amazonaws.com/gadgetmodulekernel_151224a.tgz -o gadgetkernel.tgz
tar -xvzf gadgetkernel.tgz
sudo mv /boot/kernel.img /boot/kernelbackup.img
sudo mv tmp/boot/kernel.img /boot
sudo mv tmp/boot/overlays/* /boot/overlays
sudo mv tmp/boot/*dtb /boot
sudo cp -R tmp/boot/modules/lib/* /lib
# Load virtual ethernet module on boot
echo 'g_ether' | sudo tee --append /etc/modules
# Add settings to network interfaces
echo '
allow-hotplug usb0
iface usb0 inet static
address 192.168.7.2
netmask 255.255.255.0
network 192.168.7.0
broadcast 192.168.7.255
gateway 192.168.7.1' | sudo tee --append /etc/network/interfaces
# Add DNS Server
echo 'nameserver 8.8.8.8' | sudo tee --append /etc/resolv.conf
# Some additional tweaks:
Add
# Turn HDMI Off
/usr/bin/tvservice -o
# Turn HDMI Back On
#/usr/bin/tvservice -p
# Turn ACT LED Off on Pi Zero
echo none | sudo tee /sys/class/leds/led0/trigger
echo 1 | sudo tee /sys/class/leds/led0/brightness
to your /etc/rc.local before exit 0 to turn off the HDMI Interface on boot,
as well as the LED of the Pi Zero to use less energy. Found on:
http://www.midwesternmac.com/blogs/jeff-geerling/raspberry-pi-zero-conserve-energy and http://www.midwesternmac.com/blogs/jeff-geerling/controlling-pwr-act-leds-raspberry-pi
This was enough to create an Pi Zero Slave Image.
Shutdown the RPi now with
sudo shutdown -h now
remove the Power and insert the SDcard into your Pi Zero.
On the Master Machine, I did following changes:
# Add settings to network interfaces
echo '
allow-hotplug usb0
iface usb0 inet static
address 192.168.7.1
netmask 255.255.255.0
network 192.168.7.0
broadcast 192.168.7.255' | sudo tee --append /etc/network/interfaces
# Allow Ipv4 Forward
echo 'net.ipv4.ip_forward=1' | sudo tee --append /etc/sysctl.conf
# Install iptables
sudo apt-get install -y iptables
# Define NATing rules
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o usb0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i usb0 -o eth0 -j ACCEPT
# Save NAT rules / load iptables on interface up
sudo touch /etc/iptables_masq.rules
sudo chown pi:pi /etc/iptables_masq.rules
sudo iptables-save > /etc/iptables_masq.rules
Add
pre-up iptables-restore < /etc/iptables_masq.rules
under the eth0 section in the network interfaces
sudo vi /etc/network/interfaces
i.e.
auto eth0
iface eth0 inet dhcp
pre-up iptables-restore < /etc/iptables_masq.rules
( Info taken from: http://serverfault.com/questions/405628/routing-traffic-on-ubuntu-to-give-raspberry-pi-internet-access )
#After that, I shutdown the RPi via
sudo shutdown -h now
#removed power from it.
Then I attached the Pi Zero to the Hub of Pi B via an Micro USB Cable by using the Micro USB OTG Slot on the Pi Zero, connecting it to the Hub of the Pi Modell B. Next, I powered up the Pi B - and both booted.
I pinged 192.168.7.2 - which was the IP of the Pi Zero - and it answered. Now I only had to use cat ~/.ssh/id_rsa.pub | ssh pi@192.168.7.2 "mkdir .ssh;cat >> .ssh/authorized_keys" from Section 0 to get the SSH Key, created in Step 0 onto the Pi Zero and could use that to automatically login in into the Pi Zero.
With the new IP of the RPi B and Pi Zero in the machinefile of mpich I could then use my both RPis with higher speed and nearly zero costs for cabeling and power :)!
The clou: I don't need an additional powersupply for the Pi Zero - nor network adapters, RJ45 cabling, an switch - only one USB A to USB Micro cable per Pi Zero - and maybe an big, active USB Hub ;)!
Now, I need to get more Pi Zeros - I plan on using an Modell B as Master with an big active USB Hub to support 4 Pi Zeros - or an Modell B+ with an REALLY BEFFY USB Supply to work them all the same RPi - but that would come down to trying this... And I got only one Pi Zero - so I need some more time (or some sponsors?) to get me more RPi Zeros to try and see, whether this approach does scale ;)!
Best thing: This can also be used to try the awesome work of http://blog.hypriot.com/ to build an Docker Cluster from that - cool, ain't it?
Merry Christmas :)!
Yours,
Nico
Hello there,
now that finally the Letsencrypt.org project is alive, I did secure this blog with an SSL Certificate (yes, was about time!).
I did already pariticipate in the closed beta and secured about 5 websites (among them some RPis, of course!) and private hosted embedded devices.
Worked like a charm :)!
If you want to find out more about this awesome project or secure your website - go to https://letsencrypt.org/.
Let's encrypt all the things :)!
If you start using Raspberry Pis, you will run out of Sdcards rather quickly. Reason for this is, there are so many awesome Distros you would like to use - that you are becoming something like an Discjokey for Sdcards: An awful load of sdcards with just some 100 MBs of distros - spread all over your desk. And while sdcards are somehow cheaper than they used to be - today - it is still an awful waste of money.
Enter BerryBoot:
BerryBoot is an multiboot OS for Raspberry Pi (1 & 2).
It does use packed (squashfs) Images of different OSes, boots into them by using a shared library base and saves differences onto its own data structure on a second (ext4) partition. Quite cool!
To use Berryboot, just head over to http://www.berryterminal.com/doku.php/berryboot and download your copy.
HOWEVER, there are some caveats:
The CEC function does not work correctly on the current RPi 1 Version - so you can't navigate the menu of BerryBoot or i.e. OpenElec via your TV IR Remote. This seems to be due to a bug in the Raspberry Pi start files. RPi 2 Version does work well... So I tried to mesh the two versions - and it worked in the end. So my receipe is the following:
1.) Download from http://www.berryterminal.com/doku.php/berryboot the berryboot-20140814.zip ( http://downloads.sourceforge.net/project/berryboot/berryboot-20140814.zip ) as well as the berryboot-20150916-pi2-only.zip ( http://downloads.sourceforge.net/project/berryboot/berryboot-20150916-pi2-only.zip ).
a) If you do not yet use berryboot:
2.) Now, format your Sdcard (if you are newly creating a Berryboot System) to fat32.
3.) Unzip all files from the berryboot-20150916-pi2-only.zip to the root of the newly created Sdcard. Then unzip ONLY the kernel_rpi_aufs.img from berryboot-20140814.zip and copy it to the Sdcard.
b) If you own a Berryboot RPi 1 Sdcard and want to upgrade:
2.) Make a backup of your current berryboot sdcard! MANDATORY! Remove all files from the fat32 berryboot partition (the one with the config.txt, start files, etc.)
3.) Unzip all files from the berryboot-20150916-pi2-only.zip to berryboot partition. Then unzip ONLY the kernel_rpi_aufs.img from berryboot-20140814.zip and copy it to the Sdcard.
If you want to decide which image should be booted "on boot":
Just create on the berryboot data partition in /data/ an textfile named "default" and enter which image should be loaded, i.e.: OpenELEC_6.0.0.img128
There should also be an default_bootonce or so called file which does only boot on the next boot up - but i have not tried that.
With that knowledge, you could mount the berryboot data file from an booted image and change - while beeing in the system - the next bootimage via commandline.
Neat :)?
Warning: The R400, R600 and R700 series of presenters are attack vectors and considered harmful. While Heise made an article that detailed that Logitech would exchange the receivers, it did actually not. They sent out a pair of incompatible C-U0014 receivers which could not be paired with R-R0004 presenters and then stopped their program, claiming only to exchange the presenter if it was under warranty, which is a security nightmare (I just tried to get the correct receiver, but Maven M. from Logitech wanted to have the receipt for the module which I obviously do not have anymore). In other words: The hardware is extremely vulnerable, Logitech accepts that it is like that but does not want to get this fixed, so I can only recommend to dispose of the presenter line and do not buy from Logitech anymore. Here is the security write up with the proof of concept to that attack: https://seclists.org/fulldisclosure/2016/Oct/60

To pair an old R400 presenter with a new dongle (or vice versa), try to get the right dongle for your presenter version first:
As stated here, there are two versions of dongles for the presenters - and they are not interchangable:
"There are two versions of presenter receivers that can't be interchanged.
C-U0005
Use the C-U0005 receiver with these presenters:
Wireless Presenter R400 with M/N = R-R0004
Professional Presenter R700 with M/N = R-R0006
Professional Presenter R800 with M/N = R-R0003
C-U0014
Use the C-U0014 receiver with these presenters:
Wireless Presenter R400 with M/N = R-R0008
Professional Presenter R700 with M/N = R-R0010
Professional Presenter R800 with M/N = R-R0009
You can find the model number (M/N) of your presenter inside the battery compartment."
After that, download the Logitech Presenter Connection Software from here (Sorry, only Windows...), start the file and unzip the content.
Update again to this post from 2015 now in 2021: Logitech removed the links from its website, but you still can find the file on its ftp server: ftp://ftp.logitech.com/pub/techsupport/mouse/presenter_connection_zipped.exe ;).
Start the file and unzip the content.
Then, connect your dongle, find the logitech_presenter_connection.exe and start it. After that, the software will ask you to power up your presenter while holding down the to the left and to the right keys of the presenter. 3+ seconds after powering up and holding down the keys, you can release the keys, turn off the presenter again and click Ok in the software. Power on your presenter again and see if it works, if not - try the procedure again.
Update (2019): Had to update the links as they were from 2015 and have changed due to Logitech deciding to changing their design (Thanks Michael!). Also please note the R400, R700 and R800 presenters are considered insecure and the dongles are now replaced by Logitech: https://www.heise.de/security/meldung/Angreifbare-Logitech-Presenter-Hersteller-tauscht-gefaehrliche-USB-Empfaenger-aus-4423627.html
Update (2021): Had to update the download link again, thanks Christopher for asking. But I guess you need to start the software with admin rights (maybe even Win XP, Win 7 "emulation"?), I could not pair my second dongle right now, but the battery is also nearly flat, so that should be an issue.... the software as what I had back then... Maybe it helps some one 🙂
Sometimes, you see things you just want to refuse to believe.
While it is true that most problems and quirks of software or hardware are due to really profound reasons and can be fixed quickly, sometimes you just cannot find them easily, if something unexpected happend - something which you never even thought of or you just found to be impossible.
My gamechanger - for the WORST - has been Telekom, which I happily would like to propose for the next BigBrother Award:
To cut a long story short: A friend of mine did order an Webhosting Account at all-inkl.com - and this did work without any problem.
I did configure some Domain Redirection, Mail Accounts, included them to the Android Phone of that friend - everything was working just fine.
However, as soon as the person arrived at home, Mail did not work anymore on the phone.
After trying to track down the problem for far too long, I did call the (very nice) support and got some immediate help:
"Are you using a Telekom Line?" - well... Yeah? - "Oh.. Well, they include SMTP Whitelists in the new routers, to stop spammers and we are not on this whitelist... So you can recieve but not send mail..." - WAIT. WHAT?!
A quick check on the WIFI Symbol, IP Range of the Phone and an Network IP DOT 1 in the friendly browser later - "Speedport W724v - What can I do for you?" - Well, [D|F|S][a-z][a-z][a-z]!
Turns out, the new W724V, Entry 2 and Hybrid Home Routers of the Telekom "feature" an SMTP Server WHITELISTE. So if you try to use your nice myname.de SMTP Server - nop'! You have to include your own Servers to that list, otherwise connection will be blocked - regardless if you try to communicate via Port 25 or 587 via SSL or encrypted formats. Really, hot, bad, nasty stuff.
One could mention that fighting spamers is a good idea, but this approach is as china-like as it is 1984.
So, kudos Telekom - you just made it impossible for "non-IT people" to use their own not Telekom and al. hosted SMTP service!
More can be found on this german site: http://all-inkl.com/wichtig/anleitungen/programme/e-mail/speedport-w724v-hybrid/liste-der-sicheren-e-mail-server_399.html