Differences between revisions 11 and 16 (spanning 5 versions)
Revision 11 as of 2017-04-12 12:49:27
Size: 17190
Editor: asbesto
Revision 16 as of 2017-04-12 18:40:15
Size: 17074
Editor: asbesto
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
#acl FreaknetGroup:read,write,admin,delete,revert All: #acl FreaknetGroup:read,write,admin,delete,revert All:read
Line 67: Line 67:
<pre> {{{
Line 79: Line 79:
</pre> }}}
Line 83: Line 83:
<pre> {{{
Line 86: Line 86:
</pre> }}}
Line 92: Line 92:
<pre> {{{
Line 100: Line 100:
</pre> }}}
Line 104: Line 104:
<pre> {{{
Line 107: Line 107:
</pre> }}}
Line 115: Line 115:
<pre> {{{
Line 117: Line 117:
</pre> }}}
Line 123: Line 123:
<pre> {{{
Line 125: Line 125:
</pre> }}}
Line 131: Line 131:
<pre> {{{
Line 133: Line 133:
</pre> }}}
Line 148: Line 148:
<pre> {{{
Line 150: Line 150:
</pre> }}}
Line 156: Line 156:
<pre> {{{
Line 158: Line 158:
</pre> }}}
Line 162: Line 162:
<pre> {{{
Line 164: Line 164:
</pre> }}}
Line 168: Line 168:
<pre> {{{
Line 170: Line 170:
</pre> }}}
Line 184: Line 184:
<pre> {{{
Line 216: Line 216:
</pre> }}}
Line 222: Line 222:
<pre> {{{
Line 224: Line 224:
</pre> }}}
Line 228: Line 228:
<pre> {{{
Line 230: Line 230:
</pre> }}}
Line 234: Line 234:
<pre> {{{
Line 250: Line 250:
</pre> }}}
Line 257: Line 257:
<pre> {{{
Line 259: Line 259:
</pre> }}}
Line 263: Line 263:
<pre> {{{
Line 307: Line 307:
</pre> }}}
Line 327: Line 327:
<pre> {{{
Line 334: Line 334:
</pre> }}}
Line 344: Line 344:
<pre> {{{
Line 346: Line 346:
</pre> }}}
Line 356: Line 356:
Line 358: Line 360:
<pre> {{{
Line 360: Line 362:

== lxde startup and HOW THEY'RE SON OF BITCHES ===

== lxde startup and HOW THEY'RE SON OF BITCHES ==
Line 391: Line 393:
<pre> {{{
Line 395: Line 397:
</pre> }}}
Line 401: Line 403:
<pre> {{{
Line 409: Line 411:
</pre> }}}
Line 426: Line 428:
<pre> {{{
Line 430: Line 432:
</pre> }}}
Line 447: Line 449:
<pre> {{{
Line 450: Line 452:
</pre> }}}
Line 469: Line 471:
<pre> {{{
Line 471: Line 473:
</pre> }}}
Line 475: Line 477:
<pre> {{{
Line 478: Line 480:
</pre> }}}
Line 488: Line 490:
<pre> {{{
Line 513: Line 515:
</pre> }}}
Line 520: Line 522:
<pre> {{{
Line 523: Line 525:
</pre> }}}
Line 551: Line 553:
<pre> {{{
Line 554: Line 556:
</pre> }}}

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

  • .mp4 files goes ONLY INTO /home/pi/video
  • Pictures goes ONLY INTO /home/pi/foto

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.


* 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.


  • Based on Raspbian
  • All standard repo's
  • Disk image ready with everything, <3GB

  • READ ONLY boot partition to avoid shit on the FS in case of brutal poweroff. But so, crontab doesn't work, "at" also maybe not. TO BE CHECKED
  • Simple network config in /etc/network/interface. Nothing else needed.
  • Very simple startup bash script that launch everything. Other scripts in /home/pi/shells/
  • Network config via ETH0 o WLAN0, cable o wifi.
  • Automatic hostname as "raspamiXX" where XX = last number of the wlan0 IP address (same can be done with eth0)
  • USB wifi dongles already configured with their own firmware etc.
  • Implement a wifi scanner
  • Screensaver & screen blanking disabled

  • Automatic network check: if disconnected, reboot network subsystem, checking every 2 minutes.
  • VPN access / mosh / screen
  • VNC access under VPN :)

  • Chromium installed
  • ansible and recipes to mod every rasp in the network
  • USB wifi dongles configured without the FUCKING POWERSAVING MODE.


  • underclock sistema? non necessario al momento, non serve a un cazzo-
  • VPN gestita interamente dai nostri server (zaverio.com) (voyanet cmq e' affidabile ed io sono root su una macchina apposita, quindi non so quanto

questo sia necessario)

  • Mplayer accelerato per rasp pi: fare check su quei 2 link che sono spariti
  • Test su programma in PYTHON per controllare OMXPlayer, che PARE usi addirittura OSC per fare solo POCHE cose.
  • Check telecamerina del raspberry e test di streaming audio/video


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.

while (true); do
 x=`ping -c2 google.com 2>&1 | grep unknown`
 if [ ! "$x" = "" ]; then
    echo `date` >> /home/pi/netcheck.log
    echo "Line is down. restarting..." >> /home/pi/netcheck.log
    service networking restart
    echo "done" >>/home/pi/netcheck.log
sleep 120

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

# into rc.local
nohup /usr/local/sbin/netcheck &

Hostname with last IP number in it

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

# 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

and start from /etc/rc.local:

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


We use Voyager's vpn :)

VPN install on rasp

sudo apt-get install openvpn

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

after that

openvpn ./50.conf

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

and launch from /etc/rc.local

service openvpn start

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/

sudo apt-get install tightvncserver

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

in ~/shells/start.sh I added

vncserver :1 &

VNC installation on our computers

sudo apt-get install xtightvncviewer

so just launch


put the pw and desktop appears. END OF SHIT

Installazione ansible, e modo d'uso

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

Ansible recipe to configure all raspberry

that's is /home/pi/pi.yml


- hosts: pi
  remote_user: pi
  sudo: yes

  # netcheck
  # files to be added
  - copy: src=/usr/local/sbin/netcheck dest=/usr/local/sbin/netcheck owner=root group=staff mode=0755 
  - copy: src=/usr/local/sbin/ultimo dest=/usr/local/sbin/ultimo owner=root group=root mode=0755
  - copy: src=/etc/modprobe.d/8192cu.conf dest=/etc/modprobe.d/8192cu.conf owner=root group=root mode=0644
  - copy: src=/etc/rc.altrirasp  dest=/etc/rc.local owner=root group=root mode=0755

  # Line to be added in /etc/rc.local
  # - lineinfile: dest=/etc/rc.local state=absent regexp="exit 0"
  # - lineinfile: dest=/etc/rc.local line="nohup /usr/local/sbin/netcheck &"
  # - lineinfile: dest=/etc/rc.local line="exit 0" 

  # Stuff to install/remove
  # - name: nmap installation
  #   apt: name=nmap state=present

  - name: reboot
    command: /sbin/reboot


LAUNCH with:

ansible-playbook --ask-pass ./pi.yml

For a single ip, ex. il, use

ansible-playbook --ask-pass -l ./pi.yml

IP must be configured into /etc/ansible/hosts, as follow:

# 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.

10.0.1.[51:99]  ansible_ssh_user=pi

Disk settings

I made the sdcard as a 4GB one, also if is 32gb. To copy it:

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

Now it is as follow:

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
 1      4194kB  62.9MB  58.7MB  primary  fat16
 2      62.9MB  2943MB  2880MB  primary  ext4
 3      2943MB  4277MB  1334MB  primary  ext4

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# 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

Using gparted you can resize it as you need.


Ethernet: eth0, fixed.

Login: user pi, pw vivabasaglia. sudo give root. pw root: ciaras

Wifi: wlan0 and up, gw


in /etc/network/interfaces SET JUST ONE GW, OTHERWHISE 2nd network card (wlan0) won't start!


Make our distro compatible for arm 7 -> arm 8

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install raspberrypi-ui-mods

sudo halt

and reboot.


Edit /boot/cmdline.txt

boot log:


instead of tty1

NO: better have logs to understand if it's booting or not. I left only loglevel=3 & logo.nologo

Fuck the logo: add at the end

  • loglevel=3 logo.nologo


Actually /boot/cmdline.txt is like that:

 dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait loglevel=3 logo.nologo

lxde startup and HOW THEY'RE SON OF BITCHES

THOSE RASPBIAN BASTARDS CHANGED LXDE in LXDE-pi INTO ~/.config/lxsession so autostart didn't worked.



It's from there that I launch ~/shells/start.sh ;)

WIFI dongle


From here you download the zip file, inside is the fucking firmware.

The .bin goes in /lib/firmware/rtlwifi

Next you need the correct driver according to the kernel: https://www.raspberrypi.org/forums/viewtopic.php?p=462982

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

the correct firmware is

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

So, from root:

wget https://dl.dropboxusercontent.com/u/80256631/8188eu-v7-20150212.tar.gz
tar xzf 8188eu-v7-20150212.tar.gz

and reboot!

Old notes

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

WIFI Scanner

Get rid of LXDE background, putting a black background

Remove from background, and put it black. You do it from X. After that, from desktop options, remove trash icon, so now you have to just kill the panel.

Killing the panel

Kill lxpanel. If you need it again, relaunch with lxpanel --profile LXDE-pi : launch directly ~/shells/panel.sh

BLANK SCREEN disabling

xset -dpms  
xset s noblank  
xset s off 

it's into ~/shells/start.sh

solve SLOW SSH

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

Set into ssh config: UseDNS no

HIDE X cursor after some seconds of inactivity

sudo apt-get install unclutter
unclutter -display :0 -noevents -grab

Automagic wifi connection

Our wifi:

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 this DICK!!!



GET RID OF POWERSAVING on wifi dongles!!!

With "lsmod" we see we have this driver:

8192cu                528365  0 

Create /etc/modprobe.d/8192cu.conf with:

# Disable power saving, FFS!
options 8192cu rtw_power_mgnt=0 rtw_enusbss=1 rtw_ips_mode=1

and reboot / reload driver.

Network configuration

Put this in etc/network/interfaces

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

up eth0
iface eth0 inet static
        address # ogni schedino col suo IP ovviamente
        # non usarlo! gateway
        # nota: un solo gw per le interfacce 
        # altrimenti non sale la rete wifi!

auto wlan0
iface wlan0 inet static
        wpa-ssid KIP01
        wpa-psk vivabasaglia

and REMOVE /etc/wpa_supplicant/wpa_supplicant.conf


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

-D delay, -F fullscreen. GIF not supported!

LIGHT problem in raspberry PI 2

U16 is sensible to light. Cover it!.


Sistema in READ ONLY?


Only /boot for now is read only, /tmp is in tmpfs ramdisk, with some /var links. So crontab is volatile.

MAYBE we can put crontab symlinks on /boot so we can have a fixed crontab to be modified into /boot.

HDMI port always ON

WE NEED THIS Because if we don't have hdmi active, the raspberry switches itself on the crappy video out connector.

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


SDCARD duplication

image is milano2.img

  • Insert sdcard into the pc
  • sudo dd if=milano2.img of=/dev/sdb bs=4096
  • eject / reinsert it
  • sudo gparted /dev/sdb
  • expand /home partition to the maximum
  • exit from gparted
  • sudo joe /mountpoint/schedina/etc/network/interfaces and CHANGE WLAN IP WITOUTH CHANGING EVERYTHING ELSE.
  • sync, umount


~~~~ CategoryMuseo

Museo/RaspberrySetup (last edited 2020-01-26 16:47:43 by asbesto)