[Ubuntu / Proxmox] Hosting NFSv3 Server on Ubuntu for Proxmox Server

So, yesterday evening y0sh came to me with following problem: "I got an real nice proxmox server with loads of CPU and RAM - and nearly no storage left. And I got an small little Atom Server with loads of Storage - but not very useful as VM Host - and yes, they are within the same network". Ok, so: Lets create an NFSv3 Server on the Atom system and mount it as disk storage within Proxmox 🙂

# Atom Server (Ubuntu)
# Install NFS v3 Server
sudo apt-get install nfs-kernel-server rpcbind
# Create Shared Directories
sudo mkdir -p /var/nfsshare
sudo chmod -R 777 /var/nfsshare
# Configure Server
sudo vi /etc/exports
# Insert the line into exports, with the IP Address of your NFS Client / Proxmox Server
/var/nfsshare 192.168.1.111(rw,sync,no_root_squash)
# save and exit, fine tuning:
sudo vi /etc/default/nfs-kernel-server
# change the line RPCMOUNTDOPTS to
RPCMOUNTDOPTS="--manage-gids --no-nfs-version 4"
# to use nfs v3 ...
# reload the nfs exports...
sudo exportfs -r
# ...or restart the server
sudo /etc/init.d/nfs-kernel-server restart
# show all share directorys
sudo exportfs -v

# Mount NFS in Proxmox
Go to Datacenter, Storage, Add, NFS
IP:

[Art] real-time operator

real-time operator was an project of Melanie Windl, an artist from the University of Mainz, Germany on which I helped as technical advisor and programmer. The idea of the project was to live-record sounds from the staircase of the Tokyo Wondersite and replay them using different filters on multiple ballons (using exciters). The project was realised using three Raspberry Pi, Modell B+, some USB Soundcards and PureData. You can find more about the project here: https://atelier-windl.com/portfolio/real-time-operator-2/

Festival / Festival
real-time operator
09.01.-07.02.2016
Tokyo Wonder Site Hongo
2-4 16 Hongo, Bunkyo-ku, Tokyo 113-0033, Japan

real_02

A short video showing the project can be found here

[RPi] The cheapest Raspberry Pi Cluster Ever Made

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)

ppplink

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)

usblink

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

[Art] Suomalainen Äänimaisema

Suomalainen Äänimaisema was an project of Melanie Windl, an artist from the University of Mainz, Germany on which I helped as technical advisor and programmer. The idea of the project was to field-record several sounds and music of Finland, load them onto some Raspberry Pis and let them play, as soon as a person came close enough to the object. The project was realised using three Raspberry Pi, Modell B+, some PIR sensors and USB Soundcards. You can find more about the project here: https://atelier-windl.com/portfolio/suomalainen-aanimaisema-2/

Exhibition
Suomalainen Äänimaisema
25.03.-02.04.2015
Titanik Galleria, Itäinen Rantakatu 8
20700 Turku, Finnland

Suoma_01

A short video showing the project can be found here

[RaspPi] HDMIPi Repair and VGA Upgrade

Sadly, some weeks ago, the Micro USB Port of my HDMIPi broke.
I wrote an letter to Alex Eames, which is quite known for HDMIPi, RasPi.TV and his lattest Kickstarter Project the RasPiO Duino.
Alex is an awesome guy and gave me his blessings to try to repair that problem myself.
With some flux, a fine solder tip and soem patience, you can get that repaired in no time.
After succeeding, I created some strain-relief by using two-component epoxy resin to glue it down a bit. Highly recommended!

As I already saw the unused VGA pinout on the HDMIPi and had the screen taken apart, I decided to hack an old VGA Connector from an even older VGA ATI/S3 Trio/Dunno-something-very-old Graphics Card :). I just soldered it in - in it worked right away! However, due to the fact of the included 12mm M3 Spacers and the additional height of the board due to the VGA Connector, I could not attach the back plate of the HDMIPi. I don't recall the exact size, but I think I came up with 18mm M3 Spacers which I only used to replace the original 3 Spacers on the bottom part of the HDMIPi. That way, the buttons of the Display would still be seated nicely and I could access the GPIO Ports of the RPi quite well.

Some photos:

hdmipi_1

hdmipi_2

hdmipi_3

hdmipi_4

hdmipi_5

[RaspiPi] RF24 Radio Link between 2 Raspberry Pis

Hi there,

awesome coder TMRh20 did write some cool librarys for the widely used RF24 radio modules.
These tiny things work with SPI and thanks to TMRh20s work, you can use them quite easily to connect two RPis.
You can find his/her Github on https://github.com/TMRh20, as well as a lot of good documentation on his/her blog http://tmrh20.blogspot.de/ and github.io http://tmrh20.github.io/

To make it short and connect to RPis, this is my reciepe, worked out with TMRh20 - Thanks a lot!

1.) You should connect the RF24 modules to your two RPis like shown here:
https://github.com/TMRh20/RF24Network/tree/Development#connection-info
I did not change anything in the config but did just connect the modules like mentioned in the table:

Pins:

