Skip to content

Instantly share code, notes, and snippets.

@jauderho
Last active August 17, 2025 16:22
Show Gist options
  • Save jauderho/5f73f16cac28669e56608be14c41006c to your computer and use it in GitHub Desktop.
Save jauderho/5f73f16cac28669e56608be14c41006c to your computer and use it in GitHub Desktop.
HOWTO: Upgrade Raspberry Pi OS from Bookworm to Trixie
### WARNING: READ CAREFULLY BEFORE ATTEMPTING ###
#
# Officially, this is not recommended. YMMV
# https://www.raspberrypi.com/news/bookworm-the-new-version-of-raspberry-pi-os/
#
# This mostly works if you are on 64bit. You are on your own if you are on 32bit or mixed 64/32bit
#
# Credit to anfractuosity and fgimenezm for figuring out additional details for kernels
#
# Make sure everything is up-to-date
sudo apt-get update && sudo apt-get dist-upgrade
# Point to bookworm repos instead
sudo sed -i -e 's/bookworm/trixie/g' /etc/apt/sources.list
sudo sed -i -e 's/bookworm/trixie/g' /etc/apt/sources.list.d/raspi.list
# Contents of /etc/apt/sources.list
deb http://deb.debian.org/debian trixie main contrib non-free non-free-firmware
deb http://security.debian.org/debian-security trixie-security main contrib non-free non-free-firmware
deb http://deb.debian.org/debian trixie-updates main contrib non-free non-free-firmware
# Uncomment deb-src lines below then 'apt-get update' to enable 'apt-get source'
#deb-src http://deb.debian.org/debian trixie main contrib non-free
#deb-src http://security.debian.org/debian-security trixie-security main contrib non-free
#deb-src http://deb.debian.org/debian trixie-updates main contrib non-free
# Contents of /etc/apt/sources.list.d/raspi.list
deb http://archive.raspberrypi.org/debian/ trixie main
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ trixie main
# Do actual update
sudo apt update && sudo apt -y full-upgrade && sudo apt -y clean && sudo apt -y autoremove
# Reboot
sudo reboot
# Modernize sources
sudo apt modernize-sources
# Make sure the following is in /etc/apt/sources.list.d/raspi.sources. The Signed-by: may be missing
Types: deb
URIs: http://archive.raspberrypi.org/debian/
Suites: trixie
Components: main
Signed-By: /usr/share/keyrings/raspberrypi-archive-keyring.gpg
# Remove the raspi.list.bak after confirming that everything works
rm /etc/apt/sources.list.d/raspi.list.bak
@jauderho
Copy link
Author

jauderho commented May 5, 2025

Adapted from https://gist.github.com/jauderho/6b7d42030e264a135450ecc0ba521bd8

Make sure you verify accordingly before you reboot.

@bcutter
Copy link

bcutter commented May 5, 2025

How much is known on the changes so far?

I‘m really looking forward to use this. Installed a bare metal server with 12/Bookworm few weeks ago completely from scratch with then migrating all services step by step. HELL NO. JUST NO! What an absolute pain in the evening. Reinstalling regularly is really not an option, upgrading is the path to choose. Saves a few weekends of time. Usually we have other things to do in life too. For this I deeply don‘t like the „upgrades are not supported“ meh.

So to sum up: thanks for providing this! Looking forward to use it once enough is known on the changes and first upgrades have been tested successfully.

@sonntam
Copy link

sonntam commented May 5, 2025

Will definitely try this when official Raspi OS Trixie is released. Thanks!

@jauderho
Copy link
Author

jauderho commented May 6, 2025

@bcutter I just upgraded a spare RPi I had lying around yesterday with no issue. So I would say that if you have a fairly stock setup that this should mostly work.

@jauderho
Copy link
Author

jauderho commented May 6, 2025

I noticed this warning when doing an update.

UPDATE: I no longer see this message

