Difference between pages "Bering-uClibc 7.1.x - Changelog" and "Bering-uClibc 7.x - User Guide - Advanced Topics - Setting Up a Raspberry PI as a net to serial gateway"

From bering-uClibc
(Difference between pages)
Jump to: navigation, search
(Changes between 7.1.3 and 7.1.3-rc1)
 
(minor fixes)
 
Line 1: Line 1:
 
{| summary="Navigation header" width="100%"
 
{| summary="Navigation header" width="100%"
! colspan="3" align="center" | [[Bering-uClibc 7.0.x - Changelog|Changelog]]
+
! colspan="3" align="center" | [[Bering-uClibc 7.x - User Guide - Advanced Topics - Setting Up a Raspberry PI as a net to serial gateway | Setting Up a Raspberry PI as a net to serial gateway]]
 
|-
 
|-
| width="20%" align="left"  |
+
| width="20%" align="left"  | [[Bering-uClibc 7.x - User Guide - Advanced Topics - Setting Up SSH password-less login and Port Knocking|Prev]]
! width="60%" align="center" | [[Bering-uClibc 7.x|Bering-uClibc 7.x - Overview]]
+
! width="60%" align="center" | [[Bering-uClibc 7.x - User Guide]]
| width="20%" align="right"  |
+
| width="20%" align="right"  | [[Bering-uClibc 7.x - User Guide - Advanced Topics - Unpacking a gpg signed lrp package|Next]]
 
|}
 
|}
 +
----
  
==Changes between 7.1.3 and 7.1.3-rc2==
 
(unreleased)
 
  
;uclibc-ng: updated to upstream version 1.0.41
+
==Goal==
:with fix for https://nvd.nist.gov/vuln/detail/CVE-2022-30295
+
;axel: updated to upstream version 2.17.11
+
;curl: updated to upstream version 7.83.0
+
;libmd: updated to upstream version 1.0.4
+
;net-snmp: fix dependency for libpcre in netsnmpd package
+
;openssl: updated to upstream version 1.1.1o
+
;tor: updated to upstream version 0.4.7.7
+
;wireguard: renamed from wireguard_tools
+
  
----
 
  
==Changes between 7.1.3-rc1 and 7.1.2==
+
This setup shows how to use the LEAF tarball distribution for the raspberry PI, to access the serial communication port of a distant PC Engines APU2C2 using a simple SSH session. To access the serial port, we will first SSH to the Raspberry PI and then run a communication program like minicom or picocom.
(released 24 Apr 2022)
+
  
;kernel: updated to upstream version 5.10.110
+
This setup can be generalized to make any "device serial communication port" accessible through an SSH network session. Knowing that RS-232C communication distances are short, why not use a wired network instead that can reach a lot farther.  
;bind: updated to upstream version 9.16.27
+
;curl: updated to upstream version 7.82.0
+
;dbus: updated to upstream version 1.12.22
+
;dhcpd: updated to upstream version 4.4.3
+
;dropbear: updated to upstream version 2022.82
+
;ethtool: updated to pstream version 5.17
+
;expat: updated to upstream version 2.4.8
+
;fail2ban: updated to upsream version 0.11.2
+
;freeradius: updated to upstream version 3.0.25
+
;hostapd: updated to upstream version 2.10
+
;krb5: updated to upstream version 1.19.3
+
;libbsd: updated to upstream version 0.11.6
+
;libell: updated to upstream version 0.49
+
;libuv: updated to upstream version 1.44.1
+
;libxml2: updated to upstream version 2.9.13
+
;libxslt: updated to upstream version 1.1.35
+
;mdadm: updated to upstream version 4.2
+
;monit: updated to upstream version 5.32.0
+
;nano: updated to upstream version 6.2
+
;netatalk: updated to upstream version 3.1.13
+
;openssh: updated to upstream version 9.0p1
+
;openssl: updated to upstream version 1.1.1n
+
;openvpn: updated to upstream version 2.5.6
+
;patch: updated to upstream version 2.7.9
+
;pciutils: updated to upstream version 3.8.0 (incl a fresh pci.ids tarball)
+
;perl: updated to upstream version 5.34.1
+
;python: updated to upstream version 3.10.2
+
;rsync: updated to upstream version 3.2.4
+
;rsyslog: updated to upstream version 8.2202.0
+
;smartmontools: updated to upstream version 7.3
+
;strace: updated to upstream version 5.17
+
;strongswan: updated to upstream version 5.9.5
+
;sqlite: updated to upstream version 3.38.2
+
;squid: updated to upstream version 5.4.1
+
;unbound: updated to upstream version 1.15.0
+
;vnstat: updated to upstream version 2.9
+
;webpy: updated to upstream version 0.62
+
;wget: updated to upstream version 1.21.3
+
;wpa-supplicant: updated to upstream version 2.10
+
;zlib: updated to upstream version 1.2.12
+
  
==Changes between 7.1.2 and 7.1.2-rc1==
+
All of this was initially done using the standard Raspberry PI Raspbian OS distribution, but using the LEAF distribution OS instead, really transforms the somewhat flaky PI into a very stable and dependable production platform, since everything will then run in rams and no writings to the SD card will ever occur once in operation... It is a well known fact that, it is only a matter of time for the Raspberry PI to corrupt it's SD card, thus making it fail to boot or run. This is mainly caused by random power fails occurring at the same time the PI is writing to the SD card (further readings: https://hackaday.com/2016/08/03/single-board-revolution-preventing-flash-memory-corruption/).
(released 19 Feb 2022)
+
  
;kernel: updated to upstream version 5.10.95
+
==You will need==
;at: updated to upstream version 3.2.4
+
;expat: updated to upstream version 2.4.4
+
;iperf3: updated to upstream version 3.11
+
;stunnel: updated to upstream version 5.62
+
;tor: updated to upstream verson 0.4.6.10
+
  
==Changes between 7.1.2-rc1 and 7.1.1==
 
(released 29 Jan 2022)
 
  
;uClibc-ng: updated to upstream version 1.0.40
+
#- one of the raspberry PIs: zero (I doubt it), zero_w, 1, 2, 3, 4 with matching power supply
;kernel: updated to upstream version 5.10.92
+
#- either:  
;axel: updated to upstream version 2.17.10
+
##rs232c to USB cable
;bash: updated to upstream version 5.1.16
+
##one db9 female to female null modem
;busybox: updated to upstream version 1.35.0
+
###[[File:Rpi2_net_serial_gateway.jpg]]
;curl: updated to upstream version 7.81.0
+
#- or more simply:
;ethtool: updated to upstream version 5.15
+
##rs232c to 3.3 volts ttl converter, MAX3232 chip is best !
;expat: updated to upstream version 2.4.3  
+
##some jumper cables
;file: updated to upstream version 5.41
+
###[[File:Rs232_ttl_rpi2_APU2C2.jpg]]
;haveged: updated to upstream version 1.9.17
+
#- or the minimalist but cute PI Zero W
;iperf: updated to upstream version 2.1.6
+
##same converter, but with a Raspberry PI Zero W
;iw: updated to upstream version 5.16
+
##jumper cables
;jimtcl: updated to upstream version 0.81
+
###[[File:PIzero_rs232.jpg]]
;knockd: updated to upstream version 0.8
+
##you will need to setup the WIFI connection...
;libell: updated to upstream version 0.46
+
;libmicrohttpd: updated to upstream version 0.9.75
+
;lighttpd: updated to upstream version 1.4.64
+
;lshw: updated to upstream version B.02.19.2
+
;nano: updated to upstream version 6.0
+
;ncurses: updated to upstream version 6.3
+
;nfs-utils: updated to upstream version 2.6.1
+
;ntp: fix requirement for libmd when loading ntpd
+
;openldap: updated to upstream version 2.6.0
+
;openssl: updated to upstream version 1.1.1m
+
;openvpn: updated to upstream version 2.5.5
+
;pcre2: updated to upstream version 10.39
+
;pmacctd: updated to upstream version 1.7.7
+
;privoxy: updated to upstream version 3.0.33
+
;rsyslog: updated to upstream version 8.2112.0
+
;rtty: updated to upstream version 8.0.0
+
;snort: updated to upstream version 2.9.19
+
;sqlite: updated to upstream version 3.37.2
+
;squid: updated to upstream version 5.3
+
;strace: updated to upstream version 5.15
+
;tor: updated to upstream version 0.4.6.9
+
;unbound: updated to upstream version 1.14.0
+
;xl2tpd: updated to upstream version 1.3.17
+
  
;New packages:
+
==Setting up the SD==
;libcdada: basic data structures in C (libstdc++ wrapper), required by pmacctd
+
;hwloc: Portable Hardware Locality, required by snort3
+
;xxhash: xxHash is an extremely fast hash algorithm
+
  
==Changes between 7.1.1 and 7.1.1-rc1==
+
Prepare your SD card according to the [https://bering-uclibc.zetam.org/wiki/Bering-uClibc_7.x_-_User_Guide_-_Advanced_Topics_-_Setting_Up_a_Raspberry_PI#Raspberry_PIs_installation_of_tarballs_images previously] given instructions...
(released 4 Dec 2021)
+
  
;kernel: updated to upstream version 5.10.76
+
Access your PI and do the following ajustments:  
:reenable ath_regdomain_parameter.patch
+
;ca-certificates: updated to 20211016
+
;libuv: updated to upstream version 1.42.0
+
;lighttpd: updated to upstream version 1.4.61
+
:disable HTPP/2 in lighttpd-ssl.conf
+
;nano: updated to upstream version 5.9
+
;squid: updated to upstream version 4.17
+
;tor: updated to upstream version 0.4.6.8
+
;vnstat: updated to upstream version 2.8
+
  
==Changes between 7.1.1-rc1 and 7.1.0==
+
mount /dev/mmcblk0p1 /mnt
(released 10 Oct 2021)
+
cd /mnt
  
;general: uclibc-ng updated to upstream version 1.0.39
+
# find leaf.cfg file and in LRP="...
;kernel: updated to upstream version 5.10.64
+
## remove shorwall and dnsmasq; ... It is important to remove "shorewall" here, it's job is to block everything and "dnsmasq" is not needed !
:fix 5GHZ WIFI support on ath10k
+
## add local, picocom or minicom
;bash: updated to upstream version 5.1.8
+
## you should now have something like: LRP="license root nano local dhcpcd keyboard dropbear lighttpd webconf picocom patch"##
;bind: updated to upstream version 9.16.20
+
#Run:
;busybox: updated to upstream version 1.34.1
+
##lrcfg > 3) Packages configuration > 6) dropbear > 1) dropbear configuration
;clamav: updated to upstream version 1.103.3
+
##''change line'' #DB_OPTIONS=" -s " ''to'' DB_OPTIONS=" -B "
;curl: updated to upstream version 7.79.1
+
##''this will allow a first root login with no password''
;dnsmasq: updated to upstream version 2.86
+
;e2fsprogs: updated to upstream version 1.46.4
+
;igb: updated to upstream version 5.7.2
+
;ixgbe: updated to upstream version 5.12.5
+
;iperf: updated to upstream version 2.1.4
+
;iperf3: updated to upstream version 3.10.1
+
;ipset: updated to upstream version 7.15
+
;krb5: updated to upstream version 1.18.4
+
;libarchive: updated to upstream version 3.5.2
+
;libcares: updated to upstream version 1.17.2
+
;libell: updated to upstream version 0.43
+
;libssh2: updated to upstream version 1.10.0
+
;monit: updated to upstream version 5.29.0
+
;nano: updated to upstream version 5.8
+
;protobuf: updated to upstream version 3.17.3
+
;tor: updated to upstream version 0.4.6.7
+
;unbound: updated to upstream version 1.13.2
+
;vsftpd: updated to upstream version 3.0.5
+
;wireless-regdb: updated to 2021.08.28
+
  
;New packages:
+
#And save everything with:
;firmware-ath10k: Add firmware for the ath10 wifi cards
+
##lrcfg > s) Save configuration > Enough freespace? (y/N) y
  
;Removed packages:
+
==Booting the Raspberry PI==
;e1000e: removed external driver and added e1000e support in kernel, since it will be no longer supported outside the kernel
+
  
==Changes between 7.1.0 and 7.1.0-rc1==
+
#- Reboot your PI
(released 20 Aug 2021)
+
#- After ~ 30 seconds, find out what the PI's Ip address is, and ssh in it: ssh root@raspberry_pi_IP_address. On Android, the apps "fing" or "WIFIman" from Ubiquiti might help you ...
 +
#- Set the new passwords for the OS and webconf, as you will be asked.
 +
#- Open webconf from a browser http://raspberry_pi_IP_address to try it out
 +
#- While you're there, it would be a good idea to comment-out the non-existing eth1 in /etc/network/interfaces, look in Networking...
 +
#- A good time also, if you prefer, to do a "ssh-copy-id" to write your PC public ssh keys in /.ssh/authorized_keys (see https://bering-uclibc.zetam.org/wiki/Bering-uClibc_6.x_-_User_Guide_-_Advanced_Topics_-_Setting_Up_SSH_password-less_login_and_Port_Knocking )
  
;upgrade: remove fetch_lwp  - there no extra lwp files any more
+
==Using the gateway==
;iproute: updated to upsream version 5.10.0
+
;openssh: add libmd as requirement when loading the package
+
  
==Changes between 7.1.0-rc1 and 7.1.0-beta1==
+
#If you are using the older and cumbersome '''RS-232C to USB cable + Null modem''' you are good to go:
(released 31 Jul 2021)
+
##- connect the RS-232C to USB cable with the null modem between your PI and your device serial port
 +
##- on your external PC, open an ssh session to the PI
 +
##- within your ssh session, start picocom on the PI: ''picocom -b115200 '''/dev/ttyUSB0'''''
 +
##- hit return:... you should have the prompt to login in your router or whatever !
 +
##- exit picocom with Cntl-a Cntl-x, help is Cntl-a Cntl-h
 +
#If you are using the simpler '''RS-232C to 3.3 volts ttl converter''' you first need to deactivate a couple of things...
 +
##- deactivate the console ttyAMA0 by commenting it out in /etc/inittab
 +
##- in /mnt/cmdline.txt remove '''console=ttyAMA0,115200 kgdboc=ttyAMA0,115200'''
 +
##- lrcfg > s) save, reboot
 +
##- connect the '''"RS-232C to 3.3 volts ttl converter"''' to your PI 3.3v'''(pin1)''' to ttl-VCC, '''TX(14) to ttl-TX, RX(15) to ttl-RX''' and ground(pin6) to ttl-GND, and plug the converter in your device serial port
 +
##- on your external PC, open an ssh session to the PI
 +
##- start picocom: ''picocom -b115200 '''/dev/ttyAMA0'''''
 +
##- hit return:... you should have the prompt to login in your router or whatever !
 +
##- exit picocom with Cntl-a Cntl-x, help is Cntl-a Cntl-h
 +
#Lastly, using the PI Zero W... detailed explanations for the WIFI are available [[Bering-uClibc_7.x_-_User_Guide_-_Advanced_Topics_-_Setting_Up_a_Wireless_Internet_Connection|here]]
 +
##- deactivate the console ttyAMA0 by commenting it out in /etc/inittab
 +
##- in /mnt/cmdline.txt remove '''console=ttyAMA0,115200 kgdboc=ttyAMA0,115200'''
 +
##- in /mnt/leaf.cfg add the following lrp modules to LRP=" ...iw.lrp, wireless.lrp, wpasupp.lrp..."
 +
##- lrcfg > s) save, reboot
 +
##- in /etc/default/wpasupplicant set ENABLE=1 and INTERFACE="wlan0"
 +
##- in /etc/wpa_supplicant.conf set ssid="your_ssid" and psk="your_psk"
 +
##- in /etc/network/interfaces add at the end:
 +
            auto wlan0
 +
            iface wlan0 inet dhcp
 +
            wpa_supplicant_control 1
  
;kernel: updated to upstream version 5.10.52
+
        6.-lrcfg > s) save, reboot
;bird: fix building bird on armv6zk toolchain (aka Raspberry 0,1,2)
+
;clamav: updated to upstream version 0.103.2
+
;dhcpcd: disable the patch to change home of resolv.conf
+
;libell: updated to upstream version 0.41
+
;nano: updated to upstream version 5.7
+
;nettle: updated to upstream version 3.7.3
+
;net-snmp: updated to upstream version 5.9.1
+
;ntp: updated to upstream version 4.2.8p15
+
;openldap: updated to upstream version 2.4.59
+
;openvpn: updated to upstream version 2.5.3
+
;pcre: updated to upstream version 8.45
+
;pcre2: updated to upstream version 10.37
+
;perl: updated to upstream version 5.3.4
+
;python: updated to upstream version 3.9.6
+
;sqlite: updated to upstream version 3.36.0
+
;squid: updated to upstream version 4.15
+
;sysstat: updated to upstream version 12.5.4
+
;tinyproxy: updated to upstream version 1.11.0
+
;tor: updated to upstream version 0.4.6.5
+
;vnstat: updated to upstream version 2.0.7
+
;vsftpd: updated to upstream version 3.0.4
+
;New package:
+
;firmware-realtek: add firmware for Realtek wifi chipsets
+
  
==Changes between 7.1.0-beta1 and 7.1.0-alpha1==
+
After this last reboot, the PI Zero W might still refuse to connect to your WIFI because it complains about missing some firmware or regulatory.db files.
(released 09 Jun 2021)
+
These files are not part of the Distribution yet, but can be copied from the Raspberry PI Zero OS or from [https://github.com/jeanrocco/LEAF/blob/main/PI%20Zero/lib/configdb.lrp here]. If you are tempted by this last case, simply click the ''Download'' button in the web page and configdb.lrp will be copied to your Download directory.
  
; toolchain: uClibc-ng updated to upstream version 1.0.38
+
Let's unpack this configdb.lrp:
:gcc updated to upstream version 9.4.0
+
cd ~/Downloads
;kernel: updated to upstream version 5.10.42
+
sudo mkdir configdb
;bind: updated to upstream version 9.16.15
+
cd configdb
;bird: updated to upstreamn version 2.0.8
+
sudo tar xzvf ../configdb.lrp
;curl: updated to new upstream version 7.77.0
+
;dosfstools: updated to upstream version 4.2
+
;ethtool: updated to upstream version 5.12
+
;expat: updated to upstream version 2.4.1
+
;jimtcl: updated to upstream version 0.80
+
;keepalived: updated to upstream version 2.2.1
+
;libbsd: updated to upstream version 0.11.3
+
;libdata-validate-ip-perl: updated to upstream version 0.30
+
;libnet-netmask-perl: updated to upstream version 2.0001
+
;libnftnl: updated to upstream version 1.2.0
+
;libtirpc: updated to upstream version 1.3.2
+
;lighttpd: updated to upstream version 1.4.59
+
;lua: updated to upstream version 5.4.3
+
;nano: updated to upstream version 5.6.1
+
;nettle: updated to upstream version 3.7.1
+
;nfs-utils: updated to upstream version 2.5.3
+
;openssh: updated to upstream version 8.6p1
+
;openssl: updated to upstream version 1.1.1k
+
;openvpn: updated to upstream version 2.5.1
+
;protobuf: updated to upstream version 3.17.2                                                                                         
+
;protobuf-c: updated to upstream version 1.4.0
+
;python: updated to upstream version 3.9.5
+
:fix building python and python-related packages for Raspberry Pi 0/1/2
+
;rpcbind: updated to upstream version 1.2.6
+
;sqlite: updated to upstream version 3.35.5
+
;strace: updated to upstream version 5.12
+
;sysfsutils: updated to upstream version 2.1.1
+
;unbound: updated to upstream version 1.13.1
+
;xtables-addons: updated to upstream version 3.18
+
  
;New packages:
+
So now all your missing files are in ~/Downloads/configdb/
;firmware-rpi-nonfree: Add firmware for the RPI wifi module
+
;libmd: BSD Message Digest functions
+
  
==Changes between 7.1.0-alpha1 and 7.0.x==
+
There are different ways of copying these files to your PI Zero W, but right now, you are connected to it with only the HDMI display and USB keyboard, and there are no direct way to copy these files... Let's look at some options:
(released 20 Feb 2021)
+
  
;kernel: updated to upstream version 5.10.15
+
* We will use a USB key to transfer the files to your PI Zero W... and I assume you don't have a USB hub; too simple then !
;binutils: updated to upstream version 2.36.1
+
**we have to free the USB port where your keyboard is now attached, and replace it's function with the serial console on /dev/ttyAMA0
;gcc: updated to 9.3.0
+
**Using the console implies you have some soldered pins on gpio 14 and 15, and ground and a USB converter (cheaper than a HUB )
;uClibc-ng: updated to upstream version 1.0.37
+
#re-enable the console on /dev/ttyAMA0 by un-commenting it in /etc/inittab
;accel-ppp: update to latest master; fix building
+
#lrcfg > s) save
;asterisk: updated to upstream version 18.1.0
+
#poweroff the PI and connect a ttl to USB converter from your PI's GPIO pins 14, 15 and ground, to an external PC USB port
;clamav: updated to upstream version 0.103.1
+
#on your external PC, mount a USB key on /mnt
;daq: updated to upstream version 2.0.7
+
#put the missing files on the USB key: sudo cp -r ~/Downloads/configdb/lib/firmware/ /mnt/firmware/
;dmidecode: updated to upstream version 3.3
+
#unplug your USB keyboard from the PI Zero W, and plugin the USB key in it's place
;freeradius: uodated to upstream version 3.0.21
+
#start a picocom session on your PC: picocom -b115200 /dev/ttyUSB0
;gettext: updated to upstream version 0.21
+
#powerup the PI, patiently wait until you get a login prompt... well login !
;igmpproxy: updated to upstream version 0.3
+
#mount the USB key to /mnt and copy the files to /lib/firmware : cp -r /mnt/firmware/* /lib/firmware/
;e2fsprogs: updated to upstream version 1.46.1
+
#disable the console by commenting it out in /etc/inittab
;elfutils: updated to upstream version 0.182
+
#a final lrcfg > s) save before reboot
;ell: updated to upstream version 0.35
+
Phew !!! that's a lot of steps ...
;ethtool: updated to upstream version 5.10
+
;file: updated to upstream version 5.39
+
;igb: updated to version 5.5.2
+
;kismet: updated to upstream version 2020-12-R3
+
;krb5: updated to upstream version 1.18.3
+
;libpcap: updated to upstream version 1.10.0
+
;libcares: updated to upstream version 1.17.1
+
;libgmp: updated to upstream version 6.2.1
+
;libgpg-error: updated to upstream version 1.41
+
;libpam: updated to upstream version 1.5.1
+
;libusb: updated to upstream version 1.0.24
+
;monit: updated to upstream version 5.27.2
+
;mtools: updated to upstream version 4.0.26
+
;nano: updated to upstream version 5.5
+
;net-snmp: updated to upstream version 5.9
+
;nettle: updated to upstream version 3.7
+
;nfs-utils: updated to upstream version 2.5.2
+
;nsd: updated to upstream version 4.3.5
+
;openldap: updated to upstreeam version 2.4.57
+
;openssl: updated to upstream version 1.1.1i
+
;pcre2: updated to upstream version 10.35
+
;perl: updated to upstream version 5.32.1
+
;tcpdump: updated to upstream version 4.99.0
+
;rsync: updated to upstream version 3.2.3
+
;rsyslog: updated to upstream version 8.2012.0
+
;rtl8812au: update driver for kernel 5.10
+
;snort: updated to upstream version 2.9.16.1
+
;squid: updated to upstream version 4.14
+
;stunnel: updated to upstream version 5.57
+
;sqlite: updated to upstream version 3.34.1
+
;unbound: updated to upstream version 1.13.0
+
;util-linux: update to upstream version 2.36.2
+
;wget: updated to upstream version 1.21
+
  
;New Packages:
 
;keyutils: Tools used to control the key management system built into the Linux kernel
 
;protobuf: Protocol Buffers - Google's data interchange format
 
;protobuf-c: C bindings for Google's Protocol Buffers
 
  
;Removed Packages:
+
*We can also use the special file configdb.lrp, no need to solder pins here and no additional hardware is required
;mini_httpd/s: replaced by lighttpd
+
**mount your PI's SD card on your external PC like:  
 +
sudo mount /dev/sdb1 /mnt
 +
cd /mnt
 +
sudo mkdir configdb
 +
cd configdb
 +
sudo tar xzvf ../configdb.lrp
 +
*this unpacks your existing PI's configdb.lrp to /mnt/configdb/
 +
**Now you can copy the missing files to /mnt/configdb/lib/firmware/
 +
sudo cp -r ~/Downloads/configdb/lib/firmware/* /mnt/configdb/lib/firmware/
 +
cd /mnt/configdb ...just in case ...
 +
sudo tar -c * | gzip -9 > configdb.lrp
 +
sudo cp configdb.lrp ../
 +
*and this repacks and replaces your original PI's configdb.lrp, yeap .lrp is just a renamed .tgz !
 +
**Put back the SD card in your PI and reboot and test if you have WIFI connectivity:
 +
ip addr
 +
 
 +
should give you wlan0: ip address... after a few seconds.
 +
 
 +
You just learned how to use configdb.lrp to preset some package parameters directly on your media. This file is special as it does not have to be signed like all the other packages, and if present will be loaded without complaints. The LEAF system generates configdb.lrp after you made changes when hitting lrcfg > s) save. On a fresh distribution it does not exist yet, but you can always create one manually, but thread carefully as it will supersede any existing one, or you can always do what we just did, only copy the changes to the existing one.
 +
 
 +
==Additionnal Raspberry PI Zero W ack==
 +
 
 +
Here is a clean setup for the PI Zero W, everything fits in a 3D printed box, and the wiring to the flashy red hot APU2C2 serial port is a neat flat cable.
 +
 
 +
[[Image:Erich_contraption.jpg|center|frame|alt=Erich's rendering ...|Erich's rendering]]
 +
 
 +
==Correcting some bugs...(only for the PI 1) ==
 +
 
 +
This last section is only for the first generation PI 1 with "LEAF Bering-uClibc 6.1.4 Rev 1 uClibc 1.0.25" distribution. I experienced some issues that needed fixing. With the newer versions these bugs might be gone now, but I didn't check that '''yet''', as there are more important things to do, and besides it works now !!! and I've grown attached to my solutions :-) .
 +
The other PIs 2 and 3, that I own, didn't show these problems.
 +
 
 +
From an already opened ssh session:
 +
*- fix xterm: go to /etc/terminfo/x and "cp xterm xterm-256color" ... # the "lrcfg" menu needs xterm-256color so we make one up in B&W !
 +
 
 +
*- fix reboot: The busybox reboot command does not work, here is a hardware alternative done by connecting GPIO4 to the PI reset pin on P6 pin 1 (the square one). Solder a 2 pin header on P6 (https://i.imgur.com/jR8hmwG.jpg?1) and place a jumper wire between P6 pin 1 and GPIO4 on P1 pin 7 (https://i.imgur.com/R9dx5TH.jpg?1).
 +
 
 +
[[Image:JR8hmwG1.jpg|left|frame|alt=reset jumper|reset jumper]]
 +
[[File:P6_to_gpio4.jpg|center|frame|alt=reset jumper|reset jumper]]
 +
 
 +
 
 +
*- create a new "reboot" command: first, make the script /root/GPIO4reboot.sh and second, change the old reboot command in /sbin...
 +
 
 +
the script /root/GPIO4reboot.sh will set gpio4 to low (0) which will reset the PI, a hard reboot !
 
   
 
   
----  
+
cd /root
 +
nano GPIOreboot.sh
 +
 
 +
fill with this content:
 +
 
 +
#!/bin/sh
 +
#
 +
# reset avec gpio4 connecte sur reset du PI, P6 pin 1 square.
 +
#
 +
echo "4" > /sys/class/gpio/export            # we will talk to gpio4
 +
echo "out" > /sys/class/gpio/gpio4/direction  # gpio4 on boot is an high-z input, but defaults to low (0) as an output
 +
 
 +
don't forget to make the script executable with:
 +
chmod 0755 GPIO4reboot.sh
 +
 
 +
Let's replace the non-working "reboot" command with our own hardware reboot command ...
 +
 
 +
cd /sbin
 +
 +
mv reboot old_reboot              # keep old command in case someone repairs/fixes busybox...
 +
ln -s /root/GPIO4reboot.sh reboot  # the "reboot" command link now points to /root/GPIO4reboot.sh
 +
 
 +
 
 +
 
 +
*- set the local.local: everything we just did which is not part of the LEAF distribution has to be saved in /var/lib/lrpkg/local.local ...
 +
 
 +
lrcfg > 3) Packages configuration > 3) local > 1) list of files that should be saved >
 +
 
 +
fill with this content:
 +
 +
var/lib/lrpkg/local.local
 +
etc/terminfo/x/xterm-256color
 +
root/.ssh/authorized_keys
 +
root/GPIO4reboot.sh
 +
sbin/reboot
 +
sbin/old_reboot
 +
 
 +
'''***and a very important final save:'''
 +
 
 +
lrcfg > s) save configuration
 +
 
 +
==Final thoughts==
 +
 
 +
 
 +
*It would be a good idea to configure eth0 with a static IP address in /etc/network/interface. This would allow a network communication between your workstation and the PI Serial gateway even if your firewall and consequently DHCP server are down.
 +
 
 +
*In the previous case, you might also probably loose WIFI connectivity, so using a PI Zero W might not be as reliable... ymmv !
 +
 
 +
*You can also remove or comment out DB_OPTIONS=" -B " in /etc/default/dropbear, to bring the security level back.
 +
 
 +
 
 +
*Using the PI as a full blown firewall has not been tested here, the feeling is that it would be too slow... volunteers are welcome ...
 +
 
 +
==Have fun==
 +
by: jrb with kapeka's idea to use leaf !
 +
 
 +
----
 
{| summary="Navigation footer" width="100%"
 
{| summary="Navigation footer" width="100%"
| width="40%" align="left"  |
+
| width="40%" align="left"  | [[Bering-uClibc 7.x - User Guide - Advanced Topics - Setting Up SSH password-less login and Port Knocking|Prev]]
| width="20%" align="center" | [[Bering-uClibc 7.x|Up]]
+
| width="20%" align="center" | [[Bering-uClibc 7.x - User Guide|Up]]
| width="40%" align="right"  |
+
| width="40%" align="right"  | [[Bering-uClibc 7.x - User Guide - Advanced Topics - Unpacking a gpg signed lrp package|Next]]
 
|}
 
|}
[[Category:Bering-uClibc_7.x]]
+
 
 +
[[Category:Bering-uClibc 7.x]]
 +
[[Category:User Guide]]

Revision as of 20:49, 26 October 2025

Setting Up a Raspberry PI as a net to serial gateway
Prev Bering-uClibc 7.x - User Guide Next


Goal

This setup shows how to use the LEAF tarball distribution for the raspberry PI, to access the serial communication port of a distant PC Engines APU2C2 using a simple SSH session. To access the serial port, we will first SSH to the Raspberry PI and then run a communication program like minicom or picocom.

This setup can be generalized to make any "device serial communication port" accessible through an SSH network session. Knowing that RS-232C communication distances are short, why not use a wired network instead that can reach a lot farther.

All of this was initially done using the standard Raspberry PI Raspbian OS distribution, but using the LEAF distribution OS instead, really transforms the somewhat flaky PI into a very stable and dependable production platform, since everything will then run in rams and no writings to the SD card will ever occur once in operation... It is a well known fact that, it is only a matter of time for the Raspberry PI to corrupt it's SD card, thus making it fail to boot or run. This is mainly caused by random power fails occurring at the same time the PI is writing to the SD card (further readings: https://hackaday.com/2016/08/03/single-board-revolution-preventing-flash-memory-corruption/).

You will need

  1. - one of the raspberry PIs: zero (I doubt it), zero_w, 1, 2, 3, 4 with matching power supply
  2. - either:
    1. rs232c to USB cable
    2. one db9 female to female null modem
      1. Rpi2 net serial gateway.jpg
  3. - or more simply:
    1. rs232c to 3.3 volts ttl converter, MAX3232 chip is best !
    2. some jumper cables
      1. Rs232 ttl rpi2 APU2C2.jpg
  4. - or the minimalist but cute PI Zero W
    1. same converter, but with a Raspberry PI Zero W
    2. jumper cables
      1. PIzero rs232.jpg
    3. you will need to setup the WIFI connection...

Setting up the SD

Prepare your SD card according to the previously given instructions...

Access your PI and do the following ajustments:

mount /dev/mmcblk0p1 /mnt
cd /mnt
  1. find leaf.cfg file and in LRP="...
    1. remove shorwall and dnsmasq; ... It is important to remove "shorewall" here, it's job is to block everything and "dnsmasq" is not needed !
    2. add local, picocom or minicom
    3. you should now have something like: LRP="license root nano local dhcpcd keyboard dropbear lighttpd webconf picocom patch"##
  2. Run:
    1. lrcfg > 3) Packages configuration > 6) dropbear > 1) dropbear configuration
    2. change line #DB_OPTIONS=" -s " to DB_OPTIONS=" -B "
    3. this will allow a first root login with no password
  1. And save everything with:
    1. lrcfg > s) Save configuration > Enough freespace? (y/N) y

Booting the Raspberry PI

  1. - Reboot your PI
  2. - After ~ 30 seconds, find out what the PI's Ip address is, and ssh in it: ssh root@raspberry_pi_IP_address. On Android, the apps "fing" or "WIFIman" from Ubiquiti might help you ...
  3. - Set the new passwords for the OS and webconf, as you will be asked.
  4. - Open webconf from a browser http://raspberry_pi_IP_address to try it out
  5. - While you're there, it would be a good idea to comment-out the non-existing eth1 in /etc/network/interfaces, look in Networking...
  6. - A good time also, if you prefer, to do a "ssh-copy-id" to write your PC public ssh keys in /.ssh/authorized_keys (see https://bering-uclibc.zetam.org/wiki/Bering-uClibc_6.x_-_User_Guide_-_Advanced_Topics_-_Setting_Up_SSH_password-less_login_and_Port_Knocking )

Using the gateway

  1. If you are using the older and cumbersome RS-232C to USB cable + Null modem you are good to go:
    1. - connect the RS-232C to USB cable with the null modem between your PI and your device serial port
    2. - on your external PC, open an ssh session to the PI
    3. - within your ssh session, start picocom on the PI: picocom -b115200 /dev/ttyUSB0
    4. - hit return:... you should have the prompt to login in your router or whatever !
    5. - exit picocom with Cntl-a Cntl-x, help is Cntl-a Cntl-h
  2. If you are using the simpler RS-232C to 3.3 volts ttl converter you first need to deactivate a couple of things...
    1. - deactivate the console ttyAMA0 by commenting it out in /etc/inittab
    2. - in /mnt/cmdline.txt remove console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
    3. - lrcfg > s) save, reboot
    4. - connect the "RS-232C to 3.3 volts ttl converter" to your PI 3.3v(pin1) to ttl-VCC, TX(14) to ttl-TX, RX(15) to ttl-RX and ground(pin6) to ttl-GND, and plug the converter in your device serial port
    5. - on your external PC, open an ssh session to the PI
    6. - start picocom: picocom -b115200 /dev/ttyAMA0
    7. - hit return:... you should have the prompt to login in your router or whatever !
    8. - exit picocom with Cntl-a Cntl-x, help is Cntl-a Cntl-h
  3. Lastly, using the PI Zero W... detailed explanations for the WIFI are available here
    1. - deactivate the console ttyAMA0 by commenting it out in /etc/inittab
    2. - in /mnt/cmdline.txt remove console=ttyAMA0,115200 kgdboc=ttyAMA0,115200
    3. - in /mnt/leaf.cfg add the following lrp modules to LRP=" ...iw.lrp, wireless.lrp, wpasupp.lrp..."
    4. - lrcfg > s) save, reboot
    5. - in /etc/default/wpasupplicant set ENABLE=1 and INTERFACE="wlan0"
    6. - in /etc/wpa_supplicant.conf set ssid="your_ssid" and psk="your_psk"
    7. - in /etc/network/interfaces add at the end:
            auto wlan0 
            iface wlan0 inet dhcp 
            wpa_supplicant_control 1
       6.-lrcfg > s) save, reboot

After this last reboot, the PI Zero W might still refuse to connect to your WIFI because it complains about missing some firmware or regulatory.db files. These files are not part of the Distribution yet, but can be copied from the Raspberry PI Zero OS or from here. If you are tempted by this last case, simply click the Download button in the web page and configdb.lrp will be copied to your Download directory.

Let's unpack this configdb.lrp:

cd ~/Downloads
sudo mkdir configdb
cd configdb
sudo tar xzvf ../configdb.lrp

So now all your missing files are in ~/Downloads/configdb/

There are different ways of copying these files to your PI Zero W, but right now, you are connected to it with only the HDMI display and USB keyboard, and there are no direct way to copy these files... Let's look at some options:

  • We will use a USB key to transfer the files to your PI Zero W... and I assume you don't have a USB hub; too simple then !
    • we have to free the USB port where your keyboard is now attached, and replace it's function with the serial console on /dev/ttyAMA0
    • Using the console implies you have some soldered pins on gpio 14 and 15, and ground and a USB converter (cheaper than a HUB )
  1. re-enable the console on /dev/ttyAMA0 by un-commenting it in /etc/inittab
  2. lrcfg > s) save
  3. poweroff the PI and connect a ttl to USB converter from your PI's GPIO pins 14, 15 and ground, to an external PC USB port
  4. on your external PC, mount a USB key on /mnt
  5. put the missing files on the USB key: sudo cp -r ~/Downloads/configdb/lib/firmware/ /mnt/firmware/
  6. unplug your USB keyboard from the PI Zero W, and plugin the USB key in it's place
  7. start a picocom session on your PC: picocom -b115200 /dev/ttyUSB0
  8. powerup the PI, patiently wait until you get a login prompt... well login !
  9. mount the USB key to /mnt and copy the files to /lib/firmware : cp -r /mnt/firmware/* /lib/firmware/
  10. disable the console by commenting it out in /etc/inittab
  11. a final lrcfg > s) save before reboot

Phew !!! that's a lot of steps ...


  • We can also use the special file configdb.lrp, no need to solder pins here and no additional hardware is required
    • mount your PI's SD card on your external PC like:
sudo mount /dev/sdb1 /mnt
cd /mnt
sudo mkdir configdb
cd configdb
sudo tar xzvf ../configdb.lrp
  • this unpacks your existing PI's configdb.lrp to /mnt/configdb/
    • Now you can copy the missing files to /mnt/configdb/lib/firmware/
sudo cp -r ~/Downloads/configdb/lib/firmware/* /mnt/configdb/lib/firmware/
cd /mnt/configdb ...just in case ...
sudo tar -c * | gzip -9 > configdb.lrp
sudo cp configdb.lrp ../
  • and this repacks and replaces your original PI's configdb.lrp, yeap .lrp is just a renamed .tgz !
    • Put back the SD card in your PI and reboot and test if you have WIFI connectivity:
ip addr

should give you wlan0: ip address... after a few seconds.

You just learned how to use configdb.lrp to preset some package parameters directly on your media. This file is special as it does not have to be signed like all the other packages, and if present will be loaded without complaints. The LEAF system generates configdb.lrp after you made changes when hitting lrcfg > s) save. On a fresh distribution it does not exist yet, but you can always create one manually, but thread carefully as it will supersede any existing one, or you can always do what we just did, only copy the changes to the existing one.

Additionnal Raspberry PI Zero W ack

Here is a clean setup for the PI Zero W, everything fits in a 3D printed box, and the wiring to the flashy red hot APU2C2 serial port is a neat flat cable.

Erich's rendering ...
Erich's rendering

Correcting some bugs...(only for the PI 1)

This last section is only for the first generation PI 1 with "LEAF Bering-uClibc 6.1.4 Rev 1 uClibc 1.0.25" distribution. I experienced some issues that needed fixing. With the newer versions these bugs might be gone now, but I didn't check that yet, as there are more important things to do, and besides it works now !!! and I've grown attached to my solutions :-) .
The other PIs 2 and 3, that I own, didn't show these problems. 

From an already opened ssh session:

  • - fix xterm: go to /etc/terminfo/x and "cp xterm xterm-256color" ... # the "lrcfg" menu needs xterm-256color so we make one up in B&W !
reset jumper
reset jumper
reset jumper
reset jumper


  • - create a new "reboot" command: first, make the script /root/GPIO4reboot.sh and second, change the old reboot command in /sbin...

the script /root/GPIO4reboot.sh will set gpio4 to low (0) which will reset the PI, a hard reboot !

cd /root
nano GPIOreboot.sh

fill with this content:

#!/bin/sh
#
# reset avec gpio4 connecte sur reset du PI, P6 pin 1 square.
#
echo "4" > /sys/class/gpio/export             # we will talk to gpio4
echo "out" > /sys/class/gpio/gpio4/direction  # gpio4 on boot is an high-z input, but defaults to low (0) as an output

don't forget to make the script executable with:

chmod 0755 GPIO4reboot.sh

Let's replace the non-working "reboot" command with our own hardware reboot command ...

cd /sbin

mv reboot old_reboot               # keep old command in case someone repairs/fixes busybox...
ln -s /root/GPIO4reboot.sh reboot  # the "reboot" command link now points to /root/GPIO4reboot.sh


  • - set the local.local: everything we just did which is not part of the LEAF distribution has to be saved in /var/lib/lrpkg/local.local ...
lrcfg > 3) Packages configuration > 3) local > 1) list of files that should be saved > 

fill with this content:

var/lib/lrpkg/local.local
etc/terminfo/x/xterm-256color
root/.ssh/authorized_keys
root/GPIO4reboot.sh
sbin/reboot
sbin/old_reboot

***and a very important final save:

lrcfg > s) save configuration

Final thoughts

  • It would be a good idea to configure eth0 with a static IP address in /etc/network/interface. This would allow a network communication between your workstation and the PI Serial gateway even if your firewall and consequently DHCP server are down.
  • In the previous case, you might also probably loose WIFI connectivity, so using a PI Zero W might not be as reliable... ymmv !
  • You can also remove or comment out DB_OPTIONS=" -B " in /etc/default/dropbear, to bring the security level back.


  • Using the PI as a full blown firewall has not been tested here, the feeling is that it would be too slow... volunteers are welcome ...

Have fun

by: jrb with kapeka's idea to use leaf !


Prev Up Next