Raspberry setup by Asbesto

A solid setup for a raspberry sending videos / slideshow, can be rebooted / accessed by remote vpn, and make coffee.

This is for Rasp PI 3, quad core.

Howto about video / slideshow

A script generate the video list to go on play, reading that dir /home/pi/video and creating a new list every X minutes or at every reboot.

so every added video will be added to the playlist.

To play only a particular video you must remove all others.

TODO ASBESTO, notepad

* ffprobe doesn't exist because DEBIAN SHIT, it was named avprobe. so dur.sh didn't worked. so listamp4.sh didn't generate any list. PORCODIO! changing ffprobe in avprobe inside dur.sh fixed everything.

Features

IDEAS

questo sia necessario)

ACCESSING THE SHIT

USER pi, PW vivabasaglia. Root pw is "ciaras".

System boots and launch /home/pi/shells/start.sh - from there, everything starts.

Automagic check for network up/down

Every 2 minutes this piece of shit check for network and eventually put it on again.

It's in background with "sleep 120" because here NO crontab due to the RO fs.

<pre> #!/bin/bash while (true); do

sleep 120 done </pre>

This script is named netcheck, in /usr/local/sbinand starts from /etc/rc.local:

<pre> # into rc.local nohup /usr/local/sbin/netcheck & </pre>

Hostname with last IP number in it

The script is "ultimo" in /usr/local/sbin/ultimo:

<pre> #!/bin/bash # # in base all'ultimo numero dell'IP del wifi, crea /etc/hostname. # IP=ifconfig wlan0 | grep addr: | sed 's/.*inet *//; s/ .*//' cn=$(awk -F. '$0=$4' <<< $IP) echo "raspami"$cn > /etc/hostname </pre>

and start from /etc/rc.local:

<pre> # change /etc/hostname adding last IP number from wifi /usr/local/sbin/ultimo & </pre>

VPN

We use Voyager's vpn :)

VPN install on rasp

<pre> sudo apt-get install openvpn </pre>

next, copy the .conf file already prepared with all certs etc. (ex. for rasp number 50 use 50.conf)

after that

<pre> openvpn ./50.conf </pre>

or copy 50.conf into /etc/openvpn/client.conf

and launch from /etc/rc.local

<pre> service openvpn start </pre>

VPN on our computers

Same shit but using our personal certs.

VNC server/client install and usage

A teamviewer-like piece of shit, very handy!

VNC installation on raspberry

Look https://www.raspberrypi.org/documentation/remote-access/vnc/

<pre> sudo apt-get install tightvncserver </pre>

and launch tightvncserver to configure it, here you give a password that you will need to access.

in ~/shells/start.sh I added

<pre> vncserver :1 & </pre>

VNC installation on our computers

<pre> sudo apt-get install xtightvncviewer </pre>

so just launch

<pre> vncviewer 172.16.66.9:1 </pre>

put the pw and desktop appears. END OF SHIT

Installazione ansible, e modo d'uso

*TODO - TODO - e' stato fatto ma e' da documentare.*

Ricetta ansible per configurare i vari raspberry

Si trova in /home/pi/pi.yml

*ATTENZIONE: GLI SPAZI SONO PARTE DELLA SINTASSI, SE CAMBI L'INDENTAZIONE, NON FUNZIONA PIU UN CAZZO. IL LINGUAGGIO YAML E' UNA MERDA.*

<pre> --- - hosts: pi

</pre>

*ATTENZIONE: GLI SPAZI SONO PARTE DELLA SINTASSI, SE CAMBI L'INDENTAZIONE, NON FUNZIONA PIU UN CAZZO. IL LINGUAGGIO YAML E' UNA MERDA.*

si lancia con:

<pre> ansible-playbook --ask-pass ./pi.yml </pre>

Se vuoi lanciarla per un singolo ip, ad es. il 10.0.1.77, dai

<pre> ansible-playbook --ask-pass -l 10.0.1.77 ./pi.yml </pre>

Ovviamente gli IP vanno configurati in */etc/ansible/hosts*, come segue:

<pre> # This is the default ansible 'hosts' file. # # It should live in /etc/ansible/hosts # # - Comments begin with the '#' character # - Blank lines are ignored # - Groups of hosts are delimited by [header] elements # - You can enter hostnames or ip addresses # - A hostname/ip can be a member of multiple groups

# Ex 1: Ungrouped hosts, specify before any group headers.

[pi] 10.0.1.[51:99] ansible_ssh_user=pi # 192.168.1.249 </pre>

Impostazione del disco

Creo la schedina come fosse da 4 giga. anche se sta su una 32gb. per copiare il sistema quindi:

<pre> dd if=/dev/sdb of=milano2.img bs=4096 count=1048576 </pre>