# sudo apt-get -y update --audit
Hit:1 http://security.debian.org/debian-security trixie-security InRelease
Hit:2 http://deb.debian.org/debian trixie InRelease                             
Hit:3 http://deb.debian.org/debian trixie-updates InRelease                     
Hit:4 http://archive.raspberrypi.org/debian trixie InRelease                    
Reading package lists... Done
W: http://archive.raspberrypi.org/debian/dists/trixie/InRelease: Policy will reject signature within a year, see --audit for details
A: http://archive.raspberrypi.org/debian/dists/trixie/InRelease: Sub-process /usr/bin/sqv returned an error code (1), error message is:
   Signing key on CF8A1AF502A2AA2D763BAE7E82B129927FA3303E is not bound:
              No binding signature at time 2025-04-25T12:00:23Z
     because: Policy rejected non-revocation signature (PositiveCertification) requiring second pre-image resistance
     because: SHA1 is not considered secure since 2026-02-01T00:00:00Z

@dk98174003
Copy link

Maybe nice to know this is not working with docker and docker-compose. The upgrade will fail.

@jauderho
Copy link
Author

jauderho commented Aug 9, 2025

@dk98174003 For now, you can choose to point to the bookworm repo instead. I just checked and the trixie repo is not yet working. So I would agree holding off for now if you use docker

I have gone ahead and upgraded more systems to trixie today and they seem to be working fine. Now off to @geerlingguy's time pi repo to mess with chrony and PTP

@geerlingguy
Copy link

@jauderho just don't create a singularity!

@karianneberg
Copy link

Thanks for your guide - it worked like a charm! To update the Raspberry Pi firmware and kernel as well, I ran:
sudo rpi-update
followed by:
sudo reboot
This was done after updating to Trixie and verifying that the Trixie upgrade was successful.

@kenneyd
Copy link

kenneyd commented Aug 11, 2025

@jauderho Thanks for the guide, it worked for me.

In the last line, I think there's a typo:
rm /etc/apt/sources.list.d/raspbi.list.bak has raspi misspelled, I think it should be rm /etc/apt/sources.list.d/raspi.list.bak

@jauderho
Copy link
Author

@geerlingguy Oops...

@kenneyd Thanks for the catch. Fixed.

@alfredopons
Copy link

alfredopons commented Aug 12, 2025

nice to know this is not working with docker and docker-compose. The upgrade will

I noticed this warning when doing an update.

UPDATE: I no longer see this message

# sudo apt-get -y update --audit
Hit:1 http://security.debian.org/debian-security trixie-security InRelease
Hit:2 http://deb.debian.org/debian trixie InRelease                             
Hit:3 http://deb.debian.org/debian trixie-updates InRelease                     
Hit:4 http://archive.raspberrypi.org/debian trixie InRelease                    
Reading package lists... Done
W: http://archive.raspberrypi.org/debian/dists/trixie/InRelease: Policy will reject signature within a year, see --audit for details
A: http://archive.raspberrypi.org/debian/dists/trixie/InRelease: Sub-process /usr/bin/sqv returned an error code (1), error message is:
   Signing key on CF8A1AF502A2AA2D763BAE7E82B129927FA3303E is not bound:
              No binding signature at time 2025-04-25T12:00:23Z
     because: Policy rejected non-revocation signature (PositiveCertification) requiring second pre-image resistance
     because: SHA1 is not considered secure since 2026-02-01T00:00:00Z

For solve key problem, I did this:

apt install --reinstall raspberrypi-archive-keyring

Put signature in apt file: /etc/apt/sources.list.d/raspberry-pi-foundation.sources

Modernized from /etc/apt/sources.list

Types: deb
URIs: http://archive.raspberrypi.org/debian/
Suites: trixie
Components: main
Signed-By: /usr/share/keyrings/raspberrypi-archive-keyring.gpg

@tomuta
Copy link

tomuta commented Aug 12, 2025

