20 de mayo de 2023

Solventar Error de Firmas con aptitude update

Cuando aparace un error de verificación de firmas públicas al actualizar los paquetes linux-mint con aptitude, como el ejemplo:

#aptitude update
...
...
Err https://repo.protonvpn.com/debian unstable InRelease      
  Las firmas siguientes no se pudieron verificar porque su clave pública no está disponible: NO_PUBKEY YourKeyHere
...

Solución:

#apt-key adv --keyserver keyserver.ubuntu.com --recv-keys YourKeyHere

Executing: /tmp/apt-key-gpghome.czzxh7ycXx/gpg.1.sh --keyserver keyserver.ubuntu.com --recv-keys YourKeyHere
gpg: clave YourKeyHere: clave pública "Proton Technologies AG <opensource@proton.me>" importada
gpg: Cantidad total procesada: 1
gpg:               importadas: 1 

Ref:
https://chat.openai.com
http://misnotaslinux.blogspot.com/2011/03/error-de-gpg-nopubkey.html

 

21 de marzo de 2023

Montar una imagen de tarjeta SD de rpi en linux

1) Descomprimir el fichero SDrpi.img.gz manteniendo el original:

# gzip -dk SDrpi.img.gz

 

2) ver estructura del fichero imagen:

# fdisk -l SDrpi.img

Unidades: sectores de 1 * 512 = 512 bytes
Tamaño de sector (lógico/físico): 512 bytes / 512 bytes
Tamaño de E/S (mínimo/óptimo): 512 bytes / 512 bytes
Tipo de etiqueta de disco: dos
Identificador del disco: 0xb111a06d

Dispositivo Inicio Comienzo  Final Sectores Tamaño Id Tipo

SDrpi.img1            8192    93814    85623  41,8M  c W95 FAT32 (LBA)
SDrpi.img2           94208 62333951 62239744  29,7G 83 Linux 

 

3) Montar la partición 2 en /mnt/tmp:

Calcular valor del offset:

# echo "512 * 94208" | bc
48234496

# mount -o loop,offset=48234496 SDrpi.img /mnt/tmp

 

4) Comprobar:

$ cd /mnt/tmp

$ ll
total 104K
drwxr-xr-x   2 root root 4,0K sep 11  2019 bin
drwxr-xr-x   2 root root 4,0K sep  7  2017 boot
drwxr-xr-x   4 root root 4,0K sep  7  2017 dev
drwxr-xr-x 123 root root  12K nov  6  2019 etc
drwxr-xr-x   4 root root 4,0K ene  8  2019 home
drwxr-xr-x  16 root root 4,0K feb 20  2019 lib
drwx------   2 root root  16K sep  7  2017 lost+found
drwxr-xr-x   4 root root 4,0K sep 26  2017 media
drwxr-xr-x   3 root root 4,0K oct 24  2017 mnt
drwxr-xr-x   5 root root 4,0K feb  3  2019 opt
drwxr-xr-x   2 root root 4,0K jul 28  2017 proc
drwx------  24 root root 4,0K nov 22  2019 root
drwxr-xr-x   6 root root 4,0K sep  7  2017 run
drwxr-xr-x   2 root root  12K oct  2  2019 sbin
drwxr-xr-x   2 root root 4,0K sep  7  2017 srv
drwxr-xr-x   2 root root 4,0K jul 28  2017 sys
drwxrwxrwt   8 root root 4,0K nov 22  2019 tmp
drwxr-xr-x  11 root root 4,0K sep  7  2017 usr
drwxr-xr-x  12 root root 4,0K oct 14  2017 var

Ok, ya tenemos accesible el sistema de archivos de la images de la tarjeta SD de raspberry pi, disponible para consultar o tomar los que necesitemos.

 

5) desmontar al terminar:

# sudo umount /mnt/tmp




8 de marzo de 2023

Rpi test SD card speed with hdparm

 $ hdparm -tT /dev/mmcblk0 

------------------------------------------------------------ 

@rpi4:~ $ sudo hdparm -tT /dev/sdd  (16GB class 4 SD by USB reader)
/dev/sdd:
 Timing cached reads:   1404 MB in  2.00 seconds = 702.06 MB/sec
 Timing buffered disk reads:  58 MB in  3.05 seconds =  19.03 MB/sec

------------------------------------------------------------ 

@rpi4:~ $ sudo hdparm -tT /dev/mmcblk0 (128GB SD, class 10)
/dev/mmcblk0:
 Timing cached reads:   1470 MB in  2.00 seconds = 735.12 MB/sec
 Timing buffered disk reads: 128 MB in  3.02 seconds =  42.42 MB/sec

------------------------------------------------------------ 

@rpiap:~ $ sudo hdparm -tT /dev/mmcblk0 (16GB SD Class 10)
/dev/mmcblk0:
 Timing cached reads:   874 MB in  2.00 seconds = 437.44 MB/sec
 Timing buffered disk reads:  66 MB in  3.02 seconds =  21.86 MB/sec

