Skip to content

Instantly share code, notes, and snippets.

@robertoschwald
Last active August 30, 2022 15:24
Show Gist options
  • Save robertoschwald/9372cadbb948fc5ce410b63f75e86080 to your computer and use it in GitHub Desktop.
Save robertoschwald/9372cadbb948fc5ce410b63f75e86080 to your computer and use it in GitHub Desktop.
Upgrade Raspberry from Buster to Bullseye in-place
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]; then
echo "Please run this script as root"
exit
fi
# Change Buster release-info to oldstable
apt update --allow-releaseinfo-change
# Latest Buster updates
apt update
apt full-upgrade
# Do NOT use rpi-update !! It installs dev-kernel. Use rpi-eeprom-update instead.
# Switch to Bullseye...
sed -i 's/buster/bullseye/g' /etc/apt/sources.list
sed -i 's/buster/bullseye/g' /etc/apt/sources.list.d/*
# In my case, /var was owned by unknown user, which causes systemd upgrade issues
chown root:root /var
# Action!
apt update
# Prerequisite packages
apt install libgcc-8-dev gcc-8-base
apt full-upgrade
apt -f install
dpkg --configure --pending
apt full-upgrade
# Remove obsolete packages
apt autoremove
# It seems the updater does not update the dhcpcd systemd unit file properly sometimes
sed -i 's/ExecStart=\/usr\/lib\/dhcpcd5\/dhcpcd/ExecStart=\/sbin\/dhcpcd/' /etc/systemd/system/dhcpcd5.service
systemctl daemon-reload
# Upgrade to Nodejs 14.x:
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
apt install nodejs -y
# Update RPI Firmware (Pi4, only. has some risk. Be warned)
rpi-eeprom-update -d -a
@robertoschwald
Copy link
Author

robertoschwald commented Jul 28, 2022

Drawback: /boot partition may be still 64MB if you upgraded from older Debian to Buster before. Recommended for Bullseye is 256MB, but Parted cannot resize vfat. So use tools like "fatresize" to resize the /boot partition if it is 64MB.

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