I tried this 2 days ago with a Raspberry Pi with desktop environment, and the apt full-upgrade failed to install one of the packages. I don't recall which one exactly, I think it was either libmousepad0 or lxpanel, essentially one of the raspberrypi-ui-mods packages, which crashed with a undefined import symbol during the dpkg install. I was unable to resolve this and had to essentially uninstall these. While it boots fine and I can access it over SSH and package wise apt/dpkg is happy now, the GUI is busted and won't start:

[+0.00s] DEBUG: Seat seat0: Starting
[+0.00s] DEBUG: Seat seat0: Creating greeter session
[+0.00s] DEBUG: Seat seat0: Failed to find session configuration lightdm-greeter
[+0.00s] DEBUG: Seat seat0: Failed to create greeter session
[+0.00s] DEBUG: Failed to start seat: seat0

@FlavaSava01
Copy link

FlavaSava01 commented Aug 12, 2025

I encountered a package error at about 40% during the update to Trixie. Following the official Debian instructions, I first tried a minimal update (sudo apt upgrade --without-new-pkgs). A full upgrade is supposed to be better afterward. Does that make sense?

Link to official Debian update instructions https://www.debian.org/releases/trixie/release-notes/upgrading.de.html#upgrading-packages

Edit : After the minimal update, I started a full upgrade. However, the lxpanel package keeps causing an error. When overwriting ...lxpanel/plugins/batt.so , Sub process /usr/bin/dpkg returned an error code (1). FYI, bookworm was a clean installation.

@Manish4586
Copy link

Mine no boot after that lol

@Manish4586
Copy link

Any guide for rollback? If system not booting?

@bcutter
Copy link

bcutter commented Aug 13, 2025

Did you upgrade the kernel? That would be a starting point. What does „no boot“ mean, any details?
Otherwise, roll back by restoring your backup.

@frittenlab
Copy link

Thanks again @jauderho perfect upgrade guide. My RPI5 with k3s is now running Raspberry OS Trixie. The entire process took about 15-20 minutes

@haani86
Copy link

haani86 commented Aug 17, 2025

@FlavaSava01 had the same issue ChatGPT to the rescue!

This is a file conflict plus a missing tool:

lxpanel 0.11.1-1 wants to install …/lxpanel/plugins/batt.so

You still have lxplug-batt (older Raspberry Pi plugin package) that already owns that file

Also /usr/bin/gdbus is missing (it lives in libglib2.0-bin)

Let’s unblock cleanly. Run these exactly, in order (note the minimal env + GIO_MODULE_DIR so gvfs doesn’t crash GLib while we fix things):

1) Get out of the gvfs/glib crash path

export DEBIAN_FRONTEND=noninteractive
BASE_ENV='env -i PATH=/usr/sbin:/usr/bin:/sbin:/bin GIO_MODULE_DIR=/doesnotexist DEBIAN_FRONTEND=noninteractive'

2) Remove the conflicting legacy plugin

sudo $BASE_ENV dpkg -r --force-depends lxplug-batt

3) Install gdbus (GLib tools)

sudo $BASE_ENV apt-get -y -t trixie install libglib2.0-bin

4) Let apt repair the partially-unpacked state and allow overwrites

sudo $BASE_ENV apt --fix-broken install -y -o Dpkg::Options::="--force-overwrite"

5) Ensure lxpanel finishes installing from the same suite

sudo $BASE_ENV apt-get -y -t trixie install lxpanel

6) Now continue the big upgrade

sudo $BASE_ENV apt-get -o Dpkg::Options::="--force-confnew" -o Dpkg::Options::="--force-overwrite" full-upgrade -y

7) Clean up

sudo $BASE_ENV apt-get autoremove --purge -y
sudo $BASE_ENV apt-get clean

If step 4 still complains about the same file

Force the overwrite in one shot, then continue:

sudo $BASE_ENV apt-get install -y -o Dpkg::Options::="--force-overwrite" lxpanel
sudo $BASE_ENV apt --fix-broken install -y -o Dpkg::Options::="--force-overwrite"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment