SAG & R4
Specs : url
- Broadcom BCM2711, Quad core Cortex-A72 (ARM v8) 64-bit SoC @ 1.5GHz - compte : Raspbian es de 32 bits
- 2 GB, 4 GB or 8 GB LPDDR4-3200 SDRAM
- 2x USB 3.0 ports; 2x USB 2.0 ports
- 1x Gigabit Ethernet
- 2.4 GHz and 5.0 GHz IEEE 802.11ac wireless
- Bluetooth 5.0, BLE
- 2 × micro-HDMI ports
Us 202102 : Home Assistant
NOOBS, 2020
Lets make it run :
- download NOOBS NOOBS_v3_5_1.zip onto MARS & Ubuntu
- expand into a directory, lets say "noobs_35"
- get rpi-imager
- download Raspberry Pi Imager for Ubuntu : imager_1.5_amd64.deb
- on Ubuntu, double click on the "*.deb" file to install rpi-imager
- format SD as FAT32, using rpi-imager
- 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 :
- sudo apt update
- sudo apt full-upgrade ; url
- tenim "Raspbian 10, buster"
Raspbian, 2021
Tenim una micro SDHC "SanDisk Ultra" de 32 GB, clase 10, categoria A1
- 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
- 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
- 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
- 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)
- 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
- 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
- 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' ...
- make it super-user :
pi@raspberrypi:/home $ sudo adduser sebas sudo
Adding user `sebas' to group `sudo' ...
Adding user sebas to group sudo
Done.
- 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
- 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
- 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)
- 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
- 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 :
- power-on, from r4_start.service
- at 02:06 every morning, from cron_sebas.txt
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
- get 2022-01-28-raspios-bullseye-arm64.zip here
- expand it to 2022-01-28-raspios-bullseye-armhf.img
- {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.
- {MARS} Pi imager v1.5 ... writing
- 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
- botem la nova SD :
---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(172,2) ]---
- 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
- 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.
- **Raspberry Pi 4 Model B:** display must be connected to HDMI port closest to power jack.
- boot problems :
edit /boot/config.txt to include
hdmi_force_hotplug=1
14 solutions,
6 more
- 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
- 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
- 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 -
- get 3.3.0 : 07.2020 -> nicolau@mars:~/sebas/rspi/op_sys/2022_3.5/noobs_3.5
- format SD using rpi-imager
- copy from MARS to SD pointing "INSTRUCTIONS-README.txt" at the root directory of SD card
- modificar "/boot/config.txt" per contenir "enable_uart=1"
- al MARS, engegar "minicom -b 115200 -D /dev/ttyUSB0"
- power-on the R4 : mostra 2 SO's i demana quin instalar -> Raspbian
- 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"
- 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
- backup at yandex
- backup at proton
- 32 GB SD card
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 :
- go to www.raspberrypi.com/software/ ->
/operating-systems/ -> 2026-10-06-raspios-trixie-arm64.img.xz
Kernel version 6.18, Debian version 13 (trixie)
- on Mint, start (Pi) "Imager"
- 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
- "Choose device" := Pi4 ;
- "Choose OS" := Raspberry Pi OS (64 bit)
- "Choose storage" := Generic Mass Storage (IO64GBnew) - 64 GB, mounted as "/media/sebas/IO64GBnew"
- "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"
- 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
- see your network interfaces and connection names:
nmcli connection show
Name Type Device
REDWIFI_RGQC_5G wifi wlan0
- 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
- apply the changes
sudo nmcli connection down REDWIFI_RGQC_5G
sudo nmcli connection up "<Connection Name>"
- verify Pi is now actively using the new static IP address :
hostname -I
192.168.1.200
remote access
enable SSH
- sudo raspi-config
- "3 = Interface options"
- "I1" = SSH
- "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
- hostname -I
- 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 :
- ~/.bash_aliases
- /etc/environment
- /etc/motd
- /usr/local/bin/motd
- /home/pi/.config/systemd/user/r4_start.service and /home/pi/eines/r4_start.sh
pi@pi4:~/logs $ touch 1_r4_start.log + pi@pi4:~/logs $ touch last_boot_time.log + pi@pi4:~/logs $ touch engegades.log
/home/pi/python/telegram/msg_a_tg.sh + client.py + retry_msg_a_tg.sh
d’oct. 13 20:01:54 pi4 systemd[1156]: Starting r4_start.service - Raspberry 4 startup code - /home/pi/.config/systemd/user/r4_start.service - (v1.q)...
d’oct. 13 20:01:56 pi4 systemd[1156]: Started r4_start.service - Raspberry 4 startup code - /home/pi/.config/systemd/user/r4_start.service - (v1.q).
- /home/pi/.config/systemd/user/r4_bot.service and /home/pi/python/telegram/telepot/3_alby_bot.py and /home/pi/python/telegram/telepot/my_bot.conf
ModuleNotFoundError: No module named 'tinytuya'
pi@pi4:~/python/telegram/telepot $ python3 -m pip install pytuya
error: externally-managed-environment
× This environment is externally managed
pi@pi4:~/python/telegram/telepot $ python3 -m venv venv # create a virtual environment named 'venv'
pi@pi4:~/python/telegram/telepot $ source venv/bin/activate # activate the virtual environment
(venv) pi@pi4:~/python/telegram/telepot $ pip install tinytuya
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting tinytuya
Downloading https://www.piwheels.org/simple/tinytuya/tinytuya-1.20.0-py3-none-any.whl.metadata (61 kB)
Installing collected packages: urllib3, pycparser, idna, colorama, charset_normalizer, certifi, requests, cffi, cryptography, tinytuya
Successfully installed certifi-2026.7.22 cffi-2.1.1 cryptography-50.0.2 idna-3.20 pycparser-3.11 requests-2.34.2 tinytuya-1.20.0 urllib3-2.8.0
Now the sevice must be :
pi@pi4:~/.config/systemd/user $ cat r4_bot.service
WorkingDirectory=/home/pi/python/telegram/telepot
ExecStart=/home/pi/python/telegram/telepot/venv/bin/python3 /home/pi/python/telegram/telepot/3_alby_bot.py
Restart=always
Install telepot (in venv)
(venv) pi@pi4:~/python/telegram/telepot/venv $ pip install telepot
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting telepot
Downloading https://www.piwheels.org/simple/telepot/telepot-12.7-py3-none-any.whl.metadata (959 bytes)
Display installed packages (under venv) :
(venv) pi@pi4:~/python/telegram/telepot/venv $ pip list
Package Version
------------------ ---------
cryptography 50.0.2
pip 25.1.1
requests 2.34.2
telepot 12.7
tinytuya 1.20.0
urllib3 2.8.0
yarl 1.25.1
(venv) pi@pi4:~/python/telegram/telepot/venv $
Start it :
systemctl --user daemon-reload
systemctl --user status r4_bot.service
systemctl --user enable r4_bot.service
(venv) pi@pi4:~/python/telegram/telepot/venv $ systemctl --user status r4_bot.service
● r4_bot.service - Raspberry 4 bot code - /home/pi/.config/systemd/user/r4_bot.service - (v 1.e)
Loaded: loaded (/home/pi/.config/systemd/user/r4_bot.service; enabled; preset: enabled)
Active: active (running) since Tue 2026-10-13 20:26:06 CEST; 2min 48s ago
Invocation: 8ccbe27ee15540689a75aabc7fba2fad
Main PID: 2983 (python3)
Tasks: 4 (limit: 3967)
CPU: 653ms
CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/r4_bot.service
└─2983 /home/pi/python/telegram/telepot/venv/bin/python3 /home/pi/python/telegram/telepot/3_alby_bot.py
d’oct. 13 20:26:06 pi4 systemd[1156]: r4_bot.service: Scheduled restart job, restart counter is at 23.
d’oct. 13 20:26:06 pi4 systemd[1156]: Started r4_bot.service - Raspberry 4 bot code - /home/pi/.config/systemd/user/r4_bot.service - (v 1.e).
See /home/pi/logs/r4_bot.log !
- ajustem /etc/hosts
pi@pi4:~ $ cat /etc/hosts
127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 pi4
# IPs fixes :
192.168.1.229 fronius
192.168.1.123 r3 odin
192.168.1.200 r4 me
192.168.1.222 r0 pi0
- instalem Mutt i posem configuracio
pi@pi4:~ $ sudo apt update
Tots els paquets estan actualitzats.
pi@pi4:~ $ sudo apt install mutt
pi@pi4:~ $ sudo mv Muttrc /etc/.
- ~/crontab.htm {*** feinada ***}
- /home/pi/eines/1_netejar.sh
- /home/pi/python/tinet/enviar_html_a_tinet.py
- /home/pi/duckdns/duck.sh
- /home/pi/python/telegram/msg_a_tg.sh
- /home/pi/python/fronius/1_llegir_energia.py
pip3 install google + pip3 install --upgrade google-api-python-client
python3 -m venv venv # Create a virtual environment inside your project folder
source venv/bin/activate # Activate the virtual environment
(venv) pi@pi4:~/python/fronius $ pip install google
Successfully installed beautifulsoup4-4.15.0 google-3.0.0 soupsieve-3.0.3 typing-extensions-4.16.0
(venv) pi@pi4:~/python/fronius $
(venv) pi@pi4:~/python/fronius $ pip install requests
Successfully installed certifi-2026.7.22 charset_normalizer-3.5.2 idna-3.20 requests-2.34.2 urllib3-2.8.0
(venv) pi@pi4:~/python/fronius $ pip install --upgrade google-api-python-client
Successfully installed cryptography-50.0.2 google-api-core-2.42.0 google-api-python-client-2.201.0 google-auth-2.62.0 uritemplate-4.2.0
deactivate # when done
at crontab :
55 22 * * * cd /home/pi/python/fronius && /home/pi/python/fronius/venv/bin/python3 ./1_llegir_energia.py 1>> ./energia.log 2>> ./problemes.log
- /home/pi/python/telegram/telepot/3_alby_bot.py
pi@pi4:~/python/telegram/telepot $ source venv/bin/activate
(venv) pi@pi4:~/python/telegram/telepot $ python -m pip install --upgrade pip
Successfully installed pip-26.2.1
(venv) pi@pi4:~/python/telegram/telepot $ python -m pip install gpiozero
Successfully installed colorzero-2.0 gpiozero-2.0.1.post3 setuptools-84.0.0
Engega des pi@pi4:~/.config/systemd/user/r4_bot.service
/home/pi/python/telegram/telepot/venv/bin/python3 /home/pi/python/telegram/telepot/3_alby_bot.py
- /home/pi/.config/systemd/user/fronius_poll.service -> /home/pi/eines/fronius_poll.sh -> /home/pi/python/pkw/bin/pkw_cli.py read_and_store
pi@pi4:~ $ systemctl --user enable fronius_poll.service
pi@pi4:~ $ systemctl --user start fronius_poll.service
pi@pi4:~ $ systemctl --user status fronius_poll.service
pi@pi4:~ $ cat ./logs/4_fronius_poll.log
>>> +++ (Y26/M10/D14 - h20:m04:s22) start reading Fronius every 5 sec
- /home/pi/eines/backup/fer_backup.sh -> ~/logs/fer_backup.log
pi@pi4:~/eines/backup $ cat ~/logs/fer_backup.log
./fer_backup.sh: línia 140: rclone: no s'ha trobat l'ordre
Instalem rclone :
pi@pi4:~ $ sudo -v ; curl https://rclone.org/install.sh | sudo bash
[sudo] contrasenya per a pi:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 4734 100 4734 0 0 12783 0 --:--:-- --:--:-- --:--:-- 12794
Archive: rclone-current-linux-arm64.zip
creating: tmp_unzip_dir_for_rclone/rclone-v1.75.2-linux-arm64/
inflating: tmp_unzip_dir_for_rclone/rclone-v1.75.2-linux-arm64/README.html [text]
rclone v1.75.2 has successfully installed.
Now run "rclone config" for setup. Check https://rclone.org/docs/ for more details.
copy config file "/home/pi/.config/rclone/rclone.conf"
pi@pi4:~ $ rclone ls bkup: -vv
245760 bkup/r4pic_R4_20261012_tar.jpg
*** revisar la llista de fitxers ***
- */5 * * * * /home/pi/python/pkw/bin/pkw_cli.py graph_4
pkw_cli.py tenia
#!/usr/bin/python2
passem a
#!/usr/bin/python3
pi@pi4:~/python/pkw/bin $ sudo apt install python3-rrdtool
error de format del fitxer RRD
pi@pi4:~/python/pkw/bin $ /home/pi/python/pkw/bin/pkw_cli.py graph_4
{2026/10/15 17:05:41} >>> generate 4+1 graphs ...
>>> file pkw_1-60m.png...
Traceback (most recent call last):
File "/home/pi/python/pkw/bin/pkw_cli.py", line 135, in <module>
pkw_pkg.pkw_graph.fer_png_2_valors ( rrd_filename,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
os.path.join ( graphs_path, graph['filename'] ),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...<2 lines>...
szID,
^^^^^
elapsed_secs = graph['elapsed'] )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pi/python/pkw/bin/pkw_pkg/pkw_graph.py", line 18, in fer_png_2_valors
rrdtool.graph ( png_filename,
~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
'--imgformat', 'PNG',
^^^^^^^^^^^^^^^^^^^^^
...<12 lines>...
'AREA:Pprod#ff6600:Potencia produida',
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
'LINE1:Pcons#0000ff:Potencia consumida')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
rrdtool.OperationalError: opening '/home/pi/python/pkw/dades/pkw.rrd': No such file or directory
pi@pi4:~ $ ls -al /home/pi/python/pkw/dades/pkw.rrd
147832 -rw-rw-r-- 1 pi pi 151373980 14 d’oct. 18:26 /home/pi/python/pkw/dades/pkw.rrd
pi@pi4:~/python/pkw/bin $ mv /home/pi/python/pkw/dades/pkw.rrd /home/pi/python/pkw/dades/pkw_corrupte.rrd
pi@pi4:~/python/pkw/bin $ ./pkw_cli.py initialize
{2026/10/15 17:07:27} >>> initializing ...
>>> Initializing RRD database: /home/pi/python/pkw/dades/pkw.rrd
{
"filename": "/home/pi/python/pkw/dades/pkw.rrd",
"rrd_version": "0003",
"step": 5,
"last_update": 1791472047,
"header_size": 1208,
"ds[Pprod].index": 0,
"ds[Pprod].type": "GAUGE",
"ds[Pprod].minimal_heartbeat": 10,
"ds[Pprod].last_ds": "U",
"ds[Pprod].value": null,
"ds[Pprod].unknown_sec": 2,
"ds[Pcons].index": 1,
"ds[Pcons].type": "GAUGE",
"ds[Pcons].minimal_heartbeat": 10,
"ds[Pcons].last_ds": "U",
"ds[Pcons].value": null,
"ds[Pcons].unknown_sec": 2,
"ds[Pdiff].index": 2,
"ds[Pdiff].type": "GAUGE",
"ds[Pdiff].minimal_heartbeat": 10,
"ds[Pdiff].last_ds": "U",
"ds[Pdiff].value": null,
"ds[Pdiff].unknown_sec": 2,
"rra[0].cf": "MAX",
"rra[0].rows": 6307200,
"rra[0].cur_row": 2928527,
"rra[0].pdp_per_row": 1,
"rra[0].cdp_prep[0].value": null,
"rra[0].cdp_prep[0].unknown_datapoints": 0,
"rra[0].cdp_prep[1].value": null,
"rra[0].cdp_prep[1].unknown_datapoints": 0,
"rra[0].cdp_prep[2].value": null,
"rra[0].cdp_prep[2].unknown_datapoints": 0
}
pi@pi4:~/python/pkw/bin $ /home/pi/python/pkw/bin/pkw_cli.py graph_4
{2026/10/15 17:08:23} >>> generate 4+1 graphs ...
>>> file pkw_1-60m.png...
>>> file pkw_2-8h.png...
>>> file pkw_3-24h.png...
>>> file pkw_4-7days.png...
{2026/10/15 17:08:23} >>> generate BEH ...
Tambe falla pi@pi4:~/eines/fronius_poll.sh -> /home/pi/python/pkw/logs/pkw_read.log
Solucio : fix pi@pi4:~/python/pkw/bin/pkw_pkg/pkw_reader.py per python3
Abans
import urllib # python2
try:
szDades = urllib.urlopen( my_url ).read().decode(encoding='UTF-8').strip()
print( "Type dades (%s)." % type(szDades) )
objjson = json.loads( szDades ) #
Despres
import urllib.request # python3
try:
with urllib.request.urlopen( my_url, timeout=10 ) as url:
objjson = json.loads( url.read().decode() )
- /home/pi/python/pkw/eines/veure_potencia_instant/4_veure_potencia_instant_i_esciure_a_fitxer.py
resultat : pi@pi4:~/python/pkw/dades/potencies/csv/pot_CSV_2026_10_15.csv
- /home/pi/python/plug_amb_power_meter/1_llegir_potencia.py
pi@pi4:~ $ /home/pi/python/plug_amb_power_meter/1_llegir_potencia.py
Traceback (most recent call last):
File "/home/pi/python/plug_amb_power_meter/1_llegir_potencia.py", line 30, in <module>
import tinytuya # sudo pip3 install pytuya ; python3 -m pip install tinytuya
^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'tinytuya'
pi@pi4:~/python/plug_amb_power_meter $ python3 -m venv venv # create a virtual environment named 'venv'
pi@pi4:~/python/plug_amb_power_meter $ source venv/bin/activate # activate the virtual environment
$ (venv) pi@pi4:~/python/plug_amb_power_meter $ pip install tinytuya
Successfully installed certifi-2026.7.22 requests-2.34.2 tinytuya-1.20.0 urllib3-2.8.0
(venv) pi@pi4:~/python/plug_amb_power_meter $
now the call from crontab must be
/home/pi/python/plug_amb_power_meter/venv/bin/python3 /home/pi/python/plug_amb_power_meter/1_llegir_potencia.py
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
- add hdmi_force_hotplug=1 to /boot/config.txt
You will have to reboot to make that effective (this applies to anything in config.txt).
The display should work now if you plug it in after boot.
However, the resolution may not be set as correctly as it is when booted with the screen attached.
- try tvservice --explicit="DMT 35 HDMI"
This powers on HDMI explicitly with "DMT mode 35" which is 60 HZ at 1280x1024 pixels.
There is also tvservice --off if you've got enough.
For more information try both tvservice --help and looking
tabular listing HDMI modes
pi@R4:~ $ tvservice --help
Usage: tvservice [OPTION]...
-p, --preferred Power on HDMI with preferred settings
-e, --explicit="GROUP MODE DRIVE" Power on HDMI with explicit GROUP (CEA, DMT, CEA_3D_SBS, CEA_3D_TB, CEA_3D_FP, CEA_3D_FS)
MODE (see --modes) and DRIVE (HDMI, DVI)
-t, --ntsc Use NTSC frequency for HDMI mode (e.g. 59.94Hz rather than 60Hz)
-c, --sdtvon="MODE ASPECT [P]" Power on SDTV with MODE (PAL or NTSC) and ASPECT (4:3 14:9 or 16:9) Add P for progressive
-o, --off Power off the display
-m, --modes=GROUP Get supported modes for GROUP (CEA, DMT)
-M, --monitor Monitor HDMI events
-s, --status Get HDMI status
-a, --audio Get supported audio information
-d, --dumpedid <filename> Dump EDID information to file
-j, --json Use JSON format for --modes output
-n, --name Print the device ID from EDID
-l, --list List all attached devices
-v, --device Specify the device to use (see --list)
-h, --help Print this information
Malauradament, no funciona (blank screen) :
pi@R4:~ $ tvservice --explicit="DMT 35 HDMI"
Powering on HDMI with explicit settings (DMT mode 35)
pi@R4:~ $ tvservice -s
state 0x12000a [HDMI DMT (35) RGB full 5:4], 1280x1024 @ 60.00Hz, progressive
pi@R4:~ $ tvservice -l
0 attached device(s), display ID's are :
Interesting command :
pi@R4:~ $ sudo vcdbg log msg
Also modetest
// gcc -o drm-gbm drm-gbm-mod.c -ldrm -lgbm -lEGL -lGL -I/usr/include/libdrm
DRM is sitting on top of the firmware modesetting.
(forums raspberry)
tvservice is an alternate way into the same subsystem.
Using tvservice will cause grief with DRM as DRM has no idea that things have changed - it believes it is master and no one else can change things.
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