Debian 13 Upgrade Adventure – With a Little Help from ChatGPT 🐧🤖

I asked an AI to write me a script for the big Debian upgrade – the sysadmin equivalent of "hold my beer". It went surprisingly smoothly. This time.

Comic: a small rocket flies from the number 12 to a star with 13, the man and a white robot cheer in a data center corridor

🌐 Also available in: Deutsch · Français · Español · Italiano · Português · Nederlands · Polski

In short: I asked ChatGPT to write me a Bash script that upgrades Debian 12 to Debian 13 – the sysadmin equivalent of “hold my beer”. Tested in a VM with a backup first, it went surprisingly smoothly. The post shows the script, why sharing it can also be dangerous, and my conclusion.

So today I did something both brilliant and borderline reckless: I asked ChatGPT to whip up a Bash script that upgrades a Debian 12 system to the fresh new Debian 13.

Yes, I know, trusting an AI with my beloved Linux distro is basically the sysadmin equivalent of “hold my beer.” 🍺


Table of Contents

The Setup

I played it safe (well, safe-ish). First, I spun up a VM, made a backup (because… duh), and then unleashed the script. To my mild surprise and great relief, it actually worked. The thing ran in interactive mode, threw a couple of “Are you sure, human?” type questions my way (I think two or three), then rebooted the machine.

And after the smoke cleared: Debian 13 booted up like a champ. 🎉


Sharing is Caring (and Potentially Dangerous)

Because I’m a generous nerd, I want to share this magical little script with you all. But let me just put this here in BOLD FLASHING DISCLAIMERS:

  • If this script nukes your server, eats your homework, or accidentally summons Skynet — not my fault.
  • Use it on a VM first. Backup like your digital life depends on it (because it does).
  • If it works: awesome. If it doesn’t: I told you so. 😉

The Script: upgrade-to-trixie.sh

Here’s the full Bash script I used, saved as upgrade-to-trixie.sh:

#!/bin/bash
# upgrade-to-trixie.sh
# Upgrade Debian 12 (Bookworm) -> Debian 13 (Trixie)
# USE AT YOUR OWN RISK ⚡

set -euo pipefail

LOGFILE="/var/log/debian-upgrade.log"

echo "=== Debian Upgrade Script: Bookworm -> Trixie ==="
echo "Logging to $LOGFILE"
echo

# Root check
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root! Try: sudo $0"
   exit 1
fi

# Log helper
log() {
    echo "[*] $1" | tee -a "$LOGFILE"
}

log "Starting upgrade process at $(date)"

# Backup APT sources
log "Backing up /etc/apt/sources.list..."
cp /etc/apt/sources.list /etc/apt/sources.list.bak.$(date +%F-%H%M%S)

# Update release name
log "Switching sources from 'bookworm' to 'trixie'..."
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list

# Update package lists
log "Updating package lists..."
apt update | tee -a "$LOGFILE"

# Minimal upgrade
log "Running safe upgrade..."
apt upgrade -y | tee -a "$LOGFILE"

# Full upgrade
log "Running full distribution upgrade (this may take a while)..."
apt full-upgrade -y | tee -a "$LOGFILE"

# Remove obsolete packages
log "Cleaning up old packages..."
apt autoremove -y | tee -a "$LOGFILE"
apt clean

log "Upgrade finished at $(date)"
echo
echo "=== Upgrade complete! Please reboot your system. ==="

🎯 Conclusion

I honestly expected more fire and chaos. Instead, the process was smoother than a fresh apt install neofetch.

So if you’re feeling adventurous (and have a good backup), give it a shot. Worst case, you get a great excuse to reinstall Debian (opens in a new tab) and brag about it on Mastodon.

Stay nerdy ✌️


📚 Related posts:

Some text, images, videos and audio on this site are AI-assisted or AI-generated. Details