RASPBERRY PI – Guide to installing Debian Backports & latest Cockpit release

shell script as follows:

Create backports.sh with the following code and execute it:

#!/bin/bash

# Retrieve the version codename from /etc/os-release and store it in a variable
VERSION_CODENAME=$(awk -F= '$1=="VERSION_CODENAME" { print $2 }' /etc/os-release | tr -d '"')

# Debug: Output the detected version codename
echo "Detected VERSION_CODENAME: $VERSION_CODENAME"

# Check if VERSION_CODENAME was successfully retrieved
if [ -z "$VERSION_CODENAME" ]; then
    echo "Error: Unable to retrieve VERSION_CODENAME from /etc/os-release."
    exit 1
fi

# Create or overwrite the backports.list file with the correct repository line
sudo sh -c "echo 'deb https://deb.debian.org/debian ${VERSION_CODENAME}-backports main' > /etc/apt/sources.list.d/backports.list"

# Update the package lists
sudo apt update

# Inform the user
echo "Backports repository for ${VERSION_CODENAME} added and package lists updated."

Install latest version

Check the latest backport version available:
apt-cache policy cockpit
Install the latest version (bookworm)
sudo apt -t bookworm-backports install cockpit

Leave a comment