NotasNotas
  • Notas

    • ADB
    • Bookmarks, marcadores, favoritos,...
    • Desktop files (linux)
    • Docker
    • Docker Compose
    • Flutter
    • Flutter Code Snippets
    • Flutter Links
    • Flutter Packages
    • FSTAB
    • Git
    • Github Emojis
    • GPG
    • Grub
    • Lego
    • Linux
    • MACOS
    • Oh My ZSH!
    • Miscelánea
    • Raspberry Pi
    • PSP
    • PSVITA
    • React Native
    • React Native Links
    • React Native Packages
    • TP-Link Archer T2U Plus
    • TP-Link Archer T3U Plus
    • Visual Studio Code
    • Windows

Raspberry Pi

Configuración utilizada en mi Rasperry Pi 4

Configuración básica

Actualizar la lista de paquetes y actualizar todos los paquetes
sudo apt update && sudo apt upgrade -y
Instalar programas más utilizados
sudo apt install apt-transport-https ca-certificates curl git gnupg htop lsb-release neofetch -y
Eliminar partición de SWAP
sudo dphys-swapfile swapoff && sudo dphys-swapfile uninstall && sudo update-rc.d dphys-swapfile remove && sudo apt purge dphys-swapfile
Establecer IP estática para eth0 (versiones de debian 11 o inferiores), para ello necesitamos modificar el fichero dhcpcd.conf
sudo nano /etc/dhcpcd.conf

Y a continuación, indicamos la interfaz, ip, puerta de enlace y DNS

interface eth0
static ip_address=192.168.100.2/24
static routers=192.168.100.1
static domain_name_servers=1.1.1.1 8.8.8.8
Establecer IP estática para eth0 mediante Network Manager
nmcli device status
Mostrar
DEVICE         TYPE      STATE                   CONNECTION
eth0           ethernet  connected               Wired connection 1
lo             loopback  connected (externally)  lo
wlan0          wifi      disconnected            --

Modificamos la interfaz del puerto Ethernet

sudo nmtui edit "Wired connection 1"

En el asistente, nos vamos a IPv4 CONFIGURATION, cambiamos de <Automatic> a <Manual>, seleccionamos <Show> para mostrar el resto de parámetros, configuramos IP, puerta de enlace y DNS. Por último reiniciamos el servicio de NetworkManager

sudo systemctl restart NetworkManager
Desbloquear el puerto 53 (si lo vamos a utilizar por ejemplo junto con Pi-hole), para ello tenemos que modificar el fichero resolved.conf. El primer paso es para el servicio de resolved, verificar que está parado y modificar el fichero de configuración
sudo systemctl stop systemd-resolved
systemctl --version
sudo nano /etc/systemd/resolved.conf
[Resolve]
DNS=127.0.0.1
DNSStubListener=no

Por último, hacemos un backup del fichero resolv.conf, realizamos un acceso directo del fichero resolved.conf y reiniciamos el servicio

sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl reload-or-restart systemd-resolved
Si deseamos reiniciar diariamente la Raspberry (y evitar que se cuelgue por inactividad), podemos añadir una tarea de cron
sudo crontab -e
# **** RESTART EVERY DAY AT 04:00 AM *****
0 4 * * * /sbin/shutdown -r now
Para actualizar el firmware de la Raspberry utilizaremos el comando rpi-eeprom-update (ejecutar como root)
sudo rpi-eeprom-update
Mostrar
*** UPDATE AVAILABLE ***
BOOTLOADER: update available
   CURRENT: jue abr 29 16:11:25 UTC 2021 (1619712685)
    LATEST: mar ene 25 14:30:41 UTC 2022 (1643121041)
   RELEASE: default (/lib/firmware/raspberrypi/bootloader/default)
            Use raspi-config to change the release.

  VL805_FW: Dedicated VL805 EEPROM
     VL805: up to date
   CURRENT: 000138a1
    LATEST: 000138a1

En caso de que exista una actualización ejecutaremos de nuevo el comando rpi-eeprom-update añadiendo el parámetro -a para aplicar la actualización, una vez aplicada la actualización es necesario reiniciar la raspberry

sudo rpi-eeprom-update -a
Mostrar
*** INSTALLING EEPROM UPDATES ***

BOOTLOADER: update available
   CURRENT: jue abr 29 16:11:25 UTC 2021 (1619712685)
    LATEST: mar ene 25 14:30:41 UTC 2022 (1643121041)
   RELEASE: default (/lib/firmware/raspberrypi/bootloader/default)
            Use raspi-config to change the release.

  VL805_FW: Dedicated VL805 EEPROM
     VL805: up to date
   CURRENT: 000138a1
    LATEST: 000138a1
   CURRENT: jue abr 29 16:11:25 UTC 2021 (1619712685)
    UPDATE: mar ene 25 14:30:41 UTC 2022 (1643121041)
    BOOTFS: /boot

EEPROM updates pending. Please reboot to apply the update.
To cancel a pending update run "sudo rpi-eeprom-update -r".

Instalar Samba

El primer paso es comprobar si tenemos los paquetes de samba instalados, sino tenemos que añadirlos
sudo apt install samba samba-common-bin -y
Editamos el archivo smb.conf y añadimos la siguiente configuración
sudo nano /etc/samba/smb.conf
[global]
netbios name = Pi
server string = The Pi File Center
workgroup = WORKGROUP

[HOMEPI]
path = /home/pi
comment = No comment
writeable=Yes
create mask=0777
directory mask=0777
public=no
Establecemos la contraseña para el usuario pi, puede ser la misma del usuario u otra diferente
sudo smbpasswd -a pi
Por último, reiniciamos el servicio y ya podemos acceder desde cualquier dispositivo
sudo service smbd restart

