Skip to content

Instantly share code, notes, and snippets.

@alejandro-du
Created May 30, 2025 12:34
Show Gist options
  • Select an option

  • Save alejandro-du/d277d1a977d6bd94967ff933275b1c9f to your computer and use it in GitHub Desktop.

Select an option

Save alejandro-du/d277d1a977d6bd94967ff933275b1c9f to your computer and use it in GitHub Desktop.
Upgrade steps from Debian 11 to 12 on Raspberry Pi, including Docker and .zst fix.
# 1. Clean and fully upgrade Debian 11 system
sudo apt update && sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove --purge -y
sudo apt clean
# 2. Replace "bullseye" with "bookworm" in official sources
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/raspi.list
# 3. Adjust for Debian 12 "non-free" component split
sudo sed -i 's/non-free$/non-free non-free-firmware/' /etc/apt/sources.list
# 4. If using Docker and bookworm is supported (ignore if 'no such file or directory'):
sudo sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/docker.list
# (If unsure, disable Docker instead)
# sudo mv /etc/apt/sources.list.d/docker.list /etc/apt/sources.list.d/docker.list.disabled
# 5. Update APT and remove known broken .deb before proceeding
sudo apt update
sudo rm -f /var/cache/apt/archives/dphys-swapfile_*.deb
echo "dphys-swapfile hold" | sudo dpkg --set-selections
# 6. Safe partial upgrade to resolve dependencies
sudo apt upgrade --without-new-pkgs -y
# 7. Upgrade dpkg to get .zst support
sudo apt install -y dpkg
# 8. Resume full upgrade
sudo apt full-upgrade -y
# 9. Remove the hold and reattempt dphys-swapfile (optional)
echo "dphys-swapfile install" | sudo dpkg --set-selections
sudo apt install -y dphys-swapfile
# 10. Final clean-up
sudo apt autoremove --purge -y
sudo apt clean
# 11. Reboot into Debian 12
sudo reboot
# 12. Confirm Debian 12 is running
cat /etc/os-release
# 13. Ensure Docker is active
docker ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment