Debian12 Bookworm for RPi in ci (#4238)

* update RPi base image to Debian12 Bookworm in ci
* ci: remove  -d headless for rpi
* docs: ready made images for arm64-rpi
* update python deps, add rsyslog, armbian_deps
* hide wget progress in lean build, keep errors
* apt-get instead of apt
* enable ssh
* apt-get everywhere, remove only if present
* use --quiet for wget for cleaner logs
This commit is contained in:
openoms 2023-11-22 08:28:54 +01:00 committed by GitHub
parent 7a7c7bd97b
commit b57aba6acf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 68 additions and 48 deletions

View file

@ -1,12 +1,12 @@
#!/usr/bin/env bash
#########################################################################
# Build your SD card image based on: 2022-04-04-raspios-bullseye-arm64.img.xz
# https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-05-03/
# SHA256: e7c0c89db32d457298fbe93195e9d11e3e6b4eb9e0683a7beb1598ea39a0a7aa
# Build your SD card image based on: 2023-10-10-raspios-bookworm-arm64.img.xz
# https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-10-10/
# SHA256: 1702d6494e8fc1036c39d73d99a5b7e0bfb5352fd2cf35fd940c66ceb37d2c0a
# PGP fingerprint: 8738CD6B956F460C
# PGP key: https://www.raspberrypi.org/raspberrypi_downloads.gpg.key
# setup fresh SD card with image above - login per SSH and run this script:
# setup fresh SD card with image above - login via SSH and run this script:
##########################################################################
defaultRepo="raspiblitz" #user that hosts a `raspiblitz` repo
@ -150,9 +150,9 @@ range_argument(){
apt_install() {
for package in "$@"; do
apt install -y -q "$package"
apt-get install -y -q "$package"
if [ $? -eq 100 ]; then
echo "FAIL! apt failed to install package: $package"
echo "FAIL! apt-get failed to install package: $package"
exit 1
fi
done
@ -166,7 +166,7 @@ done
## if any of the required programs are not installed, update and if successfull, install packages
if [ -n "${general_utils_install}" ]; then
echo -e "\n*** SOFTWARE UPDATE ***"
apt update -y || exit 1
apt-get update -y || exit 1
apt_install ${general_utils_install}
fi
@ -312,13 +312,21 @@ if [ "${cpu}" = "aarch64" ] && { [ "${baseimage}" = "raspios_arm64" ] || [ "${ba
fi
echo "*** Remove unnecessary packages ***"
apt remove --purge -y libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi plymouth python2 vlc* cups
apt clean -y
apt autoremove -y
unnecessary_packages=(libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi plymouth python2 vlc* cups)
for pkg in "${unnecessary_packages[@]}"; do
if dpkg-query -W -f='${Status}' $pkg 2>/dev/null | grep -q "ok installed"; then
echo "Removing $pkg..."
apt-get remove --purge -y $pkg
else
echo "$pkg is not installed."
fi
done
apt-get clean -y
apt-get autoremove -y
echo -e "\n*** UPDATE Debian***"
apt update -y
apt upgrade -f -y
apt-get update -y
apt-get upgrade -f -y
echo -e "\n*** SOFTWARE UPDATE ***"
# based on https://raspibolt.org/system-configuration.html#system-update
@ -340,7 +348,7 @@ echo -e "\n*** SOFTWARE UPDATE ***"
# sqlite3 -> database
# fdisk -> create partitions
# lsb-release -> needed to know which distro version we're running to add APT sources
general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release smartmontools"
general_utils="policykit-1 htop git curl bash-completion vim jq dphys-swapfile bsdmainutils autossh telnet vnstat parted dosfstools fbi sysbench build-essential dialog bc python3-dialog unzip whois fdisk lsb-release smartmontools rsyslog"
# add btrfs-progs if not bookworm on aarch64
[ "${architecture}" = "aarch64" ] && ! grep "12 (bookworm)" < /etc/os-release && general_utils="${general_utils} btrfs-progs"
# python3-mako --> https://github.com/rootzoll/raspiblitz/issues/3441
@ -349,9 +357,9 @@ server_utils="rsync net-tools xxd netcat-openbsd openssh-client openssh-sftp-ser
[ "${baseimage}" = "armbian" ] && armbian_dependencies="armbian-config" # add armbian-config
[ "${architecture}" = "amd64" ] && amd64_dependencies="network-manager" # add amd64 dependency
apt_install ${general_utils} ${python_dependencies} ${server_utils} ${amd64_dependencies}
apt clean -y
apt autoremove -y
apt_install ${general_utils} ${python_dependencies} ${server_utils} ${amd64_dependencies} ${armbian_dependencies}
apt-get clean -y
apt-get autoremove -y
echo -e "\n*** Python DEFAULT libs & dependencies ***"
@ -399,7 +407,7 @@ update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
# 3. Nyx
# setuptools
sudo -H python3 -m pip install --upgrade pip
sudo -H python3 -m pip install grpcio==1.42.0 googleapis-common-protos==1.53.0 toml==0.10.2 j2cli==0.3.10 requests[socks]==2.21.0 protobuf==3.20.1 pathlib2==2.3.7.post1
sudo -H python3 -m pip install grpcio==1.59.3 googleapis-common-protos==1.61.0 toml==0.10.2 j2cli==0.3.10 requests[socks]==2.31.0 protobuf==4.25.1 pathlib2==2.3.7.post1
sudo -H python3 -m pip install pytesseract mechanize PySocks urwid Pillow requests setuptools
echo -e "\n*** PREPARE ${baseimage} ***"
@ -754,7 +762,7 @@ if [ "${baseimage}" = "raspios_arm64" ] || [ "${baseimage}" = "debian" ]; then
systemctl disable hciuart.service
# remove bluetooth packages
apt remove -y --purge pi-bluetooth bluez bluez-firmware
apt-get remove -y --purge pi-bluetooth bluez bluez-firmware
# disable audio
echo -e "\n*** DISABLE AUDIO (snd_bcm2835) ***"

View file

@ -4,15 +4,13 @@
<details>
<summary>Table of Contents</summary>
- [Ready made images](#ready-made-images)
- [Write the image to a disk connected with USB](#write-the-image-to-a-disk-connected-with-usb)
- [Ready made images for arm64-rpi](#ready-made-images-for-arm64-rpi)
- [Ready made images for amd64 (x86)](#ready-made-images-for-amd64-x86)
- [Write the image to a disk connected with USB](#write-the-image-to-a-disk-connected-with-usb)
- [Prepare the disk](#prepare-the-disk)
- [Option 1 - requires less disk space](#option-1---requires-less-disk-space)
- [Write the .qcow2 file directly to disk with `qemu-image dd`](#write-the-qcow2-file-directly-to-disk-with-qemu-image-dd)
- [Option 2 - convert to a raw disk image first](#option-2---convert-to-a-raw-disk-image-first)
- [Convert the .qcow2 volume to a raw disk image](#convert-the-qcow2-volume-to-a-raw-disk-image)
- [Write the .img to the disk](#write-the-img-to-the-disk)
- [The first boot](#the-first-boot)
- [Option 1 - rite the .qcow2 file directly to disk with `qemu-image dd`](#option-1---rite-the-qcow2-file-directly-to-disk-with-qemu-image-dd)
- [Option 2 - convert the .qcow2 volume to a raw disk image](#option-2---convert-the-qcow2-volume-to-a-raw-disk-image)
- [The first boot](#the-first-boot)
- [Lean image with Gnome desktop (default image)](#lean-image-with-gnome-desktop-default-image)
- [Extend the root partition (optional - recommended)](#extend-the-root-partition-optional---recommended)
- [Add wifi driver (optional)](#add-wifi-driver-optional)
@ -33,7 +31,19 @@
</details>
## Ready made images
## Ready made images for arm64-rpi
* The images are built in GitHub actions
* To see the downloadable artifacts will need to log in to GitHub
* Find the latest successful build of the default amd64 image:
https://github.com/raspiblitz/raspiblitz/actions/workflows/arm64-rpi-lean-image.yml?query=workflow%3Aarm64-rpi-lean-image-build+is%3Asuccess
* unpack the artifact to the same directory
```
unzip ./raspiblitz-arm64-rpi-image-*.zip
```
* The resulting `raspiblitz-arm64-rpi-lean.img.gz` can be written to an SDcard directly with Balena Etcher
## Ready made images for amd64 (x86)
* The images are built in GitHub actions
* To see the downloadable artifacts will need to log in to GitHub
* Find the latest successful build of the default amd64 image:
@ -46,9 +56,9 @@ https://github.com/rootzoll/raspiblitz/actions/workflows/amd64-lean-image.yml?qu
# install qemu-utils
sudo apt install -y qemu-utils
```
## Write the image to a disk connected with USB
### Write the image to a disk connected with USB
### Prepare the disk
#### Prepare the disk
* identify the connected disk with `lsblk` e.g., `/dev/sdk`
* set the disk variable
```
@ -65,20 +75,18 @@ https://github.com/rootzoll/raspiblitz/actions/workflows/amd64-lean-image.yml?qu
sudo wipefs --all ${disk}
```
### Option 1 - requires less disk space
#### Write the .qcow2 file directly to disk with `qemu-image dd`
* the .qcow2 volume is 8.1 GB
#### Option 1 - rite the .qcow2 file directly to disk with `qemu-image dd`
* requires less disk space - the .qcow2 volume is 8.1 GB
```
sudo qemu-img dd if=./raspiblitz-amd64-debian-lean.qcow2 of=${disk} bs=4M
```
### Option 2 - convert to a raw disk image first
#### Convert the .qcow2 volume to a raw disk image
#### Option 2 - convert the .qcow2 volume to a raw disk image
* the raw .img is 30GB
```
# convert
qemu-img convert ./raspiblitz-amd64-debian-lean.qcow2 ./raspiblitz-amd64-debian-lean.img
```
#### Write the .img to the disk
* identify the connected disk with `lsblk` e.g., `/dev/sdk`
* use [Balena Etcher](https://www.balena.io/etcher/)
* or `dd` to write the .img to disk
@ -86,15 +94,15 @@ https://github.com/rootzoll/raspiblitz/actions/workflows/amd64-lean-image.yml?qu
sudo dd if=./raspiblitz-amd64-debian-lean.img of=${disk} bs=4M status=progress
```
## The first boot
### Lean image with Gnome desktop (default image)
### The first boot
#### Lean image with Gnome desktop (default image)
* log in on screen:
* username: `admin`
* password: `raspiblitz`
* start a terminal for guidance
* alternatively connect with ssh over the LAN with the same username and password
### Extend the root partition (optional - recommended)
#### Extend the root partition (optional - recommended)
* The default image is 30GB. The partition can be extended to the full size of the disk.
* The lvm partition can be extended while mounted so this step can be done later as well while the system is running.
* CLI (recommended)
@ -125,7 +133,7 @@ https://github.com/rootzoll/raspiblitz/actions/workflows/amd64-lean-image.yml?qu
sudo lvextend -r -l +100%FREE /dev/mapper/raspiblitz--amd64--vg-root
```
### Add wifi driver (optional)
#### Add wifi driver (optional)
* as in https://wiki.debian.org/iwlwifi
* add the component `non-free` after `deb http://deb.debian.org/debian bullseye main` in `/etc/apt/sources.list`
* install the wifi driver for the mentioned cards:

View file

@ -1,8 +1,8 @@
variable "pack" { default = "lean" }
variable "github_user" { default = "raspiblitz" }
variable "branch" { default = "dev" }
variable "image_link" { default = "https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-05-03/2023-05-03-raspios-bullseye-arm64.img.xz" }
variable "image_checksum" { default = "e7c0c89db32d457298fbe93195e9d11e3e6b4eb9e0683a7beb1598ea39a0a7aa" }
variable "image_link" { default = "https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2023-10-10/2023-10-10-raspios-bookworm-arm64.img.xz" }
variable "image_checksum" { default = "1702d6494e8fc1036c39d73d99a5b7e0bfb5352fd2cf35fd940c66ceb37d2c0a" }
source "arm" "raspiblitz-arm64-rpi" {
file_checksum_type = "sha256"
@ -47,6 +47,8 @@ build {
"apt-get install -y sudo wget",
"apt-get -y autoremove",
"apt-get -y clean",
"touch /boot/ssh",
"echo 'pi:$6$TE7HmruYY9EaNiKP$Vz0inJ6gaoJgJvQrC5z/HMDRMTN2jKhiEnG83tc1Jsw7lli5MYdeA83g3NOVCsBaTVW4mUBiT/1ZRWYdofVQX0' > /boot/userconf"
]
}

View file

@ -12,4 +12,4 @@ else
fi
echo 'Build RaspiBlitz ...'
bash build_sdcard.sh -f ${fatpack} -u ${github_user} -b ${branch} -d headless -t false -w off -i false
bash build_sdcard.sh -f ${fatpack} -u ${github_user} -b ${branch} -t false -w off -i false

View file

@ -70,7 +70,8 @@ if [ "$1" = "install" ]; then
# download resources
binaryName="bitcoin-${bitcoinVersion}-${bitcoinOSversion}.tar.gz"
if [ ! -f "./${binaryName}" ]; then
sudo -u admin wget https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName}
echo "# Downloading https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName} ..."
sudo -u admin wget --quiet https://bitcoincore.org/bin/bitcoin-core-${bitcoinVersion}/${binaryName}
fi
if [ ! -f "./${binaryName}" ]; then
echo "# FAIL # Could not download the BITCOIN BINARY"

View file

@ -38,7 +38,8 @@ case "$1" in
fi
printf %s"\n*** Installing Go v${goVersion} for ${goOSversion} \n***"
wget https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz -P ${downloadFolder}
echo "# Downloading https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz ..."
wget --quiet https://dl.google.com/go/go${goVersion}.linux-${goOSversion}.tar.gz -P ${downloadFolder}
if [ ! -f "${downloadFolder}/go${goVersion}.linux-${goOSversion}.tar.gz" ]; then
printf "# FAIL # Download failed.\n"
rm -fv go${goVersion}.linux-${goOSversion}.tar.gz*