From 23ac9f57b9b4c761cb8edc5bfa0c0de77ec89326 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sat, 30 Sep 2017 14:06:22 -0300 Subject: Change extension to .md --- research/raspberrypi.md | 161 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 research/raspberrypi.md (limited to 'research/raspberrypi.md') diff --git a/research/raspberrypi.md b/research/raspberrypi.md new file mode 100644 index 0000000..b4acd29 --- /dev/null +++ b/research/raspberrypi.md @@ -0,0 +1,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 -- cgit v1.2.3