| Size: 2264 Comment:  | Size: 17169 Comment:  | 
| Deletions are marked like this. | Additions are marked like this. | 
| Line 2: | Line 2: | 
| <<TableOfContents(2)>> | |
| Line 5: | Line 7: | 
| * Raspberry Pi 3 Model B Plus Rev 1.3 | |
| Line 33: | Line 36: | 
| * https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/print | |
| Line 57: | Line 61: | 
| {{{ $ lsb_release -a No LSB modules are available. Distributor ID: Raspbian Description: Raspbian GNU/Linux 9.4 (stretch) Release: 9.4 Codename: stretch $ uname -a Linux raspberrypi 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux | {{{#!highlight sh lsb_release -a # No LSB modules are available. # Distributor ID: Raspbian # Description: Raspbian GNU/Linux 9.4 (stretch) # Release: 9.4 # Codename: stretch uname -a # Linux raspberrypi 4.14.71-v7+ #1145 SMP Fri Sep 21 15:38:35 BST 2018 armv7l GNU/Linux | 
| Line 70: | Line 74: | 
| * apt-get install eclipse-platform | {{{#!highlight sh apt-get install eclipse-platform }}} | 
| Line 75: | Line 81: | 
| * python drive_gpio26.py | {{{#!highlight sh python drive_gpio26.py }}} | 
| Line 89: | Line 97: | 
| == Install python 3.8.5 in raspberry py == {{{#!highlight bash tar xvzf Python-3.8.5.tgz cd Python-3.8.5/ ./configure make clean make make install sudo make install /usr/local/bin/python3.8 -v /usr/local/bin/pip3.8 install cherrypy pip3.8 install jinja2 }}} == Enable X11 forwarding == {{{#!highlight bash # Raspberry pi side sudo nano /etc/ssh/sshd_config # add line X11Forwarding yes service ssh restart # client side ssh -X -Y userx@192.168.2.3 echo $DISPLAY leafpad & # text editor pcmanfm & # file explorer }}} == Blink led service == Starts automatically after boot. === /home/pi/Documents/drive_gpio26.py === {{{#!highlight python from gpiozero import LED from time import sleep import os f = open('/tmp/drive_gpio26.pid','wb') f.write(str(os.getpid())) f.close() led = LED(26) while True: led.on() sleep(1) led.off() sleep(1) }}} === /etc/init.d/drive_gpio26 === {{{#!highlight bash #! /bin/sh ### BEGIN INIT INFO # Provides: drive_gpio26 # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: Blinks a led # Description: Blinks a led ### END INIT INFO touch /var/lock/drive_gpio26 # Carry out specific functions when asked to by the system case "$1" in start) echo "Starting script drive_gpio26 " su pi -c "nohup /usr/bin/python /home/pi/Documents/drive_gpio26.py >> /tmp/drive_gpio26.log 2>&1 &" ;; stop) echo "Stopping script drive_gpio26" kill $(cat /tmp/drive_gpio26.pid) ;; *) echo "Usage: /etc/init.d/drive_gpio26 {start|stop}" exit 1 ;; esac exit 0 }}} {{{#!highlight bash update-rc.d drive_gpio26 defaults # insert links in /etc/rc*d update-rc.d drive_gpio26 defaults 20 80 update-rc.d drive_gpio26 enable service drive_gpio26 status reboot }}} == Install MariaDB raspbian == {{{#!highlight bash sudo bash apt install mariadb-server mysql_secure_installation # define root pass mysql GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY '????????' WITH GRANT OPTION; FLUSH PRIVILEGES; create database testdb; show databases; use testdb CREATE TABLE locations ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, lat VARCHAR(30) NOT NULL, lon VARCHAR(30) NOT NULL); exit mysql -u admin -p sudo pip3.8 install mysql-connector-python # python 3.8 import mysql.connector mysql.connector.connect(host='localhost',database='testdb',user='admin',password='xxxxxxxx') }}} === test_mariadb.py === {{{#!highlight python import mysql.connector conn = mysql.connector.connect( host='localhost', database='testdb', user='admin', password='xxxxxxxx' ) cursor=conn.cursor() cursor.execute("Insert into locations (lat,lon) values(%s,%s)" , ("aaa","bbb") ) conn.commit() print(cursor.rowcount, "record inserted.") }}} == Install Squid Web Proxy == {{{#!highlight bash sudo bash apt update apt install squid cd /etc/squid/ cp squid.conf squid.conf.ORIG cat squid.conf.ORIG | egrep -v -e '^[[:blank:]]*#|^$' > squid.conf nano squid.conf acl localnet src 192.168.111.0/24 http_access allow Localnet # comment http_access deny all service squid reload #firefox manual proxy #IP rpi: 192.168.111.222 Port: 3128 #also for ftp and https }}} == Raspberry Pi Pico == * https://www.raspberrypi.com/documentation/microcontrollers/raspberry-pi-pico.html#technical-specification * https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf * https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf * https://mauser.pt/catalog/product_info.php?cPath=1667_2620_1672&products_id=095-0598 * https://mauser.pt/catalog/product_info.php?cPath=1667_2620_1672&products_id=095-0596 Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces. === Connect with micro-usb === {{{#!highlight sh sudo dmesg # [ 3570.065996] usb 1-4.3: Product: RP2 Boot # [ 3570.066006] usb 1-4.3: Manufacturer: Raspberry Pi # [ 3570.066016] usb 1-4.3: SerialNumber: E0C9xxxxxxxx # [ 3570.163372] usb-storage 1-4.3:1.0: USB Mass Storage device detected # [ 3570.164049] scsi host2: usb-storage 1-4.3:1.0 # [ 3570.164381] usbcore: registered new interface driver usb-storage # [ 3570.180142] usbcore: registered new interface driver uas # [ 3571.192940] scsi 2:0:0:0: Direct-Access RPI RP2 3 PQ: 0 ANSI: 2 # [ 3571.194468] sd 2:0:0:0: Attached scsi generic sg1 type 0 # [ 3571.195164] sd 2:0:0:0: [sdb] 262144 512-byte logical blocks: (134 MB/128 MiB) # [ 3571.195818] sd 2:0:0:0: [sdb] Write Protect is off # [ 3571.195830] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00 # [ 3571.196325] sd 2:0:0:0: [sdb] No Caching mode page found # [ 3571.196335] sd 2:0:0:0: [sdb] Assuming drive cache: write through # [ 3571.217448] sdb: sdb1 # [ 3571.237585] sd 2:0:0:0: [sdb] Attached SCSI removable disk }}} == Update apt source == Set for '''/etc/apt/sources.list''' and '''/etc/apt/sources.list.d/raspi.list''' {{{ deb http://legacy.raspbian.org/raspbian/ stretch main contrib non-free rpi }}} == Swap 512 MB == {{{#!highlight sh sudo bash nano /etc/dphys-swapfile # CONF_SWAPSIZE=512 dphys-swapfile swapoff dphys-swapfile setup dphys-swapfile swapon }}} == Swap 2048 MB == {{{#!highlight sh sudo bash nano /etc/dphys-swapfile # CONF_SWAPSIZE=2048 dphys-swapfile swapoff dphys-swapfile setup dphys-swapfile swapon }}} == /etc/rc.local in Raspbian to init ttyACM0 == {{{#!highlight sh #!/bin/sh -e /usr/bin/logger "Initialize port ttyACMO for raspberry pico" chmod 666 /dev/ttyACM0 stty -F /dev/ttyACM0 raw speed 115200 -crtscts cs8 -parenb -cstopb exit 0 }}} = raspberry pi 2 model b = Download SD image from [[https://downloads.raspberrypi.com/raspios_lite_armhf/images/raspios_lite_armhf-2025-05-13/2025-05-13-raspios-bookworm-armhf-lite.img.xz | raspios-bookworm-armhf-lite.img.xz ]]. raspberry pi os lite , compatible with all raspberries. * Release date: May 13th 2025 * System: 32-bit * Kernel version: 6.12 * Debian version: 12 (bookworm) * Size: 493MB. * SHA256 file integrity hash:a73d68b618c3ca40190c1aa04005a4dafcf32bc861c36c0d1fc6ddc48a370b6e {{{#!highlight sh cd ~/Downloads sha256sum 2025-05-13-raspios-bookworm-armhf-lite.img.xz a73d68b618c3ca40190c1aa04005a4dafcf32bc861c36c0d1fc6ddc48a370b6e 2025-05-13-raspios-bookworm-armhf-lite.img.xz xz -t 2025-05-13-raspios-bookworm-armhf-lite.img.xz xz -d 2025-05-13-raspios-bookworm-armhf-lite.img.xz # connect pen card reader cr100 mitsai # https://www.worten.pt/produtos/leitor-de-cartoes-mitsai-cr100-6261364 dmesg # with micro sd inserted in the USB card reader # [ 5479.890546] usb 1-1: USB disconnect, device number 4 # [ 5575.775242] usb 1-1: new high-speed USB device number 5 using xhci_hcd # [ 5575.924611] usb 1-1: New USB device found, idVendor=14cd, idProduct=125d, bcdDevice= 1.00 # [ 5575.924649] usb 1-1: New USB device strings: Mfr=1, Product=3, SerialNumber=2 # [ 5575.924668] usb 1-1: Product: Mass Storage Device # [ 5575.924681] usb 1-1: Manufacturer: Generic # [ 5575.924692] usb 1-1: SerialNumber: 125D20140310 # [ 5575.927741] usb-storage 1-1:1.0: USB Mass Storage device detected # [ 5575.929376] scsi host2: usb-storage 1-1:1.0 # [ 5576.951389] scsi 2:0:0:0: Direct-Access Mass Storage Device PQ: 0 ANSI: 0 CCS # [ 5576.951954] sd 2:0:0:0: Attached scsi generic sg1 type 0 # [ 5576.953584] sd 2:0:0:0: [sdb] 30547968 512-byte logical blocks: (15.6 GB/14.6 GiB) # [ 5576.953746] sd 2:0:0:0: [sdb] Write Protect is off # [ 5576.953752] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00 # [ 5576.953903] sd 2:0:0:0: [sdb] No Caching mode page found # [ 5576.953908] sd 2:0:0:0: [sdb] Assuming drive cache: write through # [ 5576.965688] sdb: sdb1 sdb2 # [ 5576.966073] sd 2:0:0:0: [sdb] Attached SCSI removable disk # prepare SD disk and partitoons cfdisk /dev/sdb # Device Start End Sectors Size Type # /dev/sdb1 2048 34815 32768 16M unknown # /dev/sdb2 34816 30547934 30513119 14.5G unknown # partitions android meta e android expand # https://www.raspberrypi.com/documentation/computers/getting-started.html#installing-the-operating-system # https://www.nixcraft.com/t/how-to-write-rasbian-os-raspios-img-file-using-dd-to-sd-card-on-linux/3709/2 # Use the dd command: sudo dd if=2025-05-13-raspios-bookworm-armhf-lite.img of=/dev/sdb bs=4M conv=fsync # While the image is being written the LED of cr100 blinks # 610+0 records in # 610+0 records out # 2558525440 bytes (2.6 GB, 2.4 GiB) copied, 442.663 s, 5.8 MB/s # Device Boot Start End Sectors Size Id Type # Free space 2048 16383 14336 7M # /dev/sdb1 16384 1064959 1048576 512M c W95 FAT32 (LBA) # /dev/sdb2 1064960 4997119 3932160 1.9G 83 Linux # Free space 4997120 30547967 25550848 12.2G mount /dev/sdb2 /mnt/ ls /mnt/ # bin dev home lost+found mnt proc run srv tmp var # boot etc lib media opt root sbin sys usr cat /mnt/etc/os-release # PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)" # NAME="Raspbian GNU/Linux" # VERSION_ID="12" # VERSION="12 (bookworm)" # VERSION_CODENAME=bookworm # ID=raspbian # ID_LIKE=debian # HOME_URL="http://www.raspbian.org/" # SUPPORT_URL="http://www.raspbian.org/RaspbianForums" # BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs" umount /mnt }}} Inserted the micro SD card in the back fo the raspberry pi 2 board, connected HDMI, keyboard and mouse. After turning on the power it started to boot and show the linux kernel log while booting. Selected keyboard, other, Portuguese, Portuguese, new user vitor, set pwd. Got a console prompt. Connected Ethernet cable to the tp-link router. {{{#!highlight sh ping -c 3 www.google.com sudo bash apt update apt upgrade apt full-upgrade apt autoremove rpi2b.intra.bitarus.org 192.168.1.7 rpi2b.bitarus.mooo.com 192.168.1.7 named-checkconf /etc/bind/named.conf named-checkzone xyz.com /etc/bind/xyz.com.hosts named-checkzone zyx.org /etc/bind/zyz.org.hosts sudo service named restart raspinfo > /tmp/out.txt # Raspberry Pi 2 Model B Rev 1.1 # PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)" sudo apt install inxi nmap rsyslog autossh inxi # CPU: quad core ARMv7 v7l (-MCP-) speed/min/max: 900/600/900 MHz # Kernel: 6.12.25+rpt-rpi-v7 armv7l Up: 14m Mem: 212.2/997.1 MiB (21.3%) # Storage: 14.57 GiB (15.6% used) Procs: 138 Shell: Bash inxi: 3.3.26 }}} == issues ext4 fs error == * EXT4-fs error Cannot read block bitmap Journal has aborted * Failed to convert unwritten extents {{{ Message from syslogd@pi2b at Oct 16 10:45:14 ... kernel:[ 4370.623756] EXT4-fs (mmcblk0p2): failed to convert unwritten extents to written extents -- potential data loss! (inode 2992, error -5) Message from syslogd@pi2b at Oct 16 10:45:14 ... kernel:[ 4370.651065] EXT4-fs (mmcblk0p2): failed to convert unwritten extents to written extents -- potential data loss! (inode 131094, error -5) }}} https://manpages.debian.org/stretch/systemd/systemd-fsck@.service.8.en.html * fsck.repair=yes * fsck.mode=force /boot/firmware/cmdline.txt {{{ console=serial0,115200 console=tty1 root=PARTUUID=59fb7884-02 rootfstype=ext4 fsck.repair=yes rootwait fsck.mode=force }}} In debian elitedesk using pen card reader cr100 mitsai {{{#!highlight sh # it uses /dev/sdb partitions /dev/sdb1 and /dev/sb2 fsck -fvy /dev/sdb1 fsck -fvy /dev/sdb2 fsck -vck /dev/sdb2 fsck -vcck /dev/sdb2 # read write non destructive }}} If fails again try: * sudo dd of=pi2b_backup.img if=/dev/sdb bs=4M conv=fsync * then try to write it again to /dev/sdb to check if it is successful * sudo dd if=pi2b_backup.img of=/dev/sdb bs=4M conv=fsync {{{#!highlight sh badblocks -sw /dev/sdb2 Testing with pattern 0xaa: done Reading and comparing: done Testing with pattern 0x55: done Reading and comparing: done Testing with pattern 0xff: done Reading and comparing: done Testing with pattern 0x00: done Reading and comparing: done }}} No badblocks detected. Will try FreeBSD 14.3 == FreeBSD 14.3 armv7 == Installed [[https://download.freebsd.org/ftp/releases/arm/armv7/ISO-IMAGES/14.3/FreeBSD-14.3-RELEASE-arm-armv7-GENERICSD.img.xz|FreeBSD 14.3 armv7]] {{{#!highlight sh cd ~/Downloads unxz FreeBSD-14.3-RELEASE-arm-armv7-GENERICSD.img.xz sudo dd if=FreeBSD-14.3-RELEASE-arm-armv7-GENERICSD.img of=/dev/sdb conv=sync bs=1M vi /etc/rc.conf # keymap="pt.iso.acc.kbd" # syslogd_enable="YES" # echo "*.info /var/log/syslog" >> /etc/syslog.conf # hostname="rpi2b" # ntpd_enable="YES" # ntpdate_enable="YES" ifconfig ping -c 3 hostx # user root pass root root:root kbdmap adduser # userx pw user mod userx -G wheel # allow su - # A pre-built version of pkg could not be found for your system SSL_NO_VERIFY_PEER=1 pkg update SSL_NO_VERIFY_PEER=1 pkg install sudo SSL_NO_VERIFY_PEER=1 pkg install nano su - export SSL_NO_VERIFY_PEER=1 # Now run your command pkg upgrade pkg install ca_root_nss pkg search autossh # autossh-1.4g_1 Automatically restart SSH sessions and tunnels SSL_NO_VERIFY_PEER=1 pkg install autossh htop SSL_NO_VERIFY_PEER=1 pkg install openjdk11 python3 java -version python3 -V uname -a # FreeBSD generic 14.3-RELEASE FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC arm SSL_NO_VERIFY_PEER=1 pkg install curl cp -v /usr/share/zoneinfo/Portugal /etc/localtime SSL_NO_VERIFY_PEER=1 pkg install bash pw user mod userx -s /usr/local/bin/bash ssh freebsd@hostx # password freebsd nohup certctl rehash & ps uax | grep cert certctl list # the list should grow pkg search jdk # should work after a while without SSL_NO_VERIFY_PEER=1 # check filesystem su - fstyp /dev/ufs/rootfs # ufs # https://en.wikipedia.org/wiki/Unix_File_System visudo %wheel ALL=(ALL:ALL) ALL pw group mod wheel -m userx }}} | 
RaspberryPi
Contents
- 
RaspberryPi- BCM2835
- Install and configure screensaver and lock screen
- Info
- Install eclipse
- Blink led port 26
- Install python 3.8.5 in raspberry py
- Enable X11 forwarding
- Blink led service
- Install MariaDB raspbian
- Install Squid Web Proxy
- Raspberry Pi Pico
- Update apt source
- Swap 512 MB
- Swap 2048 MB
- /etc/rc.local in Raspbian to init ttyACM0
 
- raspberry pi 2 model b
- Kit in https://www.chiptec.net/pcs-e-mobilidade/computadores/raspberrypi/kit-raspberry-pi-3-modelo-b-noobs-caixa-carregador-preto.html (Kit Raspberry Pi 3 Modelo B+(NOOBS+Caixa+Carregador) Preto) 
- Raspberry Pi 3 Model B Plus Rev 1.3
Processador Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz Memória RAM 1GB LPDDR2 SDRAM Armazenamento Cartão MicroSD 32GB com NOOBS Wi-Fi e Bluetooth 2.4GHz e 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2, BLE LAN Gigabit Ethernet em USB 2.0 (saída máxima 300 Mbps) Expansão Extended 40-pin GPIO header CSI camera port DSI display port 4-pole stereo output e composite video port Portas HDMI USB 2.0 (4) Micro-SD Alimentação Entrada 5V/2.5A DC Prazo de Garantia 2 Anos
- Access GPIO https://elinux.org/RPi_GPIO_Code_Samples#C 
- https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up 
- https://projects.raspberrypi.org/en/projects/raspberry-pi-setting-up/print 
BCM2835
- Timers
- Interrupt controller
- GPIO
- USB
- PCM / I2S
- DMA controller
- I2C master
- I2C / SPI slave
- SPI0, SPI1, SPI2
- PWM
- UART0, UART1
Install and configure screensaver and lock screen
- sudo apt-get install xscreensaver
- Preferences, Screen saver
- Auto lock after 2 minutes
- Create new menu item (Preferences, Main menu editor) - Menu item name Lock
- Command: xscreensaver-comand -lock
- Icon: /usr/share/lxpanel/images/ns-lock.png
 
Info
Install eclipse
   1 apt-get install eclipse-platform
Blink led port 26
   1 python drive_gpio26.py
Install python 3.8.5 in raspberry py
Enable X11 forwarding
Blink led service
Starts automatically after boot.
/home/pi/Documents/drive_gpio26.py
/etc/init.d/drive_gpio26
   1 #! /bin/sh
   2 ### BEGIN INIT INFO
   3 # Provides:          drive_gpio26
   4 # Default-Start:     2 3 4 5
   5 # Default-Stop:
   6 # Short-Description: Blinks a led
   7 # Description:       Blinks a led
   8 ### END INIT INFO
   9 touch /var/lock/drive_gpio26
  10 # Carry out specific functions when asked to by the system
  11 case "$1" in
  12   start)
  13     echo "Starting script drive_gpio26 "
  14     su pi -c "nohup /usr/bin/python /home/pi/Documents/drive_gpio26.py >> /tmp/drive_gpio26.log 2>&1  &"
  15     ;;
  16   stop)
  17     echo "Stopping script drive_gpio26"
  18     kill $(cat  /tmp/drive_gpio26.pid)
  19     ;;
  20   *)
  21     echo "Usage: /etc/init.d/drive_gpio26 {start|stop}"
  22     exit 1
  23     ;;
  24 esac
  25 
  26 exit 0
Install MariaDB raspbian
   1 sudo bash
   2 apt install mariadb-server
   3 mysql_secure_installation
   4 # define root pass
   5 mysql
   6 GRANT ALL ON *.* TO 'admin'@'localhost' IDENTIFIED BY '????????' WITH GRANT OPTION;
   7 FLUSH PRIVILEGES;
   8 create database testdb;
   9 show databases;
  10 use testdb
  11 CREATE TABLE locations ( id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, lat VARCHAR(30) NOT NULL, lon VARCHAR(30) NOT NULL);
  12 exit
  13 mysql -u admin -p
  14 sudo pip3.8 install mysql-connector-python
  15 #
  16 python 3.8
  17 import mysql.connector
  18 mysql.connector.connect(host='localhost',database='testdb',user='admin',password='xxxxxxxx')
test_mariadb.py
   1 import mysql.connector
   2 conn = mysql.connector.connect(
   3   host='localhost',
   4   database='testdb',
   5   user='admin',
   6   password='xxxxxxxx'
   7 )
   8 cursor=conn.cursor()
   9 cursor.execute("Insert into locations (lat,lon) values(%s,%s)" , ("aaa","bbb") )
  10 conn.commit()
  11 print(cursor.rowcount, "record inserted.")
Install Squid Web Proxy
   1 sudo bash 
   2 apt update 
   3 apt install squid
   4 cd /etc/squid/
   5 cp squid.conf squid.conf.ORIG
   6 cat squid.conf.ORIG | egrep -v -e '^[[:blank:]]*#|^$' > squid.conf
   7 nano squid.conf 
   8 acl localnet src 192.168.111.0/24
   9 http_access allow Localnet 
  10 # comment http_access deny all 
  11 service squid reload
  12 #firefox manual proxy 
  13 #IP rpi: 192.168.111.222   Port: 3128
  14 #also for ftp and https
  15 
Raspberry Pi Pico
- https://datasheets.raspberrypi.com/picow/pico-w-datasheet.pdf 
- https://datasheets.raspberrypi.com/pico/getting-started-with-pico.pdf 
- https://mauser.pt/catalog/product_info.php?cPath=1667_2620_1672&products_id=095-0598 
- https://mauser.pt/catalog/product_info.php?cPath=1667_2620_1672&products_id=095-0596 
Raspberry Pi Pico is a low-cost, high-performance microcontroller board with flexible digital interfaces.
Connect with micro-usb
   1 sudo dmesg
   2 # [ 3570.065996] usb 1-4.3: Product: RP2 Boot
   3 # [ 3570.066006] usb 1-4.3: Manufacturer: Raspberry Pi
   4 # [ 3570.066016] usb 1-4.3: SerialNumber: E0C9xxxxxxxx
   5 # [ 3570.163372] usb-storage 1-4.3:1.0: USB Mass Storage device detected
   6 # [ 3570.164049] scsi host2: usb-storage 1-4.3:1.0
   7 # [ 3570.164381] usbcore: registered new interface driver usb-storage
   8 # [ 3570.180142] usbcore: registered new interface driver uas
   9 # [ 3571.192940] scsi 2:0:0:0: Direct-Access     RPI      RP2              3    PQ: 0 ANSI: 2
  10 # [ 3571.194468] sd 2:0:0:0: Attached scsi generic sg1 type 0
  11 # [ 3571.195164] sd 2:0:0:0: [sdb] 262144 512-byte logical blocks: (134 MB/128 MiB)
  12 # [ 3571.195818] sd 2:0:0:0: [sdb] Write Protect is off
  13 # [ 3571.195830] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
  14 # [ 3571.196325] sd 2:0:0:0: [sdb] No Caching mode page found
  15 # [ 3571.196335] sd 2:0:0:0: [sdb] Assuming drive cache: write through
  16 # [ 3571.217448]  sdb: sdb1
  17 # [ 3571.237585] sd 2:0:0:0: [sdb] Attached SCSI removable disk
  18 
Update apt source
Set for /etc/apt/sources.list and /etc/apt/sources.list.d/raspi.list
deb http://legacy.raspbian.org/raspbian/ stretch main contrib non-free rpi
Swap 512 MB
Swap 2048 MB
/etc/rc.local in Raspbian to init ttyACM0
raspberry pi 2 model b
Download SD image from raspios-bookworm-armhf-lite.img.xz.
raspberry pi os lite , compatible with all raspberries.
- Release date: May 13th 2025
- System: 32-bit
- Kernel version: 6.12
- Debian version: 12 (bookworm)
- Size: 493MB.
- SHA256 file integrity hash:a73d68b618c3ca40190c1aa04005a4dafcf32bc861c36c0d1fc6ddc48a370b6e
   1 cd ~/Downloads
   2 sha256sum 2025-05-13-raspios-bookworm-armhf-lite.img.xz 
   3 a73d68b618c3ca40190c1aa04005a4dafcf32bc861c36c0d1fc6ddc48a370b6e  2025-05-13-raspios-bookworm-armhf-lite.img.xz
   4 xz -t 2025-05-13-raspios-bookworm-armhf-lite.img.xz
   5 xz -d 2025-05-13-raspios-bookworm-armhf-lite.img.xz
   6 
   7 # connect pen card reader cr100 mitsai
   8 # https://www.worten.pt/produtos/leitor-de-cartoes-mitsai-cr100-6261364
   9 dmesg 
  10 # with micro sd inserted in the USB card reader
  11 # [ 5479.890546] usb 1-1: USB disconnect, device number 4
  12 # [ 5575.775242] usb 1-1: new high-speed USB device number 5 using xhci_hcd
  13 # [ 5575.924611] usb 1-1: New USB device found, idVendor=14cd, idProduct=125d, bcdDevice= 1.00
  14 # [ 5575.924649] usb 1-1: New USB device strings: Mfr=1, Product=3, SerialNumber=2
  15 # [ 5575.924668] usb 1-1: Product: Mass Storage Device
  16 # [ 5575.924681] usb 1-1: Manufacturer: Generic
  17 # [ 5575.924692] usb 1-1: SerialNumber: 125D20140310
  18 # [ 5575.927741] usb-storage 1-1:1.0: USB Mass Storage device detected
  19 # [ 5575.929376] scsi host2: usb-storage 1-1:1.0
  20 # [ 5576.951389] scsi 2:0:0:0: Direct-Access     Mass     Storage Device        PQ: 0 ANSI: 0 CCS
  21 # [ 5576.951954] sd 2:0:0:0: Attached scsi generic sg1 type 0
  22 # [ 5576.953584] sd 2:0:0:0: [sdb] 30547968 512-byte logical blocks: (15.6 GB/14.6 GiB)
  23 # [ 5576.953746] sd 2:0:0:0: [sdb] Write Protect is off
  24 # [ 5576.953752] sd 2:0:0:0: [sdb] Mode Sense: 03 00 00 00
  25 # [ 5576.953903] sd 2:0:0:0: [sdb] No Caching mode page found
  26 # [ 5576.953908] sd 2:0:0:0: [sdb] Assuming drive cache: write through
  27 # [ 5576.965688]  sdb: sdb1 sdb2
  28 # [ 5576.966073] sd 2:0:0:0: [sdb] Attached SCSI removable disk
  29 
  30 # prepare SD disk and partitoons
  31 cfdisk /dev/sdb
  32 #     Device                   Start             End         Sectors         Size Type
  33 # /dev/sdb1                 2048           34815           32768          16M unknown         
  34 # /dev/sdb2                34816        30547934        30513119        14.5G unknown
  35 # partitions android meta e android expand 
  36 
  37 # https://www.raspberrypi.com/documentation/computers/getting-started.html#installing-the-operating-system
  38 # https://www.nixcraft.com/t/how-to-write-rasbian-os-raspios-img-file-using-dd-to-sd-card-on-linux/3709/2
  39 # Use the dd command:
  40 sudo dd if=2025-05-13-raspios-bookworm-armhf-lite.img of=/dev/sdb bs=4M conv=fsync
  41 
  42 # While the image is being written the LED of cr100 blinks
  43 # 610+0 records in
  44 # 610+0 records out
  45 # 2558525440 bytes (2.6 GB, 2.4 GiB) copied, 442.663 s, 5.8 MB/s
  46 #     Device         Boot          Start         End     Sectors     Size    Id Type
  47 # Free space                    2048       16383       14336       7M                         
  48 # /dev/sdb1                    16384     1064959     1048576     512M     c W95 FAT32 (LBA)
  49 # /dev/sdb2                  1064960     4997119     3932160     1.9G    83 Linux
  50 # Free space                 4997120    30547967    25550848    12.2G
  51 
  52 mount /dev/sdb2 /mnt/
  53 ls /mnt/
  54 # bin   dev  home  lost+found  mnt  proc        run   srv  tmp  var
  55 # boot  etc  lib         media       opt  root  sbin  sys  usr
  56 
  57 cat  /mnt/etc/os-release 
  58 # PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)"
  59 # NAME="Raspbian GNU/Linux"
  60 # VERSION_ID="12"
  61 # VERSION="12 (bookworm)"
  62 # VERSION_CODENAME=bookworm
  63 # ID=raspbian
  64 # ID_LIKE=debian
  65 # HOME_URL="http://www.raspbian.org/"
  66 # SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
  67 # BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
  68 umount /mnt 
Inserted the micro SD card in the back fo the raspberry pi 2 board, connected HDMI, keyboard and mouse. After turning on the power it started to boot and show the linux kernel log while booting. Selected keyboard, other, Portuguese, Portuguese, new user vitor, set pwd. Got a console prompt.
Connected Ethernet cable to the tp-link router.
   1 ping -c 3 www.google.com
   2 sudo bash
   3 apt update
   4 apt upgrade
   5 apt full-upgrade
   6 apt autoremove 
   7 rpi2b.intra.bitarus.org 192.168.1.7
   8 rpi2b.bitarus.mooo.com 192.168.1.7
   9 
  10 named-checkconf /etc/bind/named.conf
  11 named-checkzone xyz.com /etc/bind/xyz.com.hosts
  12 named-checkzone zyx.org /etc/bind/zyz.org.hosts 
  13 sudo service named restart 
  14 
  15 raspinfo > /tmp/out.txt
  16 # Raspberry Pi 2 Model B Rev 1.1
  17 # PRETTY_NAME="Raspbian GNU/Linux 12 (bookworm)"
  18 
  19 sudo apt install inxi nmap rsyslog autossh
  20 inxi 
  21 # CPU: quad core ARMv7 v7l (-MCP-) speed/min/max: 900/600/900 MHz
  22 # Kernel: 6.12.25+rpt-rpi-v7 armv7l Up: 14m Mem: 212.2/997.1 MiB (21.3%)
  23 # Storage: 14.57 GiB (15.6% used) Procs: 138 Shell: Bash inxi: 3.3.26
  24 
issues ext4 fs error
- EXT4-fs error Cannot read block bitmap Journal has aborted
- Failed to convert unwritten extents
Message from syslogd@pi2b at Oct 16 10:45:14 ... kernel:[ 4370.623756] EXT4-fs (mmcblk0p2): failed to convert unwritten extents to written extents -- potential data loss! (inode 2992, error -5) Message from syslogd@pi2b at Oct 16 10:45:14 ... kernel:[ 4370.651065] EXT4-fs (mmcblk0p2): failed to convert unwritten extents to written extents -- potential data loss! (inode 131094, error -5)
https://manpages.debian.org/stretch/systemd/systemd-fsck@.service.8.en.html
- fsck.repair=yes
- fsck.mode=force
/boot/firmware/cmdline.txt
console=serial0,115200 console=tty1 root=PARTUUID=59fb7884-02 rootfstype=ext4 fsck.repair=yes rootwait fsck.mode=force
In debian elitedesk using pen card reader cr100 mitsai
If fails again try:
- sudo dd of=pi2b_backup.img if=/dev/sdb bs=4M conv=fsync
- then try to write it again to /dev/sdb to check if it is successful - sudo dd if=pi2b_backup.img of=/dev/sdb bs=4M conv=fsync
 
No badblocks detected. Will try FreeBSD 14.3
FreeBSD 14.3 armv7
Installed FreeBSD 14.3 armv7
   1 cd ~/Downloads
   2 unxz FreeBSD-14.3-RELEASE-arm-armv7-GENERICSD.img.xz
   3 sudo dd if=FreeBSD-14.3-RELEASE-arm-armv7-GENERICSD.img of=/dev/sdb conv=sync bs=1M 
   4 
   5 vi /etc/rc.conf
   6 # keymap="pt.iso.acc.kbd"
   7 # syslogd_enable="YES"
   8 # echo "*.info /var/log/syslog" >> /etc/syslog.conf 
   9 # hostname="rpi2b"
  10 # ntpd_enable="YES"
  11 # ntpdate_enable="YES"
  12 
  13 ifconfig
  14 ping -c 3 hostx
  15 # user root pass root  root:root
  16 kbdmap
  17 adduser 
  18 # userx
  19 
  20 pw user mod userx -G wheel  # allow su - 
  21 # A pre-built version of pkg could not be found for your system 
  22 SSL_NO_VERIFY_PEER=1 pkg update 
  23 SSL_NO_VERIFY_PEER=1 pkg install sudo 
  24 SSL_NO_VERIFY_PEER=1 pkg install nano
  25 su - 
  26 export SSL_NO_VERIFY_PEER=1
  27 # Now run your command
  28 pkg upgrade
  29 pkg install ca_root_nss
  30 pkg search autossh
  31 # autossh-1.4g_1                 Automatically restart SSH sessions and tunnels
  32 SSL_NO_VERIFY_PEER=1 pkg install autossh htop 
  33 SSL_NO_VERIFY_PEER=1 pkg install openjdk11 python3
  34 java -version   
  35 python3 -V
  36 
  37 uname -a
  38 # FreeBSD generic 14.3-RELEASE FreeBSD 14.3-RELEASE releng/14.3-n271432-8c9ce319fef7 GENERIC arm
  39 SSL_NO_VERIFY_PEER=1 pkg install curl
  40 
  41 cp -v /usr/share/zoneinfo/Portugal /etc/localtime
  42 SSL_NO_VERIFY_PEER=1 pkg install bash
  43 pw user mod userx -s /usr/local/bin/bash
  44 ssh freebsd@hostx # password freebsd 
  45 
  46 nohup certctl rehash &
  47 ps uax | grep cert
  48 certctl list # the list should grow
  49 pkg search jdk # should work after a while without SSL_NO_VERIFY_PEER=1
  50 # check filesystem
  51 su - 
  52 fstyp /dev/ufs/rootfs 
  53 # ufs
  54 # https://en.wikipedia.org/wiki/Unix_File_System
  55 visudo 
  56 %wheel ALL=(ALL:ALL) ALL
  57 
  58 pw group mod wheel -m userx