Utilidades

Para realizar un test de rendimiento, necesitamos el paquete stress y ejecutar dicho paquete indicando que se van a utilizar todas las CPUs de la Raspberry
sudo apt install stress
sudo stress --cpu 4
Para observar la temperatura de la CPU cada segundo, utilizamos el siguiente comando
watch -n 1 /opt/vc/bin/vcgencmd measure_temp
Shell in a box es una herramienta que nos permite ejecutar un terminal desde el navegador web, instalamos el paquete shellinabox y accedemos desde local_ip:4200
sudo apt install shellinabox -y

Por defecto, utiliza conexión ssl pero en el fichero de configuración /etc/default/shellinabox podemos indicar que no se utilice. Por último reiniciar el servicio para que los cambios tengan efecto

sudo nano /etc/default/shellinabox
SHELLINABOX_ARGS="--no-beep --disable-ssl"
sudo /etc/init.d/shellinabox restart

Archivo de configuración

Configuración actual de la Raspberry Pi 4 del archivo config.txt
  • Desactivado wifi
  • Desactivado bluetooth
  • Overclock a 1.75 GHz (CPU)
  • Eliminado rayo amarillo
Mostrar
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d,disable-wifi,disable-bt
max_framebuffers=2
# Overcloking to 1.75 GHz
over_voltage=2
arm_freq=1750

# Removes the warning overlay and additionally allows turbo when low-voltage is present.
avoid_warnings=2
Configuración para Raspberry Pi 3B del archivo config.txt
  • Overclock a 1.35 GHz (CPU)
  • Overclock de la tarjeta SD (mayor velocidad lectura/escritura)
  • Eliminado rayo amarillo
Mostrar
[all]
# OVERCLOCKING 1.35 GHz Pi 3B
core_freq=500 # GPU Frequency
arm_freq=1350 # CPU Frequency
over_voltage=4 #Electric power sent to CPU / GPU (4 = 1.3V)
gpu_mem=192

# Overclock the microSD reader to 100 MHz
dtoverlay=sdhost,overclock_50=100

# Removes the warning overlay and additionally allows turbo when low-voltage is present.
avoid_warnings=2
Configuración del archivo FSTAB (Pi 4)
Mostrar
proc            /proc           proc    defaults          0       0
PARTUUID=7d225014-01  /boot           vfat    defaults,flush    0       2
PARTUUID=7d225014-02  /               ext4    defaults,noatime  0       1
tmpfs    /tmp    tmpfs    noatime,nodiratime,nodev,nosuid,mode=1777,defaults    0    0
tmpfs    /var/tmp    tmpfs    noatime,nodiratime,nodev,nosuid,mode=1777,defaults    0    0
tmpfs    /home/pi/docker-config/jellyfin/cache    tmpfs    noatime,nodiratime,nodev,nosuid,mode=1777,defaults    0    0
tmpfs    /home/pi/docker-config/jellyfin/log    tmpfs    noatime,nodiratime,nodev,nosuid,mode=1777,defaults    0    0
tmpfs    /home/pi/docker-config/lidarr/logs    tmpfs    noatime,nodiratime,nodev,nosuid,mode=1777,defaults    0    0

Comprimir Imagen

Si realizamos una imagen de la Raspberry pero no queremos que el espacio libre esté incluido, es necesario montar la imagen, encoger la partición con gparted y realizar un truncado de la imagen
sudo modprobe loop && sudo losetup -f && sudo losetup /dev/loop0 myimage.img && sudo partprobe /dev/loop0 && sudo gparted /dev/loop0 && sudo losetup -d /dev/loop0 && fdisk -l myimage.img
truncate --size=$[(16875519+1)*512] myimage.img

Enlaces (artículos, info, webs, blogs,...)

  • fbcp-ili9341 - A blazing fast display driver for SPI-based LCD displays for Raspberry Pi A, B, 2, 3, 4 and Zero
  • How to Boot Raspberry Pi 4 / 400 From a USB SSD or Flash Drive
  • How to Install Gogs on the Raspberry Pi
  • How to overclock the microSD card reader on a Raspberry Pi 3
  • Install pyenv on Raspberry Pi and version control Python 🇯🇵
  • Install TensorFlow 1.15.0 on Raspberry Pi 🇯🇵
  • microSD Card Benchmarks
  • Official Recalbox RGB Dual CASE (RPi4 and RPi3)
  • Pi400RGB - Scart/VGA interface for Raspberry Pi 400
  • Pi400RGB case (SCART and VGA)
  • Pico Fighting Board - Open source PCB for arcade sticks using Raspberry Pi Pico
  • Pi-Hole on Docker using OMV Raspberry Pi 4 “Network Wide Ad-Blocker”
  • Raspberry para torpes
  • Raspberry Pi Documentation

Sistemas operativos, Imágenes configuradas,...

  • Batocera.linux
  • libreelec - Just enough OS for KODI
  • LineageOS
  • PINN - An enhanced Operating System installer for the Raspberry Pi
  • Pi.Alert - WIFI / LAN intruder detector. Check the devices connected and alert you with unknown devices. It also warns of the disconnection of "always connected" devices
  • Pi-hole® - Network-wide Ad Blocking
  • PINN System Resize
  • recalbox
  • recalbox source code
  • RetroHome - Your Home for Retro Gaming 🕹️
  • WiFi Garage Door Controller with Raspberry Pi Pico W
Actualizado el:: 2/8/24, 13:06
Contributors: Manuel Muñoz
Prev
Miscelánea
Next
PSP