Last active
August 30, 2022 15:24
-
-
Save robertoschwald/9372cadbb948fc5ce410b63f75e86080 to your computer and use it in GitHub Desktop.
Upgrade Raspberry from Buster to Bullseye in-place
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.