home / infca / rspi3 (navigation links) Somriu i seràs feliç !

R4 - configuració | pi version4 | R4 SAG - r4 statup, r4 crontab | /boot/config.txt | R4 new SD 2022 + scripts + soft, R4 mor el 2026.10.12 : R4 TCPIP cfg, remote access | bot as service, webcam
MTV - deures , xarxa , engega R4 , servei de usuari ; ventilador
Pi0 | Links | End | mapa

Raspberry Pi 4

go 2 top
Raspberry homepage + forums + qq R4

Raspberry 4
Specs

El Raspberry Pi 4 ...

Backup a Proton drive

  1. Tenim una maquina de 32 bits :

    pi@R4:~ $ uname -m armv7l pi@pi0:~ $ uname -m armv6l pi@r3-64gb:~ $ uname -m armv7l

  2. instalem rclone :

    pi@R4:~ $ curl https://rclone.org/install.sh | sudo bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 4734 100 4734 0 0 16494 0 --:--:-- --:--:-- --:--:-- 16437 Archive: rclone-current-linux-arm-v7.zip creating: tmp_unzip_dir_for_rclone/rclone-v1.75.0-linux-arm-v7/ inflating: tmp_unzip_dir_for_rclone/rclone-v1.75.0-linux-arm-v7/README.html [text] inflating: tmp_unzip_dir_for_rclone/rclone-v1.75.0-linux-arm-v7/README.txt [text] inflating: tmp_unzip_dir_for_rclone/rclone-v1.75.0-linux-arm-v7/rclone [binary] inflating: tmp_unzip_dir_for_rclone/rclone-v1.75.0-linux-arm-v7/rclone.1 [text] inflating: tmp_unzip_dir_for_rclone/rclone-v1.75.0-linux-arm-v7/git-log.txt [text] Purging old database entries in /usr/share/man... Processing manual pages under /usr/share/man... Processing manual pages under /usr/local/man... Updating index cache for path `/usr/local/man/man1'. Wait...done. Checking for stray cats under /usr/local/man... Checking for stray cats under /var/cache/man/oldlocal... 1 man subdirectory contained newer manual pages. 1 manual page was added. 0 stray cats were added. 0 old database entries were purged. rclone v1.75.0 has successfully installed. Now run "rclone config" for setup. Check https://rclone.org/docs/ for more details.

  3. versions

    pi@pi0:~ $ rclone version rclone v1.75.0 pero sebas@minie:~ $ rclone version rclone v1.53.3-DEV

    ... i no accepta "Storage" as "protondrive"

    Instalem a pèl al Minie i tenim

    sebas@minie:~/eines/backup$ curl https://rclone.org/install.sh | sudo bash sebas@minie:~/eines/backup$ rclone version rclone v1.75.0 - os/version: linuxmint 21.2 (64 bit) - os/kernel: 6.8.0-136-generic (x86_64) - os/type: linux - os/arch: amd64 - go/version: go1.26.5 - go/linking: static - go/tags: none

  4. configurem

    pi@R4:~ $ rclone config 2026/08/20 18:13:47 ERROR internal error: no overview data found for "cloudinary" {...} No remotes found, make a new one? n) New remote s) Set configuration password q) Quit config n/s/q> n Enter name for new remote. name> bkup / bkupR0 / bkupR3 / bkupMINIE Option Storage. Type of storage to configure. Choose a number from below, or type in your own value. Storage> protondrive (# 49) Option username. The username of your proton account Enter a value. username> lorucdelsous / algermagrada / kardosso / sespilotes Enter the password: password: Confirm the password: password: Option 2fa. The 2FA code The value can also be provided with --protondrive-2fa=000000 The 2FA code of your proton drive account if the account is set up with two-factor authentication Enter a value. Press Enter to leave empty. 2fa> {empty} Option otp_secret_key. The OTP secret key The value can also be provided with --protondrive-otp-secret-key=ABCDEFGHIJKLMNOPQRSTUVWXYZ234567 The OTP secret key of your proton drive account if the account is set up with two-factor authentication Choose an alternative below. Press Enter for the default (n). y) Yes, type in my own password g) Generate random password n) No, leave this optional password blank (default) y/g/n> n Edit advanced config? y) Yes n) No (default) y/n> n Configuration complete. Options: - type: protondrive - username: lorucdelsous / algermagrada / kardosso / sespilotes - password: *** ENCRYPTED *** Keep this "bkup" remote? y) Yes this is OK (default) e) Edit this remote d) Delete this remote y/e/d> y Current remotes: Name Type maquina proton gate ==== ==== ======== ======= ===== bkup protondrive R4 lorucdelsous japlan bkupR0 protondrive R0 algermagrada cdet bkupR3 protondrive R3 kardosso adb30 bkupMINIE protondrive Minie sespilotes bcn.borinot@g e) Edit existing remote n) New remote d) Delete remote r) Rename remote c) Copy remote s) Set configuration password q) Quit config e/n/d/r/c/s/q> q pi@R4:~ $

    List them using :

    sebas@minie:~$ rclone listremotes apunts: bkupMINIE:

    Now we can :

    • display remote directories :

      sebas@minie:~$ rclone lsd bkupR0: -1 2026-08-24 21:11:40 -1 backup

    • display remote files :

      sebas@minie:~$ rclone ls bkupR0: 466200 backup/R0pic_pi0_20261012.7z

    • copy a single file

      rclone copy /path/to/local/file.txt bkup: --log-level NOTICE -P # writes to root rclone copy /path/to/local/file.txt bkup:backup --log-level NOTICE -P # writes to "backup" remote directory

    • copy an entire folder to a specific folder on Proton Drive (creates the remote folder if it doesn't exist):

      rclone copy /home/pi/python bkup:20260820_python --log-level NOTICE -P
fem backup de R4

pi@R4:~ $ rclone copy /home/pi/python bkup:20260820_python --log-level NOTICE -P Transferred: 91.089 KiB / 1.640 GiB, 0%, 1.342 KiB/s, ETA 2w19h44m Checks: 0 / 0, -, Listed 9047 Transferred: 22 / 8996, 0% Elapsed time: 1m8.5s Transferring: * termometre/snapshot.json: 0% / 1.254 KiB, 0 B/s, - * termometre/welcome.sag: 0% / 127 B, 0 B/s, - * dades/powermeter/potencia_2025-11-20.txt: 0% / 36 B, 0 B/s, - * fronius/1_llegir_energia.py: 0% / 10.427 KiB, 0 B/s, -unexpected fault address 0x80000000 fatal error: fault [signal SIGSEGV: segmentation violation code=0x1 addr=0x80000000 pc=0x104710c] goroutine 73 gp=0x81697c8 m=2 mp=0x7c6e808 [running]: runtime.throw({0x2ade1f2, 0x5}) runtime/panic.go:1229 +0x34 fp=0x86e2ae0 sp=0x86e2acc pc=0xb26d8 runtime.sigpanic() runtime/signal_unix.go:945 +0x2ac fp=0x86e2b10 sp=0x86e2ae0 pc=0xb54e0 golang.org/x/crypto/argon2.extractKey({0x7c000000, 0x10000, 0x10000}, 0x10000, 0x4, 0x10) golang.org/x/crypto@v0.54.0/argon2/argon2.go:254 +0x124 fp=0x86e3338 sp=0x86e2b14 pc=0x104710c

Millor fer ZIP i enviar sols un fitxer

pi@R4:~/python $ du . -h 1.7G . pi@R4:~ $ tar -czvf python_backup.tar.gz /home/pi/python tar: Removing leading `/' from member names /home/pi/python/ {...} 338800 -rw-r--r-- 1 pi pi 346930654 Aug 20 18:45 python_backup.tar.gz pi@R4:~ $ rclone copy python_backup.tar.gz bkup:20260820_python/ --log-level NOTICE -P Transferred: 330.859 MiB / 330.859 MiB, 100%, 2.753 MiB/s, ETA 0s Transferred: 1 / 1, 100% Elapsed time: 1m36.0s
funcio per fer backup de un fitxer

Si es el TGZ que fa "fer_backup" ... doncs perfecte

pcpy() { if [ -z "$1" ]; then echo "Usage: pcpy <filename_or_directory>" return 1 fi rclone copy "$1" bkup:backup/ --log-level NOTICE -P }

Ara puc fer

pi@R4:~ $ cd duckdns/ pi@R4:~/duckdns $ pcpy duck.sh Transferred: 0 B / 0 B, -, 0 B/s, ETA - Elapsed time: 2.2s

Dins "fer_backup.sh" tenim

rclone copy $fn2Send bkup:backup/ --log-level NOTICE -P &>> $fnLOG
*** Accés als disks remots com carpetes locals ***

If you want to access the remote disks as local folders on your central computer, you can mount them using FUSE.
Create local mount directories and mount them individually:

mkdir -p ~/proton_mounts/bkup ~/proton_mounts/bkupR0 ~/proton_mounts/bkupR3 rclone mount bkup: ~/proton_mounts/bkup & rclone mount bkupR0: ~/proton_mounts/bkupR0 & rclone mount bkupR3: ~/proton_mounts/bkupR3 &

Verification: run "df -h" or "ls ~/proton_mounts/"" to check that the files from each account are accessible within their respective local directories.


Raspberry 4

Compare 3B+ and 4

Tech specs Raspberry Pi 4 :

nice pdf

More specific :

Kubii : 1 GB = 38 €, 2 GB 49 €, amason, 62 €, 4 GB RAM

Use the new Buster, the latest version of Debian Linux

As it has USB 3, we can use a SSD disk !

Raspberry 4 improvements

Que afegeix el Raspberry 4 ? diferencies :

Raspberry 4 CPU info

sebas@r4:~ $ cat /proc/cpuinfo processor : 0-1-2-3 model name : ARMv7 Processor rev 3 (v7l) BogoMIPS : 108.00 Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 CPU implementer : 0x41 CPU architecture: 7 CPU variant : 0x0 CPU part : 0xd08 CPU revision : 3 Hardware : BCM2711 Revision : c03112 Serial : 10000000b8e2879d Model : Raspberry Pi 4 Model B Rev 1.2

system info

Raspberry 4 CPU BCM2711 RESET registers

BCN27xx imagebuilder

Raspberry 4 to-buy list

You will need

Kubii :

Per peces, a Amason :


SAG & R4

Specs : url

Us 202102 : Home Assistant

NOOBS, 2020

Lets make it run :

  1. download NOOBS NOOBS_v3_5_1.zip onto MARS & Ubuntu
  2. expand into a directory, lets say "noobs_35"
  3. get rpi-imager

    1. download Raspberry Pi Imager for Ubuntu : imager_1.5_amd64.deb
    2. on Ubuntu, double click on the "*.deb" file to install rpi-imager
  4. format SD as FAT32, using rpi-imager
  5. copy the extracted files onto the SD card that you just formatted so that this file (INSTRUCTIONS-README.txt) is at the root directory of the SD card.

Ara que engega i tenim terminal, fem :

  1. sudo apt update
  2. sudo apt full-upgrade ; url
  3. tenim "Raspbian 10, buster"
Raspbian, 2021

Tenim una micro SDHC "SanDisk Ultra" de 32 GB, clase 10, categoria A1

  1. ens baixem un buster

    nicolau@mars:~/sebas/rspi/op_sys$ ls -al 2932156 -rw-rw-r-- 1 nicolau nicolau 3.002.523.031 Mar 13 20:49 2021-01-11-raspios-buster-armhf-full.zip 8400900 -rw-r--r-- 1 nicolau nicolau 8.602.517.504 Jan 11 14:32 2021-01-11-raspios-buster-armhf-full.img

  2. conectem la SD al MARS :

    nicolau@mars:~/sebas/rspi/op_sys$ lsblk -p | grep /dev/sd nicolau@mars:~$ lsblk -p | grep /dev/sd /dev/sda 8:0 0 232.9G 0 disk └─/dev/sda1 8:1 0 232.9G 0 part / /dev/sdb 8:16 1 14.9G 0 disk ├─/dev/sdb1 8:17 1 256M 0 part /media/nicolau/boot └─/dev/sdb2 8:18 1 14.6G 0 part /media/nicolau/rootfs

  3. esborrem tot el contingut :

    nicolau@mars:~/sebas/rspi/op_sys$ sudo fdisk /dev/sdb Command (m for help): p Disk /dev/sdb: 29.7 GiB, 31914983424 bytes, 62333952 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x00000000 Device Boot Start End Sectors Size Id Type /dev/sdb1 2048 62333951 62331904 29.7G 83 Linux

  4. crear filesystem :

    nicolau@mars:~/sebas/rspi/op_sys$ sudo umount /dev/sdb1 nicolau@mars:~/sebas/rspi/op_sys$ sudo mkfs.vfat -F 32 /dev/sdb1 mkfs.fat 4.1 (2017-01-24)

  5. posem el Raspbian :

    nicolau@mars:~/sebas/rspi/op_sys$ sudo dd bs=4M if=./2021-01-11-raspios-buster-armhf-full.img of=/dev/sdb conv=fsync status=progress 8594128896 bytes (8.6 GB, 8.0 GiB) copied, 414 s, 20.8 MB/s 2051+0 records in 2051+0 records out 8602517504 bytes (8.6 GB, 8.0 GiB) copied, 514.173 s, 16.7 MB/s

  6. apareix el GUI, obrim la wifi i permitim conexions remotes

    $ sudo systemctl enable ssh $ sudo systemctl start ssh $ sudo apt update pi@raspberrypi:~ $ sudo apt-get install moreutils Reading package lists... Done pi@raspberrypi:~ $ sudo apt-get full-upgrade

  7. create own user :

    $ sudo adduser sebas Adding user `sebas' ... Adding new group `sebas' (1001) ... Adding new user `sebas' (1001) with group `sebas' ... Creating home directory `/home/sebas' ...

  8. make it super-user :

    pi@raspberrypi:/home $ sudo adduser sebas sudo Adding user `sebas' to group `sudo' ... Adding user sebas to group sudo Done.

  9. create some dirs and log files :

    sebas@r4:~ $ mkdir /home/sebas/eines sebas@r4:~ $ mkdir /home/sebas/eines/backup sebas@r4:~ $ mkdir /home/sebas/logs sebas@r4:~ $ mkdir /home/sebas/logs/oldies sebas@r4:~ $ mkdir /home/sebas/python sebas@r4:~ $ touch /home/sebas/logs/r4_start.log sebas@r4:~ $ touch /home/sebas/logs/engegades.log sebas@r4:~ $ touch /home/sebas/logs/last_boot_time.log sebas@r4:~ $ touch /home/sebas/logs/send_telegram.log sebas@r4:~ $ touch /home/sebas/logs/msg_a_tg.log sebas@r4:~ $ touch /home/sebas/logs/fer_backup.log sebas@r4:~ $ touch /home/sebas/logs/enviar_html_a_tinet.log sebas@r4:~ $ touch /home/sebas/logs/1_netejar.log sebas@r4:~ $ touch /home/sebas/logs/wifi_wd.log

  10. copy some files :

    /home/sebas/.bash_aliases /home/sebas/eines/r4_start.sh /home/sebas/.config/systemd/user/r4_start.service /home/sebas/eines/backup/fer_backup.sh /home/sebas/eines/backup/llista_fitxers.txt /home/sebas/logs/1_netejar.sh /home/sebas/python/telegram/client.py /home/sebas/python/telegram/msg_a_tg.sh /home/sebas/python/telegram/retry_msg_a_tg.sh

  11. start "initial" service

    sebas@raspberrypi:~ $ systemctl --user enable r4_start.service sebas@raspberrypi:~ $ systemctl --user start r4_start.service sebas@raspberrypi:~ $ systemctl --user status r4_start.service ● r4_start.service - Raspberry 4 startup code - /home/sebas/.config/systemd/user/r4_start.service - (v1.l) Loaded: loaded (/home/sebas/.config/systemd/user/r4_start.service; enabled; vendor preset: enabled) Active: inactive (dead) since Sun 2021-03-14 00:26:39 CET; 2s ago Process: 1105 ExecStart=/home/sebas/eines/r4_start.sh (code=exited, status=0/SUCCESS) Main PID: 1105 (code=exited, status=0/SUCCESS)

  12. start user crontab

    sebas@r4:~/eines $ crontab -u sebas cron_sebas.txt

    Les feines programades que hi tenim ar R4 son :

    sebas@r4:~/eines $ cat cron_sebas.txt ########################################################## # minute (0-59), # # | hora (0-23), # # | | dia del mes (1-31), # # | | | mes (1-12), # # | | | | dia de la semana (1-7 donde 1=Lunes) # # | | | | | comandos # ########################################################## 29 1 2 * * /home/pi/eines/1_netejar.sh 15 1 * * * cd /home/pi/eines/backup && /home/pi/eines/backup/fer_backup.sh 0,30 * * * * cd /home/pi/python/tinet && /home/pi/python/tinet/enviar_html_a_tinet.py &>> /home/pi/logs/enviar_html_a_tinet.log 6 2 * * * /home/pi/python/telegram/msg_a_tg.sh kron

  13. per mirar els errors del cron ens cal "mail" :

    $ sudo apt-get install mailutils

    El primer missatge es

    sebas@r4:~ $ mail Cannot open mailbox /var/mail/sebas: Permission denied No mail for sebas

    Send a first message to the user :

    sebas@r4:~ $ mail -s "Test Subject" sebas@localhost < /dev/null mail: Null message body; hope that's ok

    And here it is the mailbox :

    sebas@r4:~ $ ls -l /var/mail total 12 4 -rw-rw---- 1 sebas mail 461 Mar 14 19:22 sebas sebas@r4:~ $ mail "/var/mail/sebas": 1 message 1 new >N 1 sebas@r4 Sun Mar 14 19:22 14/421 Test Subject ? q Held 1 message in /var/mail/sebas
R4 start service

The service definition is :

sebas@raspberrypi:~/.config/systemd/user $ cat r4_start.service [Unit] Description=Raspberry 4 startup code - /home/sebas/.config/systemd/user/r4_start.service - (v1.l) ; v 1.l - R4 ; v 1.k - detalls versions ; v 1.j - oneshot ; v 1.i - location ; v 1.h - user sebas Wants=network-online.target After=network-online.target [Service] Type=oneshot ; simple - a long-running process that does not background itself and stays attached to the shell ; forking - a typical daemon that forks itself detaching it from the process that ran it, effectively backgrounding itself ; oneshot - a short-lived process that is expected to exit Restart=no WorkingDirectory=/home/sebas/eines ExecStart=/home/sebas/eines/r4_start.sh StandardOutput=syslog StandardError=syslog SyslogIdentifier=r4_start Environment=NODE_ENV=production [Install] WantedBy=default.target

The service job is :

sebas@raspberrypi:~/eines $ cat r4_start.sh #!/bin/bash # "oneshot" service run at R4 start # Raspberry Pi Zero Cookbook # Starup Log Script # Logs basic RPZ Info on system startup # after modifying it, run : # sudo service rpz_start status # sudo systemctl daemon-reload # Versions # 20200731 v 2.c - una sola versio, millors missatges al log # 20200801 v 2.d - engegar LED duty cycle # 20200806 v 2.e - no fer servir >>> /dev/null # 20200806 v 2.f - "oneshot" - TG in foreground, DUTY (leds) to another service # 20200809 v 2.g - remove extra timestamp # 20200818 v 2.h - save simple boot time file to send to Tinet # 20200823 v 2.i - trace only starting timestamp, as old times # 20210317 v 2.j - pass ID to TG # 20220404 v 2.k - user pi - set paths relative # 20220405 v 2.l - log numbering szWho=$1 myVersio="v 2.l" myBase="/home/pi" myBaseLog=$myBase"/logs" myLog=$myBaseLog"/1_r4_start.log" tinetFN=$myBaseLog"/last_boot_time.log" engegaFN=$myBaseLog"/engegades.log" date_name=`date +"Y%y/M%m/D%d"` time_name=`date +"h%H:m%M:s%S"` szTs="$date_name - $time_name" szId="+++ +++ +++ ($szTs) [$HOSTNAME] ($0) - versio $myVersio +++ +++ +++" # timestamp system start at own log file echo -e "\n$szId" >> $myLog echo "$szId" >> $engegaFN # simple timestamp into file - used to send HTML to Tinet echo $szTs > $tinetFN # trace in /var/log/syslog logger -i -p user.info $szId # send msg to TG /home/pi/python/telegram/msg_a_tg.sh $szWho &>> $myLog rc=$? echo ">>> TG rc $rc" >> $myLog # write some funny info TEMP=`/opt/vc/bin/vcgencmd measure_temp | cut -d "=" -f 2` GPU=`/opt/vc/bin/vcgencmd get_mem gpu | cut -d "=" -f 2` ARM=`/opt/vc/bin/vcgencmd get_mem arm | cut -d "=" -f 2` STATUS=`/opt/vc/bin/vcgencmd pm_get_status` echo Current core temperature {$TEMP} >> $myLog echo GPU RAM {$GPU} - CPU RAM {$ARM} >> $myLog echo RPZ Status {$STATUS} >> $myLog szId="--- --- --- ($szTs) [$HOSTNAME] ($0) - versio $myVersio --- --- ---" echo $szId >> $myLog exit 0
R4 sends to TG

R4 sends a message to TG bot in 2 situations :

R4 backup using email

Install Mutt :

sebas@r4:~ $ sudo apt-get install mutt sebas@r4:~ $ mkdir -p ~/.mutt/cache/headers sebas@r4:~ $ mkdir ~/.mutt/cache/bodies sebas@r4:~ $ touch ~/.mutt/certificates

Configure Mutt : url

Test Mutt is working - see ~/.muttdebug0 file

sebas@r4:~ $ echo "my BODY" | mutt -d 5 -s "my SUBJECT" -- mydestinationemail@gmail.com

Setup daily backup

sebas@r4:/etc/cron.daily $ sudo ln -s /home/sebas/eines/backup/fer_backup.sh envia_tgz_per_email

Compte que s'executa sota usuari "root" i no sap on posar el fitxer "tgz" - see cron with explicit paths

R4 sends to Tinet

Every 1/2 hour R4 sends a HTML page to Tinet - see R4 crontab

2022, el R4 és mort - el reinstalo

At boot, I see :

board: c03112 b8e2879d dc:a6:32:7f:45:7c boot: mode SD 1 order f41 retry 0/0 restart 0/-1 SD: casrd detected 0003534 part: 0 mbr [] updates: enabled 1 fw: start4.elf fixup4.dat net: down ip: 0.0.0.0 sn: 0.0.0.0 gw: 0.0.0.0 tftp: 0.0.0.0 00:00:00:00:00:00 Reset USB port-power 1000 ms lba: 8192 oem: 'mkfs.fat' volume: ' boot ' rsc 32 fat-sectors 4033 c-count 516190 c-size 1 r-dir 2 Partition: 0 lba: 8192 oem: 'mkfs.fat' volume: ' boot ' rsc 32 fat-sectors 4033 c-count 516190 c-size 1 r-dir 2 Read config.txt bytes 1784 hnd 0x000003e5 hash '6c0f63...' recover4.eld not found (6) recovery.elf not found (6) Read start4.elf bytes 2228800 hnd 0x00013669 hash 'dce1545...' Read fixup4.dat bytes 5448 hnd 0x000180c3 hash '4109cea...' 0x00c03112 0x00000000 0x000000ff MEM GPU: 76 ARM: 948 TOTAL: 1024

Sugerencia :

cat 2021-05-07-raspios-buster-armhf.img > dev/sdb && sync && eject /dev/sdb
/boot/config.txt complert

Fitxer mestre en botar : /boot/config.txt"
What is config.txt?
# For more options and information see http://rptl.io/configtxt

The Raspberry Pi uses a configuration file instead of the BIOS you would expect to find on a conventional PC. The system configuration parameters, which would traditionally be edited and stored using a BIOS, are stored instead in an optional text file named config.txt.
This is read by the GPU before the ARM CPU and Linux are initialised. It must therefore be located on the first (boot) partition of your SD card, alongside bootcode.bin and start.elf

docu

Compte - 202410 (nou R3) diu : The file you are looking for has moved to /boot/firmware/config.txt

Atencio : trobo legacy options not used by Bookworm (as disable_overscan)
The config.txt options described here are considered legacy settings, are not used by Raspberry Pi OS Bookworm, and are no longer officially supported.

# For more options and information see # http://rpf.io/configtxt # Some settings may impact device functionality. See link above for details # uncomment if you get no picture on HDMI for a default "safe" mode #hdmi_safe=1 # uncomment this if your display has a black border of unused pixels visible # and your display can output without overscan #disable_overscan=1 # uncomment the following to adjust overscan. Use positive numbers if console # goes off screen, and negative if there is too much border #overscan_left=16 #overscan_right=16 #overscan_top=16 #overscan_bottom=16 # uncomment to force a console size. By default it will be display's size minus # overscan. #framebuffer_width=1280 #framebuffer_height=720 # uncomment if hdmi display is not detected and composite is being output #hdmi_force_hotplug=1 # uncomment to force a specific HDMI mode (this will force VGA) #hdmi_group=1 #hdmi_mode=1 # uncomment to force a HDMI mode rather than DVI. This can make audio work in # DMT (computer monitor) modes #hdmi_drive=2 # uncomment to increase signal to HDMI, if you have interference, blanking, or # no display #config_hdmi_boost=4 # uncomment for composite PAL #sdtv_mode=2 #uncomment to overclock the arm. 700 MHz is the default. #arm_freq=800 # Uncomment some or all of these to enable the optional hardware interfaces #dtparam=i2c_arm=on #dtparam=i2s=on #dtparam=spi=on # Uncomment this to enable infrared communication. #dtoverlay=gpio-ir,gpio_pin=17 #dtoverlay=gpio-ir-tx,gpio_pin=18 # Additional overlays and parameters are documented /boot/overlays/README # Enable audio (loads snd_bcm2835) dtparam=audio=on [pi4] # Enable DRM VC4 V3D driver on top of the dispmanx display stack dtoverlay=vc4-fkms-v3d max_framebuffers=2 [all] #dtoverlay=vc4-fkms-v3d # send logs to UART so MARS can see it enable_uart=1

Use "$ vcgencmd dispmanx_list"

Anem a veure'n els detalls :

# Uncomment some or all of these to enable the optional hardware interfaces dtparam=i2c_arm=on ; enable I2C on the GPIO pins #dtparam=i2s=on ; enable I2S audio hardware dtparam=spi=on ; enable SPI driver
Fem SD nova per R4

  1. get 2022-01-28-raspios-bullseye-arm64.zip here

  2. expand it to 2022-01-28-raspios-bullseye-armhf.img

  3. {MARS} sudo apt install rpi-imager

    nicolau@mars:~$ sudo apt install rpi-imager [sudo] password for nicolau: Reading package lists... Done Building dependency tree Reading state information... Done rpi-imager is already the newest version (1.5). 0 upgraded, 0 newly installed, 0 to remove and 65 not upgraded.

  4. {MARS} Pi imager v1.5 ... writing

  5. esborrem la SD :

    nicolau@mars:~/sebas/rspi/op_sys$ sudo mkfs.vfat -F 32 /dev/sdb1 nicolau@mars:~/sebas/rspi/op_sys$ sudo dd bs=4M if=./2022-01-28-raspios-bullseye-armhf.img of=/dev/sdb conv=fsync status=progress 4227858432 bytes (4.2 GB, 3.9 GiB) copied, 178 s, 23.7 MB/s 1010+0 records in 1010+0 records out 4236247040 bytes (4.2 GB, 3.9 GiB) copied, 294.961 s, 14.4 MB/s nicolau@mars:~/sebas/rspi/op_sys$ df -h | grep sd --- compte que no hi hagi res de Guinous /dev/sda1 229G 125G 92G 58% / /dev/sdb1 253M 49M 204M 20% /media/nicolau/boot /dev/sdb2 3.6G 3.0G 395M 89% /media/nicolau/rootfs nicolau@mars:~$ lsblk -p | grep /dev/sd {32 GB} /dev/sda 8:0 0 232.9G 0 disk └─/dev/sda1 8:1 0 232.9G 0 part / /dev/sdb 8:16 1 29.7G 0 disk ├─/dev/sdb1 8:17 1 256M 0 part /media/nicolau/boot └─/dev/sdb2 8:18 1 29.5G 0 part /media/nicolau/rootfs

    Si volem modificar algun fitxer a ma :

    /boot/config.txt /boot/cmdline.txt /rootfs/etc/fstab

  6. botem la nova SD :

    ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(172,2) ]---

  7. esborrem la SD fent servir rpi-imager de Ubuntu
    [INSTRUCTIONS-README.txt] using gparted (or the command line version parted), format the entire disk as FAT32

  8. get latest NOOBS {best docu} : NOOBS_v3_8_0.zip

    Download and extract the files from the NOOBS zip file :

    /home/nicolau/sebas/rspi/op_sys/2022/sd -> /

    Copy the extracted files onto the SD card that you just formatted so that these files are at the root directory of the SD card.

    Please note that in some cases it may extract the files into a folder; if this is the case, then please copy across the files from inside the folder rather than the folder itself.

  9. **Raspberry Pi 4 Model B:** display must be connected to HDMI port closest to power jack.

  10. boot problems :

    edit /boot/config.txt to include hdmi_force_hotplug=1

    14 solutions, 6 more

  11. tornem a provar - 20220328 :

    • conectem la SD al MARS i la esborrem amb rpi-imager de Ubuntu

    • tenim la imatge :

    • al MARS engeguem "/home/Downloads/balenaEtcher-1.5.113-x64.AppImage", seleccionem ".img" i la SD

    • obtenim :

      nicolau@mars:~$ dfh /dev/sda1 229G 138G 80G 64% / /dev/sdb1 253M 30M 223M 12% /media/nicolau/boot /dev/sdb2 3.5G 2.9G 443M 87% /media/nicolau/rootfs nicolau@mars:~$ lsblk -p | grep /dev/sd /dev/sda 8:0 0 232.9G 0 disk └─/dev/sda1 8:1 0 232.9G 0 part / /dev/sdb 8:16 1 29.7G 0 disk ├─/dev/sdb1 8:17 1 256M 0 part /media/nicolau/boot └─/dev/sdb2 8:18 1 3.6G 0 part /media/nicolau/rootfs

    • bota ? "Resized root filesystem" -> blank screen

    • baixem Raspbian "lite" : 2022-01-28-raspios-bullseye-arm64-lite.zip

      nicolau@mars:~$ dfh /dev/sda1 229G 147G 71G 68% / /dev/sdb1 253M 30M 223M 12% /media/nicolau/boot /dev/sdb2 1.6G 1.2G 338M 78% /media/nicolau/rootfs nicolau@mars:~/sebas/_local_tinet_files$ lsblk -p | grep /dev/sd /dev/sda 8:0 0 232.9G 0 disk └─/dev/sda1 8:1 0 232.9G 0 part / /dev/sdb 8:16 1 29.7G 0 disk ├─/dev/sdb1 8:17 1 256M 0 part /media/nicolau/boot └─/dev/sdb2 8:18 1 1.6G 0 part /media/nicolau/rootfs

  12. compro cable USB-2-TTL : intento log 2 serial port

    No veig els missatges de R4, fins que poso enable_uart=1 a /boot/config.txt

    Ara veig els missatges de engegada, fins q aqui es penja :

    [ 5.493569] systemd[1]: modprobe@configfs.service: Succeeded. [ 5.504223] systemd[1]: Finished Load Kernel Module configfs. [ 5.518822] systemd[1]: modprobe@drm.service: Succeeded. [ 5.528700] systemd[1]: Finished Load Kernel Module drm. [ 5.543254] systemd[1]: modprobe@fuse.service: Succeeded. [ 5.553400] systemd[1]: Finished Load Kernel Module fuse. [ 5.567745] systemd[1]: Finished File System Check on Root Device. [ 5.582857] systemd[1]: Finished Load Kernel Modules. [ 5.597842] systemd[1]: Finished Set the console keyboard layout. [ 5.611712] systemd[1]: Started Journal Service. Debian GNU/Linux 11 raspberrypi ttyS0 raspberrypi login: CTRL-A Z for help | 115200 8N1 | NOR | Minicom 2.7.1 | VT102 | Offline | ttyUSB0

  13. Lets try an "old" NOOBS :
    You can find older versions at http://downloads.raspberrypi.org/ and particularly at http://downloads.raspberrypi.org/NOOBS/images/

    20220402 -

    1. get 3.3.0 : 07.2020 -> nicolau@mars:~/sebas/rspi/op_sys/2022_3.5/noobs_3.5
    2. format SD using rpi-imager
    3. copy from MARS to SD pointing "INSTRUCTIONS-README.txt" at the root directory of SD card
    4. modificar "/boot/config.txt" per contenir "enable_uart=1"
    5. al MARS, engegar "minicom -b 115200 -D /dev/ttyUSB0"
    6. power-on the R4 : mostra 2 SO's i demana quin instalar -> Raspbian
    7. success !

    Configurem

    • set wifi static ip 192.168.1.200
    • enable ssh : "sudo systemctl enable ssh" + "sudo systemctl start ssh"
    • set ssh welcome message
    • set timezone, using "sudo raspi-config" - url
    • set hostname, using "sudo raspi-config"

  14. Updating and Upgrading Raspberry Pi OS - Using APT

    The easiest way to manage installing, upgrading, and removing software is using APT (Advanced Packaging Tool) from Debian. To update software in Raspberry Pi OS, you can use the apt tool from a Terminal window.

    APT keeps a list of software sources on your Raspberry Pi in a file at /etc/apt/sources.list. Before installing software, you should update your package list with apt update.

    Go ahead and open a Terminal window and type: sudo apt update

    pi@raspberrypi:~ $ sudo apt update Get:1 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB] Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB] E: Repository 'http://raspbian.raspberrypi.org/raspbian buster InRelease' changed its 'Suite' value from 'stable' to 'oldstable' N: This must be accepted explicitly before updates for this repository can be applied. See apt-secure(8) manpage for details. Do you want to accept these changes and continue updating from this repository? [y/N] Reading package lists... Done Building dependency tree Reading state information... Done 455 packages can be upgraded. Run 'apt list --upgradable' to see them. $ apt list --upgradable $ pi@raspberrypi:~ $ sudo apt-get dist-upgrade ; 45 minuts $ sudo apt autoremove $ sudo apt full-upgrade ; res a fer

    Next, upgrade all your installed packages to their latest versions with the following command: sudo apt full-upgrade

    Note that full-upgrade is used in preference to a simple upgrade, as it also picks up any dependency changes that may have been made.

    Now, enter "sudo raspi-config" and (8) "update" the tool, then (2) "6 Advanced options" + "A7 Bootloader Version" + "E1 Latest"

    Verify bootloader is up to date using the command "rpi-eeprom-update"

    pi@raspberrypi:~ $ sudo rpi-eeprom-update BOOTLOADER: up to date CURRENT: Thu 10 Mar 2022 11:57:12 AM UTC (1646913432) LATEST: Thu 10 Mar 2022 11:57:12 AM UTC (1646913432) RELEASE: stable (/lib/firmware/raspberrypi/bootloader/stable) Use raspi-config to change the release. VL805_FW: Dedicated VL805 EEPROM VL805: up to date CURRENT: 000138a1 LATEST: 000138a1

    Or ...

    sudo apt update sudo apt full-upgrade sudo rpi-eeprom-update -a sudo reboot

    Engeguem scripts :

    Comanda per copiar des R4 un fitxer de MARS :

    pi@raspberrypi:~ $ scp nicolau@192.168.1.54:/home/nicolau/sebas/rspi/backups/r4/20220403/home/sebas/.config/systemd/user/* .
Software R4-2022
nmap

pi@R4:~ $ nmap -sP 192.168.1.0-255 -bash: nmap: command not found pi@R4:~ $ sudo apt update Get:1 http://packages.azlux.fr/debian bullseye InRelease [3,988 B] Get:2 http://packages.azlux.fr/debian bullseye/main armhf Packages [3,552 B] Get:3 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB] Get:4 http://archive.raspberrypi.org/debian buster InRelease [32.6 kB] Get:5 http://archive.raspberrypi.org/debian buster/main armhf Packages [391 kB] Get:6 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB] Fetched 13.5 MB in 2min 46s (81.1 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 86 packages can be upgraded. Run 'apt list --upgradable' to see them. pi@R4:~ $ apt list --upgradable Listing... Done {llista ben llarga} pi@R4:~ $ sudo apt-get dist-upgrade {triga una bona estona} pi@R4:~ $ sudo apt install -y nmap pi@R4:~ $ nmap --version Nmap version 7.70 ( https://nmap.org ) Platform: arm-unknown-linux-gnueabihf Compiled with: liblua-5.3.3 openssl-1.1.1d libssh2-1.8.0 libz-1.2.11 libpcre-8.39 libpcap-1.8.1 nmap-libdnet-1.12 ipv6 Compiled without: Available nsock engines: epoll poll select

lindevs

Displays MAC when used under "sudo" !!!

log2ram

Compte : no es pot executar cap shell, com "esborrar.sh" dins de "/home/user/logs", si el directori el controla log2ram.

pi@raspberrypi:~ $ echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] \ http://packages.azlux.fr/debian/ bullseye main" | sudo tee /etc/apt/sources.list.d/azlux.list deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ bullseye main pi@raspberrypi:~ $ sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg https://azlux.fr/repo.gpg --2022-04-02 22:07:45-- https://azlux.fr/repo.gpg Resolving azlux.fr (azlux.fr)... 37.58.241.234 Connecting to azlux.fr (azlux.fr)|37.58.241.234|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 2255 (2.2K) [application/octet-stream] Saving to: ‘/usr/share/keyrings/azlux-archive-keyring.gpg’ /usr/share/keyrings/azlux-archive 100%[====================================================>] 2.20K --.-KB/s in 0s 2022-04-02 22:07:46 (10.7 MB/s) - ‘/usr/share/keyrings/azlux-archive-keyring.gpg’ saved [2255/2255] pi@raspberrypi:~ $ sudo apt update Hit:1 http://raspbian.raspberrypi.org/raspbian buster InRelease Get:2 http://packages.azlux.fr/debian bullseye InRelease [3,988 B] Hit:3 http://archive.raspberrypi.org/debian buster InRelease Get:4 http://packages.azlux.fr/debian bullseye/main armhf Packages [3,426 B] Fetched 7,414 B in 1s (7,001 B/s) Reading package lists... Done Building dependency tree Reading state information... Done All packages are up to date. pi@raspberrypi:~ $ sudo apt install log2ram Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: log2ram 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 4,204 B of archives. After this operation, 0 B of additional disk space will be used. Get:1 http://packages.azlux.fr/debian bullseye/main armhf log2ram all 1.6.1 [4,204 B] Fetched 4,204 B in 0s (31.5 kB/s) Selecting previously unselected package log2ram. (Reading database ... 167466 files and directories currently installed.) Preparing to unpack .../archives/log2ram_1.6.1_all.deb ... Unpacking log2ram (1.6.1) ... Setting up log2ram (1.6.1) ... Created symlink /etc/systemd/system/sysinit.target.wants/log2ram.service → /etc/systemd/system/log2ram.service. Created symlink /etc/systemd/system/timers.target.wants/log2ram-daily.timer → /etc/systemd/system/log2ram-daily.timer. ##### Reboot to activate log2ram ##### ##### edit /etc/log2ram.conf to configure options ####

Configure :

$ cat /etc/log2ram.conf # Size for the ram folder, it defines the size the log folder will reserve into the RAM. SIZE=40M # Variable for folders to put in RAM. # example : PATH_DISK="/var/log;/home/test/FolderInRam" PATH_DISK="/var/log;/home/sebas/logs"

Is it working?

pi@raspberrypi:~ $ systemctl status log2ram ● log2ram.service - Log2Ram Loaded: loaded (/etc/systemd/system/log2ram.service; enabled; vendor preset: enabled) Active: active (exited) since Sat 2022-04-02 22:14:19 BST; 1min 57s ago Process: 326 ExecStart=/usr/local/bin/log2ram start (code=exited, status=0/SUCCESS) Main PID: 326 (code=exited, status=0/SUCCESS) Apr 02 22:14:20 raspberrypi log2ram[326]: lightdm/x-0.log.old Apr 02 22:14:20 raspberrypi log2ram[326]: private/ Apr 02 22:14:20 raspberrypi log2ram[326]: deleting log2ram.log Apr 02 22:14:20 raspberrypi log2ram[326]: sent 1,896,470 bytes received 533 bytes 3,794,006.00 bytes/sec Apr 02 22:14:20 raspberrypi log2ram[326]: total size is 1,893,956 speedup is 1.00 Apr 02 22:14:20 raspberrypi log2ram[326]: building file list ... done Apr 02 22:14:20 raspberrypi log2ram[326]: ./ Apr 02 22:14:20 raspberrypi log2ram[326]: deleting log2ram.log Apr 02 22:14:20 raspberrypi log2ram[326]: sent 57 bytes received 18 bytes 150.00 bytes/sec Apr 02 22:14:20 raspberrypi log2ram[326]: total size is 0 speedup is 0.00
dos2unix

"sudo apt-get install dos2unix"

/tmp to RAM

Albert :

# # pipaOS mount points # proc /proc proc defaults 0 0 /dev/mmcblk0p2 / ext4 defaults,noatime 0 0 /dev/mmcblk0p1 /boot vfat defaults,noatime 0 0 none /tmp tmpfs size=16m,mode=777 0 0

wikipedia tmpfs

speedtest

pi@R4:~/.local/bin $ sudo wget https://raw.githubusercontent.com/sivel/speedtest-cli/v2.1.3/speedtest.py --2023-12-26 12:52:28-- https://raw.githubusercontent.com/sivel/speedtest-cli/v2.1.3/speedtest.py Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.111.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 65123 (64K) [text/plain] Saving to: ‘speedtest.py’ speedtest.py 100%[==========================================================>] 63.60K --.-KB/s in 0.04s 2023-12-26 12:52:28 (1.70 MB/s) - ‘speedtest.py’ saved [65123/65123]

I obtenim :

pi@R4:~ $ speedtest.py Retrieving speedtest.net configuration... Testing from Yoigo (93.176.179.205)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by Voiped Telecom (Barcelona) [0.13 km]: 35.403 ms Testing download speed................................................................................ Download: 23.83 Mbit/s Testing upload speed................................................................................................ Upload: 42.79 Mbit/s i@R4:~ $ speedtest.py --no-upload --simple Cannot retrieve speedtest configuration ERROR: HTTP Error 403: Forbidden pi@R4:~ $ speedtest.py --secure Retrieving speedtest.net configuration... Testing from Yoigo (93.176.179.205)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by Netprotect (Madrid) [503.99 km]: 30.203 ms Testing download speed................................................................................ Download: 21.31 Mbit/s Testing upload speed................................................................................................ Upload: 37.40 Mbit/s pi@R4:~ $ speedtest.py --no-upload --simple Ping: 40.993 ms Download: 17.60 Mbit/s Upload: 0.00 Mbit/s pi@R4:~ $ speedtest.py --no-upload --simple | grep Download Download: 21.90 Mbit/s
R4 dies again 2026.10.12

I do an upgrade and it fails and it kills Raspbian

pi@R4:~ $ sudo apt-get purge --reinstall python3-ipython Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: ant ant-optional coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 cpp-8 dh-python docutils-common firebird3.0-common firebird3.0-common-doc firebird3.0-server-core firebird3.0-utils firmware-microbit-micropython fonts-inconsolata fonts-lyx fonts-opensymbol gcc-9-base gstreamer1.0-gtk3 java-wrappers libabw-0.1-1 libactivation-java libapache-pom-java libasan5 libbase-java libbatik-java libbcmail-java libbcpkix-java libbcprov-java libbcutil-java libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.74.0 libboost-iostreams1.74.0 libboost-locale1.67.0 libboost-locale1.74.0 libboost-thread1.74.0 libbsh-java libc-dev-bin libcdr-0.1-1 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libcommons-collections3-java libcommons-io-java libcommons-logging-java libcommons-parent-java libdouble-conversion1 libe-book-0.1-1 libehcache-java libel-api-java libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libfbclient2 libfl2 libfluidsynth1 libflute-java libfonts-java libformula-java libfreehand-0.1-1 libgcc-8-dev libgpgmepp6 libgutenprint-common libgutenprint9 libhsqldb1.8.0-java libib-util libilmbase23 libisl19 libitext-java libjaxp1.3-java libjcommon-java libjs-jquery-ui libjsp-api-java liblayout-java liblbfgsb0 libldb1 libloader-java liblog4j1.2-java libmail-java libmhash2 libmikmod3 libmms0 libmspub-0.1-1 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libodfgen-0.1-1 libofa0 libopenexr23 liborcus-0.14-0 liborcus-0.17-0 liborcus-parser-0.17-0 libpagemaker-0.0-0 libpentaho-reporting-flow-engine-java libpixie-java libpoppler126 libpq5 libqhull-r8.0 libqt5charts5 libqt5designer5 libqt5help5 libqt5serialport5 libqt5test5 libqxp-0.0-0 librasqal3 librdf0 libreoffice-base-drivers libreoffice-core-nogui librepository-java librevenge-0.0-0 librtimulib-dev librtimulib-utils librtimulib7 libsac-java libsdl-mixer1.2 libsdl-ttf2.0-0 libserializer-java libservlet-api-java libservlet3.1-java libstaroffice-0.0-0 libsuitesparseconfig5 libtommath1 libvisio-0.1-1 libwebsocket-api-java libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxml-commons-external-java libxml-commons-resolver1.1-java libxml-java libxmlgraphics-commons-java libxmlsec1 libxmlsec1-nss libxz-java libzmf-0.0-0 linux-libc-dev lp-solve mypy printer-driver-gutenprint pyflakes3 pylint3 python-matplotlib-data python-olefile python-pil python-rtimulib python-talloc python3-appdirs python3-astroid python3-asttokens python3-attr python3-backcall python3-contourpy python3-cycler python3-dateutil python3-decorator python3-docutils python3-executing python3-fonttools python3-fs python3-guizero python3-ipython-genutils python3-isort python3-jedi python3-jupyter-client python3-jupyter-core python3-kiwisolver python3-lazy-object-proxy python3-logilab-common python3-lz4 python3-matplotlib python3-matplotlib-inline python3-mccabe python3-mpmath python3-mypy python3-mypy-extensions python3-nudatus python3-packaging python3-parso python3-pickleshare python3-prompt-toolkit python3-pure-eval python3-py python3-pycodestyle python3-pyflakes python3-pygments python3-pyparsing python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtchart python3-pyqt5.qtserialport python3-pyqt5.qtsvg python3-pyqt5.sip python3-roman python3-scipy python3-semver python3-send2trash python3-sip python3-stack-data python3-sympy python3-toml python3-tornado python3-traitlets python3-tz python3-uflash python3-ufolib2 python3-unicodedata2 python3-wcwidth python3-wrapt python3-zmq python3.7 python3.7-minimal python3.7-venv unicode-data xml-core xsel Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: binutils binutils-arm-linux-gnueabihf binutils-common coinor-libcbc3 coinor-libcgl1 coinor-libcoinmp1v5 cpp cpp-12 cups cups-client cups-core-drivers cups-daemon cups-ipp-utils distro-info-data dpkg firebird3.0-common firebird3.0-common-doc firebird3.0-server-core firebird3.0-utils gcc gcc-12 gcc-9-base gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good hplip hplip-data libalgorithm-diff-xs-perl libaom3 libapt-pkg6.0 libasan5 libasan8 libbinutils libboost-filesystem1.74.0 libboost-iostreams1.74.0 libboost-locale1.74.0 libboost-thread1.74.0 libc-bin libc-dev-bin libc6 libc6-dbg libcaca0 libcbor0.8 libcc1-0 libcrypt1 libctf-nobfd0 libctf0 libcups2 libcupsimage2 libcurl3-gnutls libdc1394-25 libdecor-0-0 libdeflate0 libdirectfb-1.7-7 libdouble-conversion3 libdrm-amdgpu1 libdrm2 libdvdread8 libexpat1 libfbclient2 libffi8 libfido2-1 libfile-fcntllock-perl libflac12 libfluidsynth3 libfreeaptx0 libfreetype6 libgcc-12-dev libgcc-s1 libgcrypt20 libgdbm6 libgdk-pixbuf-2.0-0 libgdk-pixbuf-xlib-2.0-0 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgfortran5 libgirepository-1.0-1 libglib2.0-0 libglib2.0-bin libgnutls-dane0 libgnutls30 libgomp1 libgpg-error0 libgpgme11 libgpgmepp6 libgstreamer-gl1.0-0 libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libharfbuzz0b libhogweed6 libhpmud0 libib-util libicu72 libimath-3-1-29 libinstpatch-1.0-2 libisl23 liblbfgsb0 libldacbt-enc2 libldap-2.5-0 libldb2 liblerc4 libllvm15 liblocale-gettext-perl liblrdf0 libltc11 liblzma5 libmd0 libmd4c0 libmount1 libmpg123-0 libneon27 libnettle8 libnice10 libnsl2 libnspr4 libnss3 libopenexr-3-1-30 libopenh264-7 libopenmpt0 libopenni2-0 libopusfile0 liborcus-0.17-0 liborcus-parser-0.17-0 libp11-kit0 libpam0g libperl5.36 libpoppler126 libpython3-stdlib libpython3.11 libpython3.11-minimal libpython3.11-stdlib libqhull-r8.0 libqrencode4 libqscintilla2-qt5-15 libqt5charts5 libqt5core5a libqt5dbus5 libqt5designer5 libqt5gui5 libqt5help5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5serialport5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5 libqt5widgets5 libqt5xml5 libraptor2-0 libraqm0 libreadline8 libreoffice-base-drivers libreoffice-common libreoffice-core-nogui libreoffice-help-common libreoffice-help-en-gb libreoffice-l10n-en-gb libsane-hpaio libsasl2-2 libsdl2-2.0-0 libsdl2-image-2.0-0 libsdl2-mixer-2.0-0 libsdl2-ttf-2.0-0 libselinux1 libshout3 libsmbclient libsnmp40 libsqlite3-0 libsrt1.5-gnutls libssl3 libstdc++6 libtdb1 libtevent0 libtext-charwidth-perl libtext-iconv-perl libtiff6 libtirpc3 libubsan1 libuno-cppu3 libuno-cppuhelpergcc3-3 libuno-purpenvhelpergcc3-3 libuno-sal3 libuno-salhelpergcc3-3 libva-drm2 libva-x11-2 libva2 libvpx7 libvulkan1 libwayland-client0 libwayland-cursor0 libwbclient0 libwebp7 libwebpdemux2 libwebpmux3 libx11-6 libx11-dev libx11-xcb1 libx265-199 libxcb-xinput0 libxmlsec1-nss libxxhash0 libz3-4 libzstd1 libzxing2 locales mesa-vulkan-drivers mypy node-clipboard node-prismjs openssh-client openssh-server openssh-sftp-server perl perl-base perl-modules-5.36 printer-driver-hpcups python3 python3-apt python3-astroid python3-attr python3-brotli python3-cairo python3-cffi-backend python3-contourpy python3-cups python3-dbus python3-distutils python3-fonttools python3-fs python3-gi python3-gi-cairo python3-kiwisolver python3-lazy-object-proxy python3-lib2to3 python3-lxml python3-lz4 python3-markupsafe python3-matplotlib python3-minimal python3-mpmath python3-mypy python3-numpy python3-packaging python3-pil python3-pil.imagetk python3-psutil python3-py python3-pygame python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtchart python3-pyqt5.qtserialport python3-pyqt5.qtsvg python3-pyqt5.sip python3-renderpm python3-reportlab-accel python3-rpi.gpio python3-scipy python3-simplejson python3-sip python3-smbc python3-smbus python3-sympy python3-tk python3-tz python3-ufolib2 python3-unicodedata2 python3-wrapt python3-zmq python3.11 python3.11-minimal qt5-gtk-platformtheme qt5-gtk2-platformtheme qt5-style-plugin-cleanlooks qt5-style-plugin-motif qt5-style-plugin-plastique qt5-style-plugins qt5ct rpi.gpio-common runit-helper samba-libs unicode-data uno-libs-private ure Suggested packages: binutils-doc cpp-doc gcc-12-locales cpp-12-doc cups-bsd cups-pdf foomatic-db-compressed-ppds | foomatic-db smbclient debsig-verify firebird3.0-server firebird3.0-doc gcc-multilib autoconf automake libtool flex bison gcc-doc gcc-12-doc frei0r-plugins hplip-doc hplip-gui python3-notify2 glibc-doc libnss-nis libnss-nisplus libdirectfb-extra libdvdcss2 low-memory-monitor dns-root-data gnutls-bin libvisual-0.4-plugins gstreamer1.0-tools liblrdf0-dev cryptsetup-bin libpam-doc libqscintilla2-doc qgnomeplatform-qt5 qt5-image-formats-plugins raptor2-utils libjtds-java libreoffice-sdbc-mysql | libmyodbc | libmariadb-java libreoffice-sdbc-postgresql | odbc-postgresql | libpg-java libsqliteodbc | tdsodbc | odbc-mdbtools libreoffice-grammarcheck-en-gb mythes-en-gb libx11-doc mypy-doc keychain libpam-ssh monkeysphere ssh-askpass molly-guard ufw perl-doc libterm-readline-gnu-perl | libterm-readline-perl-perl libtap-harness-archive-perl python3-doc python3-venv python-apt-doc python-attr-doc python-dbus-doc python-lxml-doc cm-super-minimal dvipng fonts-staypuft inkscape ipython3 python3-cairocffi python3-gobject texlive-extra-utils texlive-latex-extra python-mpmath-doc python3-gmpy2 gfortran python3-dev python3-pytest python-pil-doc python-psutil-doc subversion python-pygame-doc timidity python-scipy-doc texlive-fonts-extra python-sympy-doc tix python3-tk-dbg python3.11-venv python3.11-doc binfmt-support Recommended packages: ipp-usb libc6-dev | libc-dev libc6-dev apt libc-devtools libdecor-0-plugin-1-cairo | libdecor-0-plugin-1 libgdk-pixbuf2.0-bin libgpg-error-l10n gstreamer1.0-gl qtwayland5 libreoffice-sdbc-hsqldb libreoffice-sdbc-firebird python3-uno libreoffice-core libsasl2-modules python3-typeshed g++ | c++-compiler isympy-common The following packages will be REMOVED: build-essential* g++* g++-8* gcc-8* libc6-dev* libexpat1-dev* libpython-all-dev* libpython-dev* libpython2-dev* libpython2.7-dev* libpython3-dev* libpython3.7-dev* libreoffice* libreoffice-avmedia-backend-gstreamer* libreoffice-base* libreoffice-base-core* libreoffice-calc* libreoffice-core* libreoffice-draw* libreoffice-gtk3* libreoffice-impress* libreoffice-java-common* libreoffice-librelogo* libreoffice-math* libreoffice-nlpsolver* libreoffice-pi* libreoffice-report-builder* libreoffice-report-builder-bin* libreoffice-script-provider-bsh* libreoffice-script-provider-js* libreoffice-script-provider-python* libreoffice-sdbc-firebird* libreoffice-sdbc-hsqldb* libreoffice-sdbc-postgresql* libreoffice-style-tango* libreoffice-wiki-publisher* libreoffice-writer* libstdc++-8-dev* mu-editor* python-all-dev* python-automationhat* python-blinkt* python-cap1xxx* python-dev* python-drumhat* python-envirophat* python-explorerhat* python-gi* python-microdotphat* python-motephat* python-numpy* python-phatbeat* python-pianohat* python-picamera* python-pygame* python-rainbowhat* python-rpi.gpio* python-scrollphathd* python-sense-emu* python-sense-hat* python-skywriter* python-touchphat* python-unicornhathd* python2-dev* python2.7-dev* python3-crypto* python3-dev* python3-ipykernel* python3-ipython* python3-qtconsole* python3-rtimulib* python3-sense-hat* python3-spidev* python3-typed-ast* python3-unicornhathd* python3-uno* python3-venv* python3.7-dev* sense-hat* thonny* uno-libs3* The following NEW packages will be installed: cpp-12 distro-info-data gcc-12 gcc-9-base libaom3 libapt-pkg6.0 libasan8 libboost-filesystem1.74.0 libboost-iostreams1.74.0 libboost-locale1.74.0 libboost-thread1.74.0 libcbor0.8 libcrypt1 libctf-nobfd0 libctf0 libdc1394-25 libdecor-0-0 libdeflate0 libdirectfb-1.7-7 libdouble-conversion3 libdvdread8 libffi8 libfido2-1 libflac12 libfluidsynth3 libfreeaptx0 libgcc-12-dev libgcc-s1 libgdk-pixbuf-2.0-0 libgdk-pixbuf-xlib-2.0-0 libhogweed6 libicu72 libimath-3-1-29 libinstpatch-1.0-2 libisl23 liblbfgsb0 libldacbt-enc2 libldap-2.5-0 libldb2 liblerc4 libllvm15 liblrdf0 libltc11 libmd0 libmd4c0 libneon27 libnettle8 libnsl2 libopenexr-3-1-30 libopenh264-7 libopenni2-0 libopusfile0 liborcus-0.17-0 liborcus-parser-0.17-0 libperl5.36 libpoppler126 libpython3.11 libpython3.11-minimal libpython3.11-stdlib libqhull-r8.0 libqrencode4 libqscintilla2-qt5-15 libraqm0 libreadline8 libreoffice-core-nogui libsdl2-image-2.0-0 libsdl2-mixer-2.0-0 libsdl2-ttf-2.0-0 libsnmp40 libsrt1.5-gnutls libssl3 libtiff6 libuno-cppu3 libuno-cppuhelpergcc3-3 libuno-purpenvhelpergcc3-3 libuno-sal3 libuno-salhelpergcc3-3 libvpx7 libwebp7 libx265-199 libxcb-xinput0 libxxhash0 libz3-4 libzxing2 mesa-vulkan-drivers node-clipboard node-prismjs perl-modules-5.36 python3-attr python3-brotli python3-contourpy python3-fonttools python3-fs python3-lz4 python3-mpmath python3-packaging python3-py python3-pyqt5.sip python3-scipy python3-sympy python3-tz python3-ufolib2 python3-unicodedata2 python3.11 python3.11-minimal qt5-gtk2-platformtheme qt5-style-plugin-cleanlooks qt5-style-plugin-motif qt5-style-plugin-plastique runit-helper unicode-data uno-libs-private The following packages will be upgraded: binutils binutils-arm-linux-gnueabihf binutils-common coinor-libcbc3 coinor-libcgl1 coinor-libcoinmp1v5 cpp cups cups-client cups-core-drivers cups-daemon cups-ipp-utils dpkg firebird3.0-common firebird3.0-common-doc firebird3.0-server-core firebird3.0-utils gcc gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good hplip hplip-data libalgorithm-diff-xs-perl libasan5 libbinutils libc-bin libc-dev-bin libc6 libc6-dbg libcaca0 libcc1-0 libcups2 libcupsimage2 libcurl3-gnutls libdrm-amdgpu1 libdrm2 libexpat1 libfbclient2 libfile-fcntllock-perl libfreetype6 libgcrypt20 libgdbm6 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgfortran5 libgirepository-1.0-1 libglib2.0-0 libglib2.0-bin libgnutls-dane0 libgnutls30 libgomp1 libgpg-error0 libgpgme11 libgpgmepp6 libgstreamer-gl1.0-0 libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libharfbuzz0b libhpmud0 libib-util liblocale-gettext-perl liblzma5 libmount1 libmpg123-0 libnice10 libnspr4 libnss3 libopenmpt0 libp11-kit0 libpam0g libpython3-stdlib libqt5charts5 libqt5core5a libqt5dbus5 libqt5designer5 libqt5gui5 libqt5help5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5serialport5 libqt5sql5 libqt5sql5-sqlite libqt5svg5 libqt5test5 libqt5widgets5 libqt5xml5 libraptor2-0 libreoffice-base-drivers libreoffice-common libreoffice-help-common libreoffice-help-en-gb libreoffice-l10n-en-gb libsane-hpaio libsasl2-2 libsdl2-2.0-0 libselinux1 libshout3 libsmbclient libsqlite3-0 libstdc++6 libtdb1 libtevent0 libtext-charwidth-perl libtext-iconv-perl libtirpc3 libubsan1 libva-drm2 libva-x11-2 libva2 libvulkan1 libwayland-client0 libwayland-cursor0 libwbclient0 libwebpdemux2 libwebpmux3 libx11-6 libx11-dev libx11-xcb1 libxmlsec1-nss libzstd1 locales mypy openssh-client openssh-server openssh-sftp-server perl perl-base printer-driver-hpcups python3 python3-apt python3-astroid python3-cairo python3-cffi-backend python3-cups python3-dbus python3-distutils python3-gi python3-gi-cairo python3-kiwisolver python3-lazy-object-proxy python3-lib2to3 python3-lxml python3-markupsafe python3-matplotlib python3-minimal python3-mypy python3-numpy python3-pil python3-pil.imagetk python3-psutil python3-pygame python3-pyqt5 python3-pyqt5.qsci python3-pyqt5.qtchart python3-pyqt5.qtserialport python3-pyqt5.qtsvg python3-renderpm python3-reportlab-accel python3-rpi.gpio python3-simplejson python3-sip python3-smbc python3-smbus python3-tk python3-wrapt python3-zmq qt5-gtk-platformtheme qt5-style-plugins qt5ct rpi.gpio-common samba-libs ure 175 upgraded, 112 newly installed, 81 to remove and 665 not upgraded. 1 not fully installed or removed. Need to get 287 MB of archives. After this operation, 322 MB of additional disk space will be used. Do you want to continue? [Y/n] Get:1 http://archive.raspbian.org/raspbian oldstable/main armhf libc6 armhf 2.36-9+rpi1+deb12u14 [2,107 kB] Get:2 http://archive.raspbian.org/raspbian oldstable/main armhf libgcc-s1 armhf 12.2.0-14+rpi1+deb12u1 [36.1 kB] Get:3 http://archive.raspbian.org/raspbian oldstable/main armhf locales all 2.36-9+rpi1+deb12u14 [3,906 kB] Get:4 http://archive.raspbian.org/raspbian oldstable/main armhf libcbor0.8 armhf 0.8.0-2 [22.8 kB] Get:5 http://archive.raspbian.org/raspbian oldstable/main armhf libssl3 armhf 3.0.20-1~deb12u2 [1,544 kB] Get:6 http://archive.raspbian.org/raspbian oldstable/main armhf libfido2-1 armhf 1.12.0-2 [67.6 kB] Get:7 http://archive.raspbian.org/raspbian oldstable/main armhf libselinux1 armhf 3.4-1+b2 [64.5 kB] Get:8 http://archive.raspbian.org/raspbian oldstable/main armhf openssh-client armhf 1:9.2p1-2+deb12u10 [799 kB] Get:9 http://archive.raspbian.org/raspbian oldstable/main armhf runit-helper all 2.15.2 [6,520 B] Get:10 http://archive.raspbian.org/raspbian oldstable/main armhf libpam0g armhf 1.5.2-6+deb12u2 [86.3 kB] Get:287 http://archive.raspbian.org/raspbian oldstable/main armhf python3-astroid all 2.14.2-1 [209 kB] Fetched 287 MB in 2min 31s (1,892 kB/s) Reading changelogs... Done apt-listchanges: Mailing root: apt-listchanges: news for R4 Extracting templates from packages: 100% Preconfiguring packages ... (Reading database ... 186311 files and directories currently installed.) Removing mu-editor (1.0.3+dfsg-6) ... Removing python3-qtconsole (4.3.1-1) ... Removing python3-ipykernel (4.9.0-1) ... Removing python3-ipython (8.5.0-4) ... (Reading database ... 185720 files and directories currently installed.) Preparing to unpack .../locales_2.36-9+rpi1+deb12u14_all.deb ... Unpacking locales (2.36-9+rpi1+deb12u14) over (2.28-10+rpt2+rpi1+deb10u1) ... Preparing to unpack .../openssh-server_1%3a9.2p1-2+deb12u10_armhf.deb ... Unpacking openssh-server (1:9.2p1-2+deb12u10) over (1:7.9p1-10+deb10u2+rpt1) ... Preparing to unpack .../libc6_2.36-9+rpi1+deb12u14_armhf.deb ... Checking for services that may need to be restarted... Checking init scripts... Unpacking libc6:armhf (2.36-9+rpi1+deb12u14) over (2.28-10+rpt2+rpi1+deb10u1) ... Selecting previously unselected package libgcc-s1:armhf. Preparing to unpack .../libgcc-s1_12.2.0-14+rpi1+deb12u1_armhf.deb ... Unpacking libgcc-s1:armhf (12.2.0-14+rpi1+deb12u1) ... Replacing files in old package libgcc1:armhf (1:8.3.0-6+rpi1) ... Setting up libgcc-s1:armhf (12.2.0-14+rpi1+deb12u1) ... Setting up libc6:armhf (2.36-9+rpi1+deb12u14) ... /usr/bin/perl: error while loading shared libraries: libcrypt.so.1: cannot open shared object file: No such file or directory dpkg: error processing package libc6:armhf (--configure): installed libc6:armhf package post-installation script subprocess returned error exit status 127 Errors were encountered while processing: libc6:armhf Error: Timeout was reached E: Sub-process /usr/bin/dpkg returned an error code (1) pi@R4:~ $ sudo apt-get update sudo: account validation failure, is your account locked? pi@R4:~ $ pi@R4:~ $ pi@R4:~ $ sudo apt-get install --reinstall libc6 libc6:armhf libcrypt1 libcrypt1:armhf sudo: account validation failure, is your account locked? pi@R4:~ $ su - su: Authentication failure pi@R4:~ $ sudo reboot now sudo: account validation failure, is your account locked?
try to save R4 data

I have

new microSD creation

Gemini : I have a new Raspberry 4 and a new 64 GB microSD card. Tell me in detail all the operations, commands and tools I must use to install latest Raspbian on Raspberry 4

Lets go :

  1. go to www.raspberrypi.com/software/ -> /operating-systems/ -> 2026-10-06-raspios-trixie-arm64.img.xz
    Kernel version 6.18, Debian version 13 (trixie)
  2. on Mint, start (Pi) "Imager"
  3. update "Imager" from 1.8.5 to 2.0.12 :

    sudo apt install rpi-imager

    or ... An .AppImage file is a portable application package for Linux. Unlike traditional software installed via a package manager, AppImages do not need to be "installed" in the traditional sense—they run standalone.
    Download (but do not run) -> use 1.8.5
  4. "Choose device" := Pi4 ;
  5. "Choose OS" := Raspberry Pi OS (64 bit)
  6. "Choose storage" := Generic Mass Storage (IO64GBnew) - 64 GB, mounted as "/media/sebas/IO64GBnew"
  7. "would you like to apply OS customization settings ?" - first "edit settings"
    configure your hostname, username, password, and Wi-Fi
    • hostname := "r4"
    • user := "pi"
    • SSID := "REDWIFI_RGQC_5G"
    • "Save" + "Apply settings"
  8. launch "Write" -> wait "Verify" says "OK"
R4 (final) TCP/IP configuration

We want a fixed IP on wifi and also on eth0, so no DHCP is required.

R4 TCP/IP configuration file

pi@R4:~ $ cat /etc/dhcpcd.conf interface eth0 static ip_address=192.168.1.14/24 static routers=192.168.1.1 static domain_name_servers=8.8.8.8 8.8.4.4 interface wlan0 static ip_address=192.168.1.200/24 static routers=192.168.1.1 static domain_name_servers=8.8.8.8 8.8.4.4

TCPIP cfg R3, R4, PiZero.

Restart service :

pi@R4:~ $ sudo systemctl restart dhcpcd.service
R4 final TCP/IP configuration

Resultat :

pi@R4:~ $ ifconfig eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet 192.168.1.14 netmask 255.255.255.0 broadcast 192.168.1.255 ether dc:a6:32:7f:45:7c txqueuelen 1000 (Ethernet) wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.200 netmask 255.255.255.0 broadcast 192.168.1.255 ether dc:a6:32:7f:45:80 txqueuelen 1000 (Ethernet)

El Raspbian no pot tenir 2 IP's, així que si activem eth0, deix de funcionar wlan0 !

fixed IP

  1. see your network interfaces and connection names:

    nmcli connection show Name Type Device REDWIFI_RGQC_5G wifi wlan0
  2. set the static IPv4 :

    sudo nmcli connection modify "<Connection Name>" ipv4.addresses 192.168.1.200/24 ipv4.gateway 192.168.1.1 ipv4.dns "8.8.8.8,8.8.4.4" ipv4.method manual
  3. apply the changes

    sudo nmcli connection down REDWIFI_RGQC_5G sudo nmcli connection up "<Connection Name>"
  4. verify Pi is now actively using the new static IP address :

    hostname -I 192.168.1.200
remote access
enable SSH

  1. sudo raspi-config
  2. "3 = Interface options"
  3. "I1" = SSH
  4. "Enable"
welcome message

El contingut :

pi@pi4:~ $ cat /etc/ssh/sshd_banner.txt * *************************************************** * +++ R4 say HI +++ * /etc/ssh/sshd_banner.txt from /etc/ssh/sshd_config * usuari pi/pwd_hint * ***************************************************

I el configurem :

pi@pi4:~ $ cat /etc/ssh/sshd_config Banner /etc/ssh/sshd_banner.txt
test access

  1. hostname -I
  2. ssh username@<your-pi-ip-address>
modify hostname

Aixi :

sudo hostnamectl set-hostname new-hostname (as "pi4") also ... sudo vi /etc/hosts change at 127.0.1.1 sudo reboot
fitxers de configuracio

Anem posant a lloc :

mail

Per veure els errors del cron ens cal la comanda "mail" :

pi@pi4:~ $ sudo apt-get install mailutils (large output) pi@pi4:~ $ mail -s "Test Subject" pi@localhost < /dev/null mail: Null message body; hope that's ok pi@pi4:~ $ mail "/var/mail/pi": 1 message 1 new >N 1 pi@pi4 dc. d’oct. 14 15/425 Test Subject ? q Held 1 message in /var/mail/pi pi@pi4:~ $ mail -f /home/pi/mbox "/home/pi/mbox": 1 message 1 new >N 1 pi@pi4 dc. d’oct. 14 19/489 Test Subject ? d ? q Held 0 messages in /home/pi/mbox
linger

If you want the service to run even when you are logged out of the Pi, enable user lingering:

sudo loginctl enable-linger pi

Verification: Run "loginctl user-status pi" and verify that "Linger: yes" is displayed.

pi@pi4:~ $ loginctl user-status pi pi (1000) Since: Tue 2026-10-13 15:13:04 CEST; 5h 19min ago State: active Sessions: 10 3 2 *1 Linger: yes Unit: user-1000.slice
R4 bot

We shall run it as a service :

pi@R4:~/.config/systemd/user $ cat r4_bot.service [Unit] Description=Raspberry 4 bot code - /home/pi/.config/systemd/user/r4_bot.service - (v 1.e) ; v 1.a - start ; v 1.b - run "simple" and not "forking" to get python messages into log file ; v 1.c - remove StdOut and StdErr - we use "logging" inside python ; v 1.d - use "pi" user instead of "sebas" ; v 1.e - set 60 seg as restart timer ; systemctl --user status r4_bot.service Wants=network-online.target After=network-online.target [Service] Type=simple ; simple - a long-running process that does not background its self and stays attached to the shell ; forking - a typical daemon that forks itself detaching it from the process that ran it, effectively backgrounding itself ; oneshot - a short-lived process that is expected to exit WorkingDirectory=/home/pi/python/telegram/telepot/ ExecStart=/home/pi/python/telegram/telepot/3_alby_bot.py EnvironmentFile=/home/pi/python/telegram/telepot/my_bot.conf ; StandardOutput=append:/home/pi/logs/r4_bot.log ; StandardError=inherit Restart=always RestartSec=60 SyslogIdentifier=r4_bot Environment=NODE_ENV=production [Install] WantedBy=default.target

pi@R4:~/python/telegram/telepot $ cat 3_alby_bot.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- # implement "sag_r4" bot # Versions : # 20210612 - 2.b - use logging # 20210613 - 2.c - pprint received message and chat object # 2.d - INFO log # 20210614 - 2.e - more commands # 20221129 - 2.f - reinstall "telepot" - no "sebas" user # 20221219 - 2.g - set ID also in help message # 20230311 - 2.h - read termometer # 20230606 - 2.i - return version # 20230606 - 2.j - "Auto" IP # 20230719 - 3.a - send answer to origin, not to Sebas ; display version in /help command # https://core.telegram.org/bots/api#getchat - returns "chat" object # https://core.telegram.org/bots/api#chat - # service defined in /home/pi/.config/systemd/user/r4_bot.service # systemctl status --user r4_bot.service # systemctl stop --user r4_bot.service # systemctl start --user r4_bot.service import datetime from gpiozero import CPUTemperature # python3 -m pip install gpiozero import logging # import os from pprint import pprint # import time import tinytuya # python3 -m pip install pytuya import telepot # https://telepot.readthedocs.io/en/latest/ # ============================================ # start of code my_envir_var="SAG_TG_R4_TKN" # see /etc/environment - compte si engeguem com servei sebas_id = "304588090" # Sebastia Altemir szText = " " # create var to be used in handle szVersio = "v 3.a.1" # identify code version fnLog = '/home/pi/logs/r4_bot.log' # logging.basicConfig( filename=fnLog, level=logging.DEBUG, format='%(asctime)s %(message)s', datefmt='%d/%m/%Y %H:%M:%S' ) logging.basicConfig( filename=fnLog, level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%d/%m/%Y %H:%M:%S' ) logging.info( '\n\n *** R4 bot starts {%s} ***' % szVersio ) DEVICE_ID = "bfe483b0ac18224f06dqww" # sag 20230308 # DEVICE_IP = "192.168.1.130" # temperature meter, 2023/04/24 (sag) ---> use "Auto" DEVICE_KEY = "fb9d5ba086f97ed4" # sag DEVICE_VERS = "3.3" szText = ">>> TinyTuya (Tuya Interface) version [%s]." % tinytuya.__version__ logging.info( szText ) # === def Get_Timestamp(): now = datetime.datetime.now() szTS = now.strftime("%Y-%m-%d %H:%M:%S") return szTS # === def Get_Thermometer(): szText = '>>> Get_thermometer(auto ip)' logging.info( szText ) szTEMP = '22 ºC' iTEMP = 0 szText = '>>> Testing device {} with key {} version {}'.format( DEVICE_ID, DEVICE_KEY, DEVICE_VERS ) logging.info( szText ) d = tinytuya.OutletDevice( DEVICE_ID, "Auto", DEVICE_KEY ) # connect to device and fetch state ... "Auto" finds IP d.set_version(3.3) try: dps = d.detect_available_dps() szText = "+++ DPS {}".format(dps) logging.info( szText ) iTEMP = dps['1'] except KeyError: iTEMP = 0 except: szT = Get_Timestamp() print( "--- (%s) Unexpected error (%s)." % (szT, sys.exc_info() ) ) szText = '+++ Thermometer says {}.'.format(iTEMP) logging.info( szText ) return iTEMP/10 # === def my_handle(msg): logging.info( '\n*** (1) handle ***' ) # pprint(msg) chat_id = msg['chat']['id'] new_command = msg['text'] szText = "*** received command is {%s} ***" % new_command logging.info( szText ) chat_id = telepot.glance(msg) content_type, chat_type, chat_id = telepot.glance(msg) # print( "CT(%s), CT(%s), ID(%s)" % ( content_type, chat_type, str(chat_id) ) ) szText = "CT(%s), CT(%s), ID(%s)" % ( content_type, chat_type, str(chat_id) ) logging.info( szText ) objChat = bot.getChat( chat_id ) # get all info of a user - returns a "Chat" object # pprint(objChat) # Printing dictionary # print ("Original dictionary is : " + str(objChat)) # using in operator to get key and value # print ("Dict key-value are : ") # for i in objChat : # print(i, objChat[i]) if content_type == 'text': # make sure if new_command == '/temp': cpu = CPUTemperature() result = str( cpu.temperature ) mytemp = ">>> CPU at "+result+" ºC" bot.sendMessage(chat_id, mytemp) else: if new_command == '/talk': myId = objChat['id'] myUserName = objChat['last_name'] myFirstName = objChat['first_name'] myMsg = ">>> ["+myFirstName+"] ("+str(chat_id)+") - cuyons quin fred ºC" bot.sendMessage( chat_id, myMsg ) else: if new_command == '/term': szText = ">>> user request TEMP" logging.info( szText ) myUserName = objChat['last_name'] myFirstName = objChat['first_name'] # iT = 0 iT = Get_Thermometer() szText = "+++ thermometer {} says {}".format(szVersio,iT) logging.info( szText ) myMsg = ">>> ["+myFirstName+"] thermometer indicates " + str(iT) + 'ºC' bot.sendMessage( chat_id, myMsg ) else: if new_command == '/help': myUserName = objChat['last_name'] myFirstName = objChat['first_name'] myMsg = ">>> ["+myFirstName+"] bot version("+szVersio+") use /temp or /talk or /term" bot.sendMessage( chat_id, myMsg ) else: szErr = 'what is ('+new_command+') ? use /help' bot.sendMessage( chat_id, szErr ) try: szTxt = '*** (1) get token {}.'.format(my_envir_var) logging.info( szTxt ) my_token = os.environ[ my_envir_var ] # /etc/environment if not a service lng = len( my_token ) szTxt = '*** (1) llegit token {}.'.format(my_token) logging.info( szTxt ) szTxt = '*** (1) llargada token {}.'.format(lng) logging.info( szTxt ) logging.info( '*** (2) - telepot.Bot' ) bot = telepot.Bot( my_token ) logging.info( '*** (2) - {%s}.' % ( bot.getMe() ) ) bot.message_loop(my_handle) except KeyError: logging.info( '--- (e) Environment variable (%s) does not exist' % my_envir_var ) while True: time.sleep(10)

El log normal es aquest :

pi@R4:~/logs $ cat r4_bot.log 24/12/2024 18:08:14 *** (1) handle *** 24/12/2024 18:08:14 *** received command is {/temp} *** 24/12/2024 18:08:14 CT(text), CT(private), ID(304588090) 24/12/2024 18:08:20 *** (1) handle *** 24/12/2024 18:08:20 *** received command is {/talk} *** 24/12/2024 18:08:20 CT(text), CT(private), ID(304588090) 24/12/2024 18:08:28 *** (1) handle *** 24/12/2024 18:08:28 *** received command is {/term} *** 24/12/2024 18:08:28 CT(text), CT(private), ID(304588090) 24/12/2024 18:08:28 >>> user request TEMP 24/12/2024 18:08:28 >>> Get_thermometer(auto ip) 24/12/2024 18:08:28 >>> Testing device bfe483b0ac18224f06dqww with key fb9d5ba086f97ed4 version 3.3 24/12/2024 18:08:33 +++ DPS {'1': 159, '2': 65, '9': 'c', '10': 390, '11': 0, '12': 60, '13': 20, '14': 'cancel', '15': 'upperalarm', '21': True, '101': False, '102': 0, '103': 0, '104': 0, '105': 0, '106': 0, '107': 0} 24/12/2024 18:08:33 +++ Thermometer says 159. 24/12/2024 18:08:33 +++ thermometer v 3.a.1 says 15.9

To install the bot, we do :

pi@R4:~ $ python3 -m pip install telepot ... pi@R4:~ $ python3 -m pip install --upgrade pip Defaulting to user installation because normal site-packages is not writeable Collecting pip Downloading https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl (2.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 1.4 MB/s eta 0:00:00 Installing collected packages: pip Successfully uninstalled pip-23.1.2 Successfully installed pip-24.0

The environment file is :

pi@R4:~/python/telegram/telepot $ cat my_bot.conf SAG_TG_R4_TKN="1801244684:AaEFF2BOK27xkxjNKokvqClEXzWOLj3TIYs"

I el estat normal/funcionant del servei es :

pi@R4:~/python/telegram/telepot $ systemctl --user status r4_bot.service ● r4_bot.service - Raspberry 4 bot code - /home/pi/.config/systemd/user/r4_bot.service - (v 1.d) Loaded: loaded (/home/pi/.config/systemd/user/r4_bot.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2022-11-29 20:00:18 CET; 53s ago Main PID: 25100 (python3) CGroup: /user.slice/user-1000.slice/user@1000.service/r4_bot.service └─25100 python3 /home/pi/python/telegram/telepot/3_alby_bot.py Nov 29 20:00:18 R4 systemd[877]: Started Raspberry 4 bot code - /home/pi/.config/systemd/user/r4_bot.service - (v 1.d).
R4 GUI restart

When I re-plug the Raspberry HDMI to TV set, no GUI comes up - forum

pi@R4:~ $ geany & [1] 21116 pi@R4:~ $ Unable to init server: Could not connect: Connection refused Geany: cannot open display ^C [1]+ Exit 1 geany

Lets try X11 :

pi@R4:~ $ X -configure X.Org X Server 1.20.4 X Protocol Version 11, Revision 0 Build Operating System: Linux 5.4.0-109-generic armv8l Raspbian Current Operating System: Linux R4 5.10.103-v7l+ #1529 SMP Tue Mar 8 12:24:00 GMT 2022 armv7l Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 smsc95xx.macaddr=DC:A6:32:7F:45:7C vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 console=ttyS0,115200 console=tty1 root=/dev/mmcblk0p7 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait splash Build Date: 04 August 2022 12:56:42PM xorg-server 2:1.20.4-1+rpt4+deb10u5 (https://www.debian.org/support) Current version of pixman: 0.36.0 Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (==) Log file: "/home/pi/.local/share/xorg/Xorg.0.log", Time: Sat Dec 31 18:51:41 2022 List of video drivers: fbturbo modesetting fbdev No devices to configure. Configuration failed. (EE) Server terminated with error (2). Closing log file.

Try xrandr :

pi@R4:~ $ xrandr Can't open display :0.0 pi@r3-64gb:~ $ DISPLAY=:0 xrandr Screen 0: minimum 16 x 16, current 1920 x 1080, maximum 32767 x 32767 XWAYLAND0 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 160mm x 90mm 1920x1080 59.96*+ 1440x1080 59.99 1280x1024 59.89 1024x768 59.92 800x600 59.86 640x480 59.38

Display actual display manager :

pi@R4:~ $ cat /etc/X11/default-display-manager /usr/sbin/lightdm

And its status :

pi@R4:~ $ sudo systemctl status display-manager ● lightdm.service - Light Display Manager Loaded: loaded (/lib/systemd/system/lightdm.service; indirect; vendor preset: enabled) Active: failed (Result: exit-code) since Sun 2022-12-18 17:48:29 CET; 1 weeks 6 days ago Docs: man:lightdm(1) Process: 975 ExecStartPre=/bin/sh -c [ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ] (code=ex Process: 977 ExecStart=/usr/sbin/lightdm (code=exited, status=1/FAILURE) Main PID: 977 (code=exited, status=1/FAILURE) pi@R4:~ $ sudo systemctl start display-manager pi@R4:~ $ sudo systemctl status display-manager ● lightdm.service - Light Display Manager Loaded: loaded (/lib/systemd/system/lightdm.service; indirect; vendor preset: enabled) Active: activating (auto-restart) (Result: exit-code) since Sat 2022-12-31 18:58:06 CET; 24ms ago Docs: man:lightdm(1) Process: 21679 ExecStartPre=/bin/sh -c [ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ] (code= Process: 21681 ExecStart=/usr/sbin/lightdm (code=exited, status=1/FAILURE) Main PID: 21681 (code=exited, status=1/FAILURE) pi@R4:~ $ /usr/sbin/lightdm Only root can run Light Display Manager. To run as a regular user for testing run with the --test-mode flag. pi@R4:~ $ /usr/sbin/lightdm --test-mode Running inside an X server requires Xephyr to be installed but it cannot be found. Please install it or update your PATH environment variable. pi@R4:~ $ sudo /usr/sbin/lightdm ** (lightdm:25731): WARNING **: 20:11:06.543: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files

Try "startx" :

pi@R4:~ $ startx X.Org X Server 1.20.4 X Protocol Version 11, Revision 0 xorg-server 2:1.20.4-1+rpt4+deb10u5 (https://www.debian.org/support) Current version of pixman: 0.36.0 Before reporting problems, check http://wiki.x.org to make sure that you have the latest version. Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (==) Log file: "/home/pi/.local/share/xorg/Xorg.0.log", Time: Sat Dec 31 20:08:15 2022 (==) Using system config directory "/usr/share/X11/xorg.conf.d" (EE) Fatal server error: (EE) parse_vt_settings: Cannot open /dev/tty0 (Permission denied) (EE) (EE) Server terminated with error (1). Closing log file. xinit: giving up xinit: unable to connect to X server: Connection refused xinit: server error Couldn't get a file descriptor referring to the console

Try "systemd-logind" :

pi@R4:/var/log $ sudo systemctl restart systemd-logind pi@R4:/var/log $ sudo systemctl status systemd-logind ● systemd-logind.service - Login Service Loaded: loaded (/lib/systemd/system/systemd-logind.service; static; vendor preset: enabled) Active: active (running) since Sat 2022-12-31 20:20:22 CET; 2s ago Docs: man:systemd-logind.service(8) man:logind.conf(5) https://www.freedesktop.org/wiki/Software/systemd/logind https://www.freedesktop.org/wiki/Software/systemd/multiseat Main PID: 26253 (systemd-logind) Status: "Processing requests..." Tasks: 1 (limit: 4915) CGroup: /system.slice/systemd-logind.service └─26253 /lib/systemd/systemd-logind Dec 31 20:20:22 R4 systemd[1]: Starting Login Service... Dec 31 20:20:22 R4 systemd-logind[26253]: New seat seat0. Dec 31 20:20:22 R4 systemd[1]: Started Login Service. Dec 31 20:20:22 R4 systemd-logind[26253]: New session 27306 of user pi.

Try "lxpanelctl" :

pi@R4:/var/log $ lxpanelctl restart Cant connect to display: :0.0
lightdm service : configuration and logs

LightDM description

Configuration file (quite large) :

pi@R4:~ $ cat /etc/lightdm/lightdm.conf | grep logind # logind-check-graphical = True to on start seats that are marked as graphical by logind # logind-check-graphical=false pi@R4:~ $ cat /etc/lightdm/lightdm.conf | grep greeter greeter-session=pi-greeter greeter-hide-users=false pi@R4:~ $ ls -1 /usr/share/xgreeters/ 0 lrwxrwxrwx 1 root root 33 Feb 5 2020 lightdm-greeter.desktop -> /etc/alternatives/lightdm-greeter 4 -rw-r--r-- 1 root root 187 Dec 27 2018 lightdm-gtk-greeter.desktop 4 -rw-r--r-- 1 root root 174 Mar 19 2021 pi-greeter.desktop

Display actual configuration :

pi@R4:~ $ lightdm --show-config [Seat:*] B greeter-session=pi-greeter B greeter-hide-users=false A session-wrapper=/etc/X11/Xsession B display-setup-script=/usr/share/dispsetup.sh B autologin-user=pi Sources: A /usr/share/lightdm/lightdm.conf.d/01_debian.conf B /etc/lightdm/lightdm.conf
lightdm command line tool

LightDM offers a command line tool, dm-tool, which can be used to lock the current seat, switch sessions, etc, which is useful with 'minimalist' window managers and for testing.

To see a list of available commands, execute:

$ dm-tool --help pi@R4:~ $ dm-tool switch-to-greeter Not running inside a display manager, XDG_SEAT_PATH not defined
lightdm as service

System service :

pi@R4:~ $ sudo service lightdm status ● lightdm.service - Light Display Manager Loaded: loaded (/lib/systemd/system/lightdm.service; indirect; vendor preset: enabled) Active: failed (Result: exit-code) since Sat 2022-12-31 20:28:00 CET; 15h ago Docs: man:lightdm(1) Process: 26694 ExecStartPre=/bin/sh -c [ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ] (code=exited, status=0/SUCCESS) Process: 26696 ExecStart=/usr/sbin/lightdm (code=exited, status=1/FAILURE) Main PID: 26696 (code=exited, status=1/FAILURE) Dec 31 20:28:00 R4 systemd[1]: lightdm.service: Service RestartSec=100ms expired, scheduling restart. Dec 31 20:28:00 R4 systemd[1]: lightdm.service: Scheduled restart job, restart counter is at 5. Dec 31 20:28:00 R4 systemd[1]: Stopped Light Display Manager. Dec 31 20:28:00 R4 systemd[1]: lightdm.service: Start request repeated too quickly. Dec 31 20:28:00 R4 systemd[1]: lightdm.service: Failed with result 'exit-code'. Dec 31 20:28:00 R4 systemd[1]: Failed to start Light Display Manager. Dec 31 20:28:00 R4 systemd[1]: lightdm.service: Triggering OnFailure= dependencies. pi@R4:~ $ sudo service lightdm start pi@R4:~ $ sudo service lightdm status ● lightdm.service - Light Display Manager Loaded: loaded (/lib/systemd/system/lightdm.service; indirect; vendor preset: enabled) Active: active (running) since Sun 2023-01-01 11:51:29 CET; 14ms ago Docs: man:lightdm(1) Process: 11468 ExecStartPre=/bin/sh -c [ "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/sbin/lightdm" ] (code=exited, status=0/SUCCESS) Main PID: 11470 (lightdm) Tasks: 5 (limit: 4915) CGroup: /system.slice/lightdm.service ├─11470 /usr/sbin/lightdm └─11480 /usr/lib/xorg/Xorg :0 -seat seat0 -auth /var/run/lightdm/root/:0 -nolisten tcp vt7 -novtswitch Jan 01 11:51:29 R4 systemd[1]: Starting Light Display Manager... Jan 01 11:51:29 R4 lightdm[11470]: Error getting user list from org.freedesktop.Accounts: GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.Accounts was not provided by any .service files Jan 01 11:51:29 R4 systemd[1]: Started Light Display Manager.

... and it crashes in 5 seconds

Dependencies :

pi@R4:~ $ systemctl list-dependencies --reverse lightdm.service lightdm.service ● └─graphical.target
lightdm log files

Few log files : /var/log/lightdm/lightdm.log and xorg.log and /var/log/Xorg.0.log

pi@R4:~ $ sudo cat /var/log/lightdm/lightdm.log [+0.62s] DEBUG: XServer 0: Logging to /var/log/lightdm/x-0.log [+0.62s] DEBUG: XServer 0: Waiting for ready signal from X server :0 [+1.24s] DEBUG: Process 11835 exited with return value 1 [+1.24s] DEBUG: XServer 0: X server stopped [+1.24s] DEBUG: Releasing VT 7 [+1.24s] DEBUG: XServer 0: Removing X server authority /var/run/lightdm/root/:0 [+1.24s] DEBUG: Seat seat0: Display server stopped [+1.24s] DEBUG: Seat seat0: Stopping display server, no sessions require it [+1.24s] DEBUG: Seat seat0: Stopping; greeter display server failed to start pi@R4:~ $ sudo cat /var/log/lightdm/x-0.log X.Org X Server 1.20.4 X Protocol Version 11, Revision 0 Markers: (--) probed, (**) from config file, (==) default setting, (++) from command line, (!!) notice, (II) informational, (WW) warning, (EE) error, (NI) not implemented, (??) unknown. (==) Log file: "/var/log/Xorg.0.log", Time: Sun Jan 1 11:54:52 2023 (==) Using system config directory "/usr/share/X11/xorg.conf.d" (EE) Fatal server error: (EE) no screens found (EE) (EE) pi@R4:~ $ cat /var/log/Xorg.0.log [1188290.067] X.Org X Server 1.20.4 X Protocol Version 11, Revision 0 [1188290.659] (EE) Screen(s) found, but none have a usable configuration.
HDMI reinit

How to reinitialize HDMI without rebooting the RPi

wifi power_save on R4

$ journalctl | grep brcmfmac Jun 13 22:05:03 R4 kernel: brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled Jun 13 22:10:04 R4 kernel: brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled Jun 13 22:15:03 R4 kernel: brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled Jun 13 22:20:03 R4 kernel: brcmfmac: brcmf_cfg80211_set_power_mgmt: power save enabled pi@R4:~ $ iw wlan0 get power_save Power save: on

raspberry stackexchange

a webcam on R4

Vull mesurar quant es triga a fer una foto i quant de espai ocupa ...

Conectem la webcam :

$ dmesg [377150.104515] usb 1-1.1: new full-speed USB device number 3 using xhci_hcd [377150.248009] usb 1-1.1: New USB device found, idVendor=046d, idProduct=08da, bcdDevice= 1.00 [377150.248031] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [377150.335146] gspca_main: v2.14.0 registered [377150.342861] gspca_main: gspca_zc3xx-2.14.0 probing 046d:08da [377151.768414] input: gspca_zc3xx as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/input/input0 [377151.769575] usbcore: registered new interface driver gspca_zc3xx [377151.854174] usbcore: registered new interface driver snd-usb-audio $ slog Jun 13 22:09:05 r4 kernel: [377150.104515] usb 1-1.1: new full-speed USB device number 3 using xhci_hcd Jun 13 22:09:05 r4 kernel: [377150.248009] usb 1-1.1: New USB device found, idVendor=046d, idProduct=08da, bcdDevice= 1.00 Jun 13 22:09:05 r4 kernel: [377150.248031] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 Jun 13 22:09:05 r4 mtp-probe: checking bus 1, device 3: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1" Jun 13 22:09:05 r4 mtp-probe: bus: 1, device: 3 was not an MTP device Jun 13 22:09:05 r4 kernel: [377150.335146] gspca_main: v2.14.0 registered Jun 13 22:09:05 r4 kernel: [377150.342861] gspca_main: gspca_zc3xx-2.14.0 probing 046d:08da Jun 13 22:09:06 r4 kernel: [377151.768414] input: gspca_zc3xx as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/input/input0 Jun 13 22:09:06 r4 kernel: [377151.769575] usbcore: registered new interface driver gspca_zc3xx Jun 13 22:09:06 r4 kernel: [377151.854174] usbcore: registered new interface driver snd-usb-audio Jun 13 22:09:06 r4 mtp-probe: checking bus 1, device 3: "/sys/devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1" Jun 13 22:09:06 r4 mtp-probe: bus: 1, device: 3 was not an MTP device Jun 13 22:09:06 r4 systemd-udevd[25586]: Process '/usr/sbin/alsactl -E HOME=/run/alsa restore 2' failed with exit code 99. Jun 13 22:09:07 r4 systemd-udevd[25581]: Process '/usr/sbin/th-cmd --socket /var/run/thd.socket --passfd --udev' failed with exit code 1.

Actualitzem :

pi@R4:~/python/webcam $ python -m pip install --upgrade pip Successfully installed pip-20.3.4 pi@R4:~/python/webcam $ python3 -m pip install --upgrade pip Successfully installed pip-23.1.2 pi@R4:~/python/webcam $ python -m pip install --upgrade opencv-python {python2 falla} pi@R4:~/python/webcam $ python3 -m pip install --upgrade opencv-python Installing collected packages: numpy, opencv-python Successfully installed numpy-1.21.6 opencv-python-4.7.0.72 pi@R4:~/python/webcam $ sudo apt-get update

Que tenim ?

pi@R4:~/python/webcam $ v4l2-ctl --list-devices bcm2835-codec-decode (platform:bcm2835-codec): /dev/video10 /dev/video11 /dev/video12 /dev/video18 bcm2835-isp (platform:bcm2835-isp): /dev/video13 /dev/video14 /dev/video15 /dev/video16 Cannot open device /dev/video0, exiting.

Lets run the code :

pi@R4:~/python/webcam $ ./1_fer_foto.py ### NUMPY version I have is 1.21.6 ### CV2 version I have is 4.7.0 ImportError: libcblas.so.3: cannot open shared object file: No such file or directory --> sudo apt-get install libcblas-dev --> sudo apt-get install libatlas-base-dev [ WARN:0@0.022] global cap_v4l.cpp:982 open VIDEOIO(V4L2:/dev/video0): can't open camera by index [ERROR:0@0.025] global obsensor_uvc_stream_channel.cpp:156 getStreamChannelGroup Camera index out of range --> cap = cv2.VideoCapture(-1) [ WARN:0@0.022] global cap_v4l.cpp:969 open VIDEOIO(V4L2): can't find camera device [ERROR:0@0.025] global obsensor_uvc_stream_channel.cpp:156 getStreamChannelGroup Camera index out of range cap.set( cv2.cv.CV_CAP_PROP_FRAME_WIDTH, 160 ) # 1280 1024 800 640 320 ?160 AttributeError: module 'cv2' has no attribute 'cv'
Update R4

20261012 :

pi@R4:~ $ sudo apt update Get:1 http://packages.azlux.fr/debian bullseye InRelease [4,003 B] Get:2 http://archive.raspberrypi.org/debian buster InRelease [54.2 kB] Ign:3 http://raspbian.raspberrypi.org/raspbian buster InRelease Err:4 http://raspbian.raspberrypi.org/raspbian buster Release 404 Not Found [IP: 93.93.128.193 80] Get:5 http://packages.azlux.fr/debian bullseye/main armhf Packages [4,743 B] Get:6 http://archive.raspberrypi.org/debian buster/main armhf Packages [400 kB] Reading package lists... Done E: The repository 'http://raspbian.raspberrypi.org/raspbian buster Release' no longer has a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details. N: Repository 'http://packages.azlux.fr/debian bullseye InRelease' changed its 'Suite' value from 'stable' to 'oldoldstable' N: Repository 'http://archive.raspberrypi.org/debian buster InRelease' changed its 'Suite' value from 'oldstable' to ''

Fix it :

sudo sed -i 's|raspbian.raspberrypi.org/raspbian|archive.raspbian.org/raspbian|g' /etc/apt/sources.list sudo sed -i 's/buster/oldstable/g' /etc/apt/sources.list

Verify - do "cat /etc/apt/sources.list" and check that the URL now says archive.raspbian.org/raspbian and oldstable.

pi@R4:~ $ cat /etc/apt/sources.list deb http://archive.raspbian.org/raspbian/ oldstable main contrib non-free rpi

Now

pi@R4:~ $ sudo apt update Hit:1 http://packages.azlux.fr/debian bullseye InRelease Hit:2 http://archive.raspberrypi.org/debian buster InRelease Get:3 http://archive.raspbian.org/raspbian oldstable InRelease [15.0 kB] Get:4 http://archive.raspbian.org/raspbian oldstable/main armhf Packages [14.5 MB] Get:5 http://archive.raspbian.org/raspbian oldstable/contrib armhf Packages [62.3 kB] Get:6 http://archive.raspbian.org/raspbian oldstable/non-free armhf Packages [118 kB] Get:7 http://archive.raspbian.org/raspbian oldstable/rpi armhf Packages [1,360 B] Fetched 14.7 MB in 9s (1,698 kB/s) Reading package lists... Done Building dependency tree Reading state information... Done 1650 packages can be upgraded. Run 'apt list --upgradable' to see them. pi@R4:~ $ sudo apt upgrade

Raspberry 4 MTV

20200503 : amason, 120 €, tech details

MTV email at tinet, espai web (sense la "i" ?)

deures per en MTV amb la Raspberry 4

feina en engegar el R4

Fem servir un servei del tipus "systemd" :

  1. la definicio del perfil del servei s'ha de ubicar al directori /home/<usuari>/.config/systemd/user/ i s'ha de dir <nom servei>.service :

    ~$ vi /home/miquel/.config/systemd/user/r4_start.service [Unit] Description=Servei de engegada del R4 (v 1.a) Wants=network-online.target After=network-online.target [Service] Type=simple Restart=no WorkingDirectory=/home/miquel/eines ExecStart=/home/miquel/eines/r4_start_job.sh StandardOutput=syslog StandardError=syslog SyslogIdentifier=r4_start # User=miquel --- "user" services require this sentence not to be present --- Environment=NODE_ENV=production [Install] WantedBy=default.target

    Aquesta definicio te molts parametres - veure documentacio service i unit , man pages

  2. el codi que fa la "feina" s'ha definit a la sentencia ExecStart - editem /home/miquel/eines/r4_start_job.sh

    ~$ vi /home/miquel/eines/r4_start_job.sh #!/bin/sh date >> /home/miquel/logs/engegades.log exit 0

  3. aquest log ha de existir :

    ~$ touch /home/miquel/logs/engegades.log

  4. el servei s'activa aixi :

    ~pi@raspberrypi:~ $ systemctl --user enable r4_start.service Created symlink /home/pi/.config/systemd/user/default.target.wants/r4_start.service → /home/pi/.config/systemd/user/r4_start.service.

  5. el servei s'ha de llistar aixi

    ~$ systemctl --user cat r4_start.service

  6. provem de engegar-lo a veure si no te cap problema (normalment de permisos) :

    ~$ sudo systemctl start r4_start

  7. si tenim algun problema, tenim 2 eines complementaries :

    ~$ sudo systemctl status r4_start ~$ sudo journalctl -xe

Ara, cada cop que s'engegui la maquina, tindrem una linia dins eixe fitxer de log - /home/miquel/logs/engegades.log

Una "feina" mes sofisticada pot ser :

~$ cat /home/miquel/eines/r4_start_job.sh #!/bin/bash myLog="/home/miquel/logs/engegades.log" date_name=`date +"Y%y/M%m/D%d"` time_name=`date +"h%H:m%M"` szTs="[$HOSTNAME] $date_name - $time_name" szId="+++ +++ +++ ($szTs) ($0) from /home/miquel/eines/r4_start.sh" # timestamp system start at own log file echo "$szId" >> $myLog # trace in /var/log/syslog logger -i -p user.info $szId exit 0
1-er projecte de'n Miquel : control del ventilador del R4

Descripció : volem mesurar la temperatura del TC74 o de la CPU cada 10 o 15 segons. Amb aquest valor aturarem o engegarem el ventilador conectat a un pin GPIO.

Com que la majoria del temps el programa estarà inactiu, no fem un servei "systemd" sino que el manegarem via crontab.
Això té com a mínim un inconvenient sobre la opció de "sleep()" dins el python - el codi no te "memoria" del que ha passat abans, a menys que ho posem en un fitxer.

Farem servir nomes python, vist que sabem llegir del TC74 i de la CPU i també manegar pins del GPIO.

Codi que ja tenim :

(a) feina del manegador del ventilador del R4

~$ cat /home/miquel/python/ventilador/feina.py #!/usr/bin/env python # 0 - ficar una entrada al log # 1 - llegir la temperatura # 2 - decidir que fer amb el ventilador # el log es defineix al crontab (/home/miquel/logs/ventilador.log) import datetime import platform # doc import sys # print( "Python version", sys.version ) print( 'Pyhton version', platform.python_version() ) # (0) trassa now = datetime.datetime.now() szInici = now.strftime("%Y-%m-%d %H:%M:%S") print( '*** ' + szInici + ' *** anem a llegir la temparatura al TC74 *** ' ) # (1) # (2) sys.exit()
(b) crontab del manegador del ventilador del R4

Si volem que s'executi el programa python cada 15 minuts, codifiquem

~$ cat /home/miquel/python/ventilador/cron_ventilador.txt ########################################################## # minute (0-59), # # | hora (0-23), # # | | dia del mes (1-31), # # | | | mes (1-12), # # | | | | dia de la semana (1-7 donde 1=Lunes) # # | | | | | comandos # ########################################################## */15 * * * * /home/miquel/python/ventilador/feina.py >> /home/miquel/logs/ventilador.log 2>&1