PIN -- NRF24L01 -RPI --------- RPi -P1 Connector
1 ---- GND ----- rpi-gnd ----- (25)
2 ---- VCC ----- rpi-3v3 ----- (17)
3 ---- CE ------ rpi-gpio22 -- (15)
4 ---- CSN ----- rpi-gpio8 --- (24)
5 ---- SCK ----- rpi-sckl ---- (23)
6 ---- MOSI ---- rpi-mosi ---- (19)
7 ---- MISO ---- rpi-miso ---- (21)
8 ---- IRQ ---- - ------------- -

2.) Install dependencies:
sudo apt-get install libboost1.50-all

3.) Install RF24toTUN on all RPis
mkdir rf24
cd rf24
wget http://tmrh20.github.io/RF24Installer/RPi/install.sh
chmod +x install.sh
sudo ./install.sh

Do you want to install the RF24 core library, Y/N?Y
Do you want to install the RF24Network library?Y
Do you want to install the RF24Mesh library?Y
Do you want to install the RF24toTUN library?Y
Do you want to compile RF24toTUN with RF24Mesh support?N

cd rf24libs/RF24Network/

vi RF24Network_config.h
change #define MAX_PAYLOAD_SIZE
to #define MAX_PAYLOAD_SIZE 1514

sudo make install -B

cd ..
cd RF24toTUN/

vi rf24totun.cpp
goto line 209: while(!radioTxQueue.empty() ) { // && !radio.available() ) {
and change it to: while(!radioTxQueue.empty() && !radio.available() ) {

sudo make install -B

4.) Use the Tunnel on both RPis (you're in the RF24toTUN folder :)!):
Node 1, Master:
sudo rf24totun_configAndPing.sh 1 2
answer 0 for Master
got now IP: 192.168.1.1

Node 2, Client:
rf24totun_configAndPing.sh 2 1
answer 1 for Client
got now IP: 192.168.1.2

After that you can ping each other, even with -s100 for 108 bytes payload, or use ssh and such.

Addition:
If you want to use the LAN/WAN Connection of the Master RPi from your Client, you need to do following:
a) Master Site:
sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -j MASQUERADE
# To forward and allow traffic, as mentioned here: http://tmrh20.github.io/RF24Ethernet/

b) Client Site:
sudo route add default gw 192.168.1.1 tun_nrf24
# Configure default gateway to the IP of your Master RPi and use the RF24 device to connect to it

[RaspPi] Raspberry Pi and the ili9341 Display

https://www.youtube.com/watch?v=cEcIem6R4aQ

1.) Enable SPI
# remove or comment out the spi blacklist line
sudo nano /etc/modprobe.d/raspi-blacklist.conf

2.) Install
a) FBTFT drivers as loadable modules
sudo REPO_URI=https://github.com/notro/rpi-firmware rpi-update
sudo shutdown -r now

OR

b) FBTFT drivers built into the kernel proper
sudo REPO_URI=https://github.com/notro/rpi-firmware BRANCH=builtin rpi-update
sudo shutdown -r now

3.) Install the frame buffer driver (as root):
apt-get install xserver-xorg-video-fbdev

4.) Configure frame buffer driver:
sudo vi /usr/share/X11/xorg.conf.d/99-fbdev.conf
Section "Device"
Identifier "myfb"
Driver "fbdev"
Option "fbdev" "/dev/fb1"
EndSection

5.) add Autostart:
( the gpios= Pins need to be changed to YOUR specification and connection! )
sudo vi /etc/modules
fbtft_device custom name=tm022hdh26 gpios=reset:25,led:23,dc:24 rotate=90 bgr=1
#on my selfbuild shield
#from usb -> sd card laengs
#fbtft_device custom name=tm022hdh26 gpios=reset:25,led:23,dc:24 rotate=180 bgr=1
#from cinch -> hdmi quer
#fbtft_device custom name=tm022hdh26 gpios=reset:25,led:23,dc:24 rotate=270 bgr=1

6.) add Auto login:
sudo vi /etc/inittab
#1:2345:respawn:/sbin/getty --noclear 38400 tty1
1:2345:respawn:/bin/login -f pi tty1 /dev/tty1 2>&1

7.) add Autostart X:
sudo vi /etc/rc.local
su -l pi -c "env FRAMEBUFFER=/dev/fb1 startx &"

8.) Console at boot
Add kernel argument to file /boot/cmdline.txt
fbcon=map:10

Infos taken from:
https://github.com/notro/fbtft/wiki#install
http://marcosgildavid.blogspot.de/2014/02/getting-ili9341-spi-screen-working-on.html

Video was played with this worm-of-a-command-string:
sudo mplayer -nolirc -vo fbdev2:/dev/fb1 -fs -x 320 -y 240 -zoom -framedrop -lavdopts lowres=1:fast:skiploopfilter=all ~/BadApple.avi

elektor Live 2013

You can find my slides from the elektor Live 2013, Raspberry Pi 101 Workshop here: elektor_RPi_2013_Maas.pdf [ 6,1 MB ]

The handout or "cheat-sheet" can be downloaded here: elektor_RPi_2013_Maas_Cheat_Sheet.pdf [ 0,4 MB ]

... and finally, you find the Sourcecode of the Sample Projects here: elektor_RPi_2013_Maas_Sourcecode.zip [ 0,03 MB ]

Videorecording of the talk can be found here