------------------------------------------------------------

@rpi:~ $ sudo hdparm -tT /dev/mmcblk0 (32 GB SD class 10)
/dev/mmcblk0:
 Timing cached reads:   410 MB in  2.01 seconds = 204.42 MB/sec
 Timing buffered disk reads:  66 MB in  3.04 seconds =  21.70 MB/sec

------------------------------------------------------------ 

2 de marzo de 2023

Acivate event_scheduler in mariaDB

Protocol:


1) Edit mariadb config file:


# nano /etc/mysql/mariadb.conf.d/50-server.cnf

include the line: "event_sheduler = on"

2) Restart mariadb service:


# service mariadb restart

3) Check if allright:

$ service mariadb status 

 

Confirm that events are executed from now.

28 de febrero de 2023

How to Compile and Upload .ino file to Arduino board in Rpi Linux Shell


I have a system composed by RpiB+ and Arduino Uno board working together, monitoring parameters, triggering reles, storing data into MariaDB and presenting with apache2 webserver.

When I have to change arduino program I have to open vnc session, execute arduino-ide, edit sketch, compile and upload to arduino board !!, ... painful due limited resources o my old RpiB+.

Thus, can I compile and upload and .ino file from rpi linux shell ??

Yes, and very ease.

 

Protocol:

Install arduino, if not installed already:

# aptitude install arduino

Compile and upload Shell command:

$ arduino --upload yourfile.ino --port yourArduinoport

 

Example:

$ arduino --upload example.ino --port /dev/ttyACM0

Picked up JAVA_TOOL_OPTIONS:
Cargando configuración...
Inicializando paquetes...
Preparando tarjetas...
Verficando...
...
El Sketch usa 16464 bytes (51%) del espacio de almacenamiento de programa. El máximo es 32256 bytes.
Las variables Globales usan 754 bytes (36%) de la memoria dinámica, dejando 1294 bytes para las variables locales. El máximo es 2048 bytes.
Subiendo...
...

I can also modify the .ino sketches with nano, compile and upload them to arduino from shell, without need any graphical environment.

Ref.:
https://arduino.stackexchange.com/questions/15893/how-to-compile-upload-and-monitor-via-the-linux-command-line

27 de febrero de 2023

Overlay Rpi Firmware: disable Wifi, Bluetooth and easy Shutdown Button

Rpi's Firmware has many posibilities to configure changing /boot/config.txt file


Usefull overlays:

Disable bluetooth:

Name: disable-bt
Info: Disable onboard Bluetooth on Pi 3B, 3B+, 3A+, 4B and Zero W, restoring
UART0/ttyAMA0 over GPIOs 14 & 15.
N.B. To disable the systemd service that initialises the modem so it
doesn't use the UART, use 'sudo systemctl disable hciuart'.
Load: dtoverlay=disable-bt
Params: <None>

Disable wifi:

Name: disable-wifi
Info: Disable onboard WLAN on Pi 3B, 3B+, 3A+, 4B and Zero W.
Load: dtoverlay=disable-wifi
Params: <None>


Safe shutdown button:

Clinton

Hey Shane,
No this won’t but if you wire the button to GPIO3 and add
dtoverlay=gpio-shutdown
to /boot/config.txt it will give you a safe shutdown and start up again.

You can find out more about it in the overlay readme search for shutdown and you will find it.
@Josh Told me about this just after I finished writing the tutorial.

-----------------------------------------------------------

Tested in my Rpi4: NOT WORK !!!

other recipe:

Tentsing this:

Include in /boot/config.txt and reboot

dtoverlay=gpio-shutdown,gpio_pin=3

NOT WORK !!

seems that nt work with GPIO_3 = SCL

Changing to GPI #17

===================================================

Include into /boot/config.txt and reboot

dtoverlay=gpio-shutdown,gpio_pin=17

YES, it's WORKS, can shutdown rpi4 with switch from GPIO#17 -- GND

===================================================


Ref:

https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README

26 de febrero de 2023

Linux shell Upgrade from RpiOS-10 buster to RpiOS-11 bullseye, fast recipe.

Protocol:

 0 - Make rpi SD backup in other linux computer:
# dd if=/dev/mmcblk0 status=progress bs=5M | gzip -9 > rpi-sd-bck-$(date +%Y%m%d_%H%M%S).img.gz
 

1 - Check current version: 
$ lsb_release -a
 
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 10 (buster)
Release:        10
Codename:       buster

 
2- Update, Upgrade current version
# aptitude update
# aptitude upgrade -y
# aptitude dist-upgrade -y
 
3 - Update Rpi firmware (?)
# rpi-update
 
4 - Change sourceslist.list file: "buster" to "bullseye"
# nano /etc/apt/sources.list
 
old: 
deb http://raspbian.raspberrypi.org/raspbian/ buster main contrib non-free rpi
new:
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi

