aboutsummaryrefslogtreecommitdiff
path: root/research/raspberrypi.md
blob: b4acd29af7c6d6bae5510a0edf71f44c20a06c81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
[[!meta title="Raspberry Pi"]]

* [General information](https://wiki.debian.org/RaspberryPi2).

Issues
======

## SSH

SSH not working by default on newer (2017) raspbian releases. That's because it's disabled
by default. Solution is to create a file called 'ssh' in the boot partition.

## Networking

* You might try to make it allways up with wicd-curses.

### Amplifier mode

Some references on using an external soundcard as an amplifier:

* packages: libncurses5-dev libjack-jackd2-dev jack-tools
* http://wiki.linuxaudio.org/wiki/raspberrypi
* http://www.jackaudio.org/applications/
* http://linux-audio.4202.n7.nabble.com/Solution-for-jackd2-and-dbus-without-X-session-td35904.html
* http://comments.gmane.org/gmane.linux.audio.users/82560
* [sound - How do I output my audio input? - Ask Ubuntu](https://askubuntu.com/questions/2719/how-do-i-output-my-audio-input)
* [Crackle-free audio on the Raspberry Pi with mpd and PulseAudio – dbader.org](https://dbader.org/blog/crackle-free-audio-on-the-raspberry-pi-with-mpd-and-pulseaudio)
* [How to play realtime insted of using arecord and aplay?](https://www.linuxquestions.org/questions/linux-newbie-8/how-to-play-realtime-insted-of-using-arecord-and-aplay-858500/)
* [Jackd Headless](https://capocasa.net/jackd-headless).

Attempts:

    man jack_disconnect 
    man jack_connect 
    man jack_lsp
    sudo jack_lsp
    sudo apt-get install jack-tools
    jackd
    jackd --no-realtime
    jackd --no-realtime -d alsa
    export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket jackd --no-realtime -d alsa
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket jackd --no-realtime -d alsa
    sudo jackd --no-realtime -d alsa
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket sudo jackd --no-realtime -d alsa
    sudo apt-get install libncurses5-dev libjack-jackd2-dev -y
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket sudo jackd --no-realtime -d alsa
    DBUS_SESSION_BUS_ADDRESS=unix:path=/run/dbus/system_bus_socket sudo jackd -r -d alsa -d default:CARD=USB

### Freezing

At the serial console:

    [123916.394903] INFO: rcu_preempt detected stalls on CPUs/tasks:
    [123916.413406]         1: (1 GPs behind) idle=dcd/140000000000000/0 softirq=1003110/1003111 fqs=312910 
    [123916.447541]         (detected by 0, t=765007 jiffies, g=729122, c=729121, q=347657)
    [123916.467769] Task dump for CPU 1:
    [123916.484152] puppet          R running      0 29362      1 0x00000002
    [123916.503500] rcu_preempt kthread starved for 448421 jiffies!

References:

* [Pi2 rcu_preempt detected stalls · Issue #1161 · raspberrypi/linux · GitHub](https://github.com/raspberrypi/linux/issues/1161).

## Montagem automática de volume cifrado

Assumindo:

    VOLNAME: nome do disco externo
    MEDIA: nome do dispositivo mapeado (device mapper)

No TPC:

    dd if=/dev/urandom of=pirotron bs=1024 count=4
    keyringer $PROJECT encrypt disks/$MEDIA/luks/root-berry $VOLNAME
    scp $VOLNAME berry:~/
    wipe $VOLNAME

No raspberry:

    sudo mv /home/$USER/$VOLNAME /root/
    sudo chmod 0400 /root/$VOLNAME
    sudo cryptsetup luksAddKey /dev/sda1 /root/$VOLNAME

No `/etc/crypttab`:

    $VOLNAME        /dev/sda1               /root/$VOLNAME  luks

No `/etc/fstab`:

    /dev/mapper/$VOLNAME /media/$VOLNAME ext4    defaults          0       2

Referências:

* https://www.howtoforge.com/automatically-unlock-luks-encrypted-drives-with-a-keyfile
* https://askubuntu.com/questions/450895/mount-luks-encrypted-hard-drive-at-boot

## Rede

Arquivo `/etc/network/interfaces`:

    auto lo
    iface lo inet loopback

    #auto eth0
    #allow-hotplug eth0

    #iface eth0 inet manual
    #iface eth0 inet static
    #  address 192.168.0.100
    #  netmask 255.255.255.0

    auto wlan0
    allow-hotplug wlan0

    iface wlan0 inet static
      address 192.168.0.100
      netmask 255.255.255.0
      wpa-ssid ACCESS_POINT_NAME
      wpa-psk PSK
      #wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
      post-up /usr/sbin/service shorewall restart

    #iface wlan0 inet manual
    #  wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
    #
    #iface ape inet static
    #  address 192.168.0.100
    #  netmask 255.255.255.0

    #iface wlan0 inet manual
    #wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    #auto wlan1
    #allow-hotplug wlan1
    #iface wlan1 inet manual
    #wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

Arquivo `/etc/wpa_supplicante/wpa_supplicant.conf` (por enquanto não utilizado):

    ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
    update_config=1

    network={
        ssid="ACCESS_POINT_NAME"
        psk="PSK"
    }

O esquema `wpa-roam` não funciona com interfaces `static`, então foi necessário usar [https://git.fluxo.info/?p=puppet-nodo.git;a=commit;h=d09f347afc0a99481673f227f83864d06206add6 um script].

Backups
-------

Fazendo o backup do cartão microSD a partir do TPC:

    dcfldd if=/dev/sdb | bzip2 > raspberry.img.bz2

## References

* http://linuxonflash.blogspot.com.br
* http://elinux.org/RPi_Serial_Connection
* https://www.raspbian.org/RaspbianMirrors