... i ho posem en funcionament amb la comanda :

~$ crontab -u sebas cron_ventilador.txt

Finalment comprovem que ha engegat be amb :

~$ crontab -l
la xarxa d'en Miquel

.-----------------------. | | 8000 -> R0:22 9000 -> R0:900 | router Movistar | 8004 -> R4:22 9004 -> R4:904 | 192.168.1.1 | | DHCP server [33.199] |---. | | | .-----------------------. | | | .--------------------------. | | | | | R4-9 | .----. eth0 | | | 192.168.1.219/24 (fixe) | | | | | .--------------------------. | | .--------------------------. | | | | | PI-0-Eli | .----. wlan0 | | | 192.168.1.220/24 (fixe) | | | | | .--------------------------. | | .--------------------------. | | | | | T410 Ubuntu | .----. wlan0 | | | 192.168.1.210/24 (fixe) | | | | | .--------------------------. | | .--------------------------. | | | | | Air-Elisenda | .----. wlan0 | | | 192.168.1.40/24 (DHCP) | | | | | .--------------------------. | | .-------------------------. | | | | | R4-1 (per reparar) | .----. eth0 | | | 192.168.1.70/24 (fixe) | | | | | .-------------------------. | | .--- ( ARRIS, 192.168.200 ) | |
Periferics d'en MTV

Comencem (20200615) amb un TC74 i despres ja veurem ...

Altres :


Comandament per veu

Amazon Alexa, Apple Siri, Google Assistant,

Em mola dir-li una cançó i que me la posi. Pero no la vull de Spotify, sino del meu disc de 2 TB. Aixo em porta a un "comandament per veu" mes generic, propi.

Que jo li digui una comanda, ell la entengui, i engegui una tasca que jo pugui programar.

Llegeixo :

Si os gusta automatizar tareas en casa, podéis probar a hacerlo con Home Assistant, un software para automatizar tareas que permite integrar Alexa, el asistente de Google o HomeKit.
Alexa es la que mejor funciona con este software, pero también es posible usar los otros.
Para usarlo, es necesario comprar una Raspberry Pi 3 Model B+, que es la que hace de centralita.

adslzone.net

Picovoice/porcupine

On-device wake word detection powered by deep learning : github


Links


Ep ! Valid HTML 4.01!   Valid CSS! Escriu-me !
Updated 20201031 (a)  
Uf !