5 - Update & Upgrade new OS version
# aptitude update
# aptitude upgrade -y

6 - Clean installation files
# aptitude autoclean
 
7 - Reboot the system
# reboot
 
8 - Check OS
$ lsb_release -a
 or
$ neofetch
  `.::///+:/-.        --///+//-:``    pi@rpi4 
`+oooooooooooo:   `+oooooooooooo:    -------  
 /oooo++//ooooo:  ooooo+//+ooooo.    OS: Raspbian GNU/Linux 11 (bullseye) armv7l  
 `+ooooooo:-:oo-  +o+::/ooooooo:     Host: Raspberry Pi 4 Model B Rev 1.4  
  `:oooooooo+``    `.oooooooo+-      Kernel: 5.10.103-v7l+  
    `:++ooo/.        :+ooo+/.`       Uptime: 13787B year 
       ...`  `.----.` ``..           Packages: 2098 (dpkg)  
    .::::-``:::::::::.`-:::-`        Shell: bash 5.1.4  
   -:::-`   .:::::::-`  `-:::-       Resolution: 3840x2160  
  `::.  `.--.`  `` `.---.``.::`      Terminal: /dev/pts/0  
      .::::::::`  -::::::::` `       CPU: BCM2711 (4) @ 1.500GHz  
.::` .:::::::::- `::::::::::``::.    Memory: 367MiB / 7847MiB  
-:::` ::::::::::.  ::::::::::.`:::-
::::  -::::::::.   `-::::::::  ::::                            
-::-   .-:::-.``....``.-::-.   -::-
.. ``       .::::::::.     `..`..
  -:::-`   -::::::::::`  .:::::`
  :::::::` -::::::::::` :::::::.
  .:::::::  -::::::::. ::::::::
   `-:::::`   ..--.`   ::::::.
     `...`  `...--..`  `...`
           .::::::::::
            `.-::::-`


9 - Check all your Rpi system.

bye.

24 de febrero de 2023

Hacer funcionar arduino-IDE en Raspberry Pi B+ con OS 11 y Java 11

Me ha dejado de funcionar arduino-IDE en rpiB+ con Raspberry Pi OS 11.

Desde la consola aparece un error:

$ /usr/bin/arduino
Picked up JAVA_TOOL_OPTIONS:  
Error occurred during initialization of VM
Server VM is only supported on ARMv7+ VFP

De modo que parece que hay un problema con java

$ java -version
Error occurred during initialization of VM
Server VM is only supported on ARMv7+ VFP

Pues is, confirmado no funciona java.

El procesador de mi máquina es ARMv6:

$ cat /proc/cpuinfo
processor       : 0
model name      : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS        : 697.95
Features        : half thumb fastmult vfp edsp java tls  
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xb76
CPU revision    : 7

Hardware        : BCM2835
Revision        : 0010
Serial          : 00000000ae3e152f
Model           : Raspberry Pi Model B Plus Rev 1.2


Solución:

from: https://stackoverflow.com/questions/61175441/error-occurred-during-initialization-of-vm-server-vm-is-only-supported-on-armv7

Si el procesador es ARMv6 hay que sustituir java:

$ cd /usr/lib/jvm

$ sudo wget https://cdn.azul.com/zulu-embedded/bin/zulu11.41.75-ca-jdk11.0.8-linux_aarch32hf.tar.gz

$ sudo tar -xzvf zulu11.41.75-ca-jdk11.0.8-linux_aarch32hf.tar.gz

$ sudo rm zulu11.41.75-ca-jdk11.0.8-linux_aarch32hf.tar.gz

Actualizar alternatives:


$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/zulu11.41.75-ca-jdk11.0.8-linux_aarch32hf/bin/java 1 $ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/zulu11.41.75-ca-jdk11.0.8-linux_aarch32hf/bin/javac 1

Ahora seleccionar el nuevo java instalado:


$ sudo update-alternatives --config java
           [revisa y selecciona la nueva version instalada, en mi caso es el 2 ] 
$ sudo update-alternatives --config javac

Comprueba la nueva versión de java:

$ java -version
openjdk version "11.0.8" 2020-07-14 LTS
OpenJDK Runtime Environment Zulu11.41+75-CA (build 11.0.8+10-LTS) OpenJDK Client VM Zulu11.41+75-CA (build 11.0.8+10-LTS, mixed mode)

Ok!!! parece que funciona.

Pruebo si funciona arduino IDE:
Ok! funciona.



 

 

 

 

 

 





8 de febrero de 2023

Aviod undervoltage detected! warning in raspberry pi

Recipe:

- Insert the line: 'avoid_warnings=1' into /boot/config.txt 

$ sudo echo "avoid_warnings=1" >> /boot/config.txt
 
- Uninstall lxplug-ptbatt:

$ sudo apt remove lxplug-ptbatt

And reboot rpi:

$ sudo reboot

----------

P.S.: Changing usb wire solves the problem, very ofen!!,
more gauge, better !?.