ora e' cosi:

<pre> pi@raspami1 ~ $ cat /etc/fstab proc /proc proc defaults 0 0 /dev/mmcblk0p1 /boot vfat defaults,ro 0 2 /dev/mmcblk0p2 / ext4 defaults,rw,noatime 0 1 /dev/mmcblk0p3 /home ext4 rw,nosuid,nodev,relatime,data=ordered 0 0 tmpfs /tmp tmpfs defaults 0 0

(parted) print all Model: SD SL32G (sd/mmc) Disk /dev/mmcblk0: 31.9GB Sector size (logical/physical): 512B/512B Partition Table: msdos

Number Start End Size Type File system Flags

root@raspami1:/home/pi# mount /dev/root on / type ext4 (rw,noatime,data=ordered) devtmpfs on /dev type devtmpfs (rw,relatime,size=470368k,nr_inodes=117592,mode=755) tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=94936k,mode=755) tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,size=189860k) devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000) /dev/mmcblk0p1 on /boot type vfat (ro,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,errors=remount-ro) /dev/mmcblk0p3 on /home type ext4 (rw,nosuid,nodev,relatime,data=ordered) tmpfs on /tmp type tmpfs (rw,relatime) root@raspami1:/home/pi#

root@raspami1:/home/pi# df -h Filesystem Size Used Avail Use% Mounted on rootfs 2.6G 2.0G 467M 82% / /dev/root 2.6G 2.0G 467M 82% / devtmpfs 460M 0 460M 0% /dev tmpfs 93M 264K 93M 1% /run tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 186M 0 186M 0% /run/shm /dev/mmcblk0p1 56M 15M 42M 26% /boot /dev/mmcblk0p3 1.2G 129M 1.1G 12% /home tmpfs 464M 12K 464M 1% /tmp </pre>

ACCESSI E RETE

Ethernet: eth0, 172.16.0.50 fisso.

Login: user pi, pw vivabasaglia. sudo diventa root. pw root: la solita nostra

Wifi: wlan0 10.0.1.50 in poi, gw 10.0.0.1

ATTENZIONE

*in /etc/network/interfaces VA SETTATO UN SOLO GW, altrimenti non so perche' ma la seconda rete (wlan0) non sale!*

VEDI PIU IN BASSO

Rendere la distro Raspbian compatibile arm 7 -> arm 8

<pre> sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo apt-get install raspberrypi-ui-mods

sudo halt </pre>

e riavviare!

Come avere lo SCHERMO NERO AL BOOT ed evitare messaggi e fragoline

Se vuoi farlo devi EDITARE */boot/cmdline.txt*

Via il boot log: si fa mettendo come console

<pre>

</pre>

al posto di tty1

NO: meglio avere dei log per capire se sta salendo o no. ho lasciato solo loglevel=3 e logo.nologo

Via i loghini: si fa aggiungendo alla fine della riga

al momento quel file e' cosi:

<pre>

</pre>

== lxde startup e quanto sono FIGLI DI PUTTANA ===

Sti COGLIONI di raspbian hanno cambiato LXDE in LXDE-pi dentro ~/.config/lxsession cosi' l'autostart non va piu.

*COGLIONI*

http://www.raspberrypi-spy.co.uk/2014/05/how-to-autostart-apps-in-rasbian-lxde-desktop/

E' da li dentro che lancio *~/shells/start.sh* ;)

WIFI dongle

https://github.com/lwfinger/rtl8188eu

Da qui scarichi lo zip e dentro c'e' il fottuto firmware.

il .bin va copiato dentro */lib/firmware/rtlwifi*

Poi serve il giusto drive a seconda del kernel: https://www.raspberrypi.org/forums/viewtopic.php?p=462982

Nel caso del ns kernel, Linux raspami1 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux

il firmware giusto e'

3.18.7-v7+ #755, #756 - 8188eu-v7-20150212.tar.gz

quindi da root:

<pre> wget https://dl.dropboxusercontent.com/u/80256631/8188eu-v7-20150212.tar.gz tar xzf 8188eu-v7-20150212.tar.gz ./install.sh </pre>

e riavvia!

Vecchi appunti

<pre> wget https://dl.dropboxusercontent.com/u/80256631/8188eu-20140307.tar.gz //make sure you use the correct dropbox url for your Raspberry version tar -zxvf 8188eu-20140307.tar.gz sudo cp rtl8188eufw.bin /lib/firmware/rtlwifi //not needed anymore if your operating system is above 3.10.33+ sudo install -p -m 644 8188eu.ko /lib/modules/3.10.33+/kernel/drivers/net/wireless sudo insmod /lib/modules/3.10.33+/kernel/drivers/net/wireless/8188eu.ko sudo depmod -a sudo reboot </pre>

Scanner reti wifi

E' utile per capire quanto copriamo come zona, e se il raspi ci arriva.

Togliere lo SFONDO A LXDE e mettere sfondo nero

Va tolto dal background, che poi va impostato come colore nero, lo fai da X. Poi, dalle opzioni desktop, leva l'icona trash, e cosi ora devi solo levare di mezzo il panel, killandolo.

LEVARE IL PANNELLO IN BASSO

Devi killare lxpanel. Se poi ti serve, va rilanciato con lxpanel --profile LXDE-pi: lancia direttamente *~/shells/panel.sh*

DISABILITA OGNI BLANK SCREEN

<pre> xset -dpms xset s noblank xset s off </pre>

messo in *~/shells/start.sh*

Risolvere SSH LENTO (risolto)

One workaround is to edit /etc/sshd_config on the sshd server machine, not your ssh client machine to set "UseDNS" to "no". (From the way you originally wrote your question, it sounded like you may have edited that file on your client, which wouldn't make a difference.)

Another solution would be to have your ISP (or whatever institution is responsible for your publicly-routable IP addresses) fix their reverse-DNS record for your IP address on their DNS name servers that are authoritative for the reverse-DNS records for that block of IP addresses. In other words, "make it so people can find your host name based on your IP address, and make sure the hostname they find maps back to your IP address". 7 mins · Unlike · 1

Sergio Corpettini come ti era gia' stato detto, sul server metti nel config di ssh UseDNS no_

NASCONDERE IL CURSORE SOTTO X dopo alcuni secondi che sta fermo

<pre> sudo apt-get install unclutter unclutter -display :0 -noevents -grab </pre>

CONNESSIONE AUTOMATICA WIFI

Scheda supportata:

Edimax EW-7811Un 150Mbps 11n Wi-Fi USB Adapter, Nano Size Lets You Plug it and Forget it, Ideal for Raspberry Pi, Supports Windows, Mac OS, Linux

IDEAL STO GRAN CAZZO!!!

http://www.amazon.com/gp/product/B003MTTJOY/ref=as_li_tl?ie=UTF8&camp=1789&creative=390957&creativeASIN=B003MTTJOY&linkCode=as2&tag=rapihq-20&linkId=7QAXDGG72H4EWYFB

https://www.raspberrypi.org/forums/viewtopic.php?f=31&t=7471

ATTENZIONE: VIA DAL CAZZO IL POWER SAVING SUI PENNINI WIFI, CHE RENDE LA CONNESSIONE INSTABILE!!!

Dando "lsmod" si vede che abbiamo il driver

<pre> 8192cu 528365 0 </pre>

Devi creare il file */etc/modprobe.d/8192cu.conf* contenente:

<pre> # Disable power saving options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1 </pre>

e successivamente riavviare.

Configurazione di rete

Mettere solo questo in */etc/network/interfaces*

<pre> # ultima config testata, funziona, tira su tutto auto lo iface lo inet loopback

up eth0 allow-hotplug iface eth0 inet static

auto wlan0 allow-hotplug iface wlan0 inet static

</pre>

e cancella */etc/wpa_supplicant/wpa_supplicant.conf*

SLIDESHOW

<pre> apt-get install feh feh --recursive --randomize --auto-zoom -D 20 -F ./slideshow/ </pre>

-D delay, -F fullscreen. NON supporta le GIF

Problema ipotetico documentato su web: un FLASH puo' resettare il raspberry PI 2. E non i precedenti.

Il problema e' il chip U16 che sembra fotosensibile. Dovrebbe bastare coprirlo.

http://www.pcpro.co.uk/components/1000375/why-a-camera-flash-will-reboot-your-raspberry-pi-2

/home separata

/home e' separata dal sistema in una partizione a parte.

Sistema in READ ONLY?

BELLO sarebbe... SE FUNZIONASSE.

Solo /boot al momento si puo' mettere in read only, /tmp e' su tmpfs in ram, con dentro alcuni link di /var. Questo significa che crontab e' volatile e non resta memorizzato perche' sta su ram.

FORSE ha senso mettere i link di crontab su /boot in modo che resti un crontab con delle cose immutabili, ma modificabili rendendo scrivibile /boot quando serve. DA PROVARE

USCITA HDMI sempre attiva

Va settata, altrimenti se il tv si accende dopo il rasp, automaticamente quest'ultimo switcha sul connettore video out.

Add these two lines to */boot/config.txt* and reboot Raspbmc:

<pre> hdmi_force_hotplug=1 hdmi_drive=2 </pre>

DUPLICAZIONE DELLE SCHEDINE

L'immagine e' milano2.img

Asbesto

~~~~ CategoryMuseo