Skip to content

Instantly share code, notes, and snippets.

@hyukishi
Last active April 23, 2020 13:33
Show Gist options
  • Select an option

  • Save hyukishi/c950e5a60d5c334e5971755155d6bb0e to your computer and use it in GitHub Desktop.

Select an option

Save hyukishi/c950e5a60d5c334e5971755155d6bb0e to your computer and use it in GitHub Desktop.
Upgrade from Raspbian Stretch to Raspbian Buster
#!/bin/bash
# This script is used to upgrade your Raspberry Pi OS from version 9 (stretch) to version 10 (buster).
# It is advised to keep current configuration files to avoid breaking something else and always
# take a backup image of your sd card from your Raspberry Pi prior to upgrading.
# The script must be run as root!
[ "$(whoami)" != "root" ] && echo "You must be root to run this script" && exit 1
apt update
apt dist-upgrade -y
rpi-update
grep -rl stretch /etc/apt/ | xargs sed -i 's/stretch/buster/g'
# apt-listchanges, if installed, will extend the time it takes to upgrade your system as it updates the changelog while upgrading and is not required for Raspbian to work properly
apt-get remove apt-listchanges -y
apt update
apt dist-upgrade -y
apt purge timidity lxmusic gnome-disk-utility deluge-gtk evince wicd wicd-gtk clipit usermode gucharmap gnome-system-tools pavucontrol
apt autoremove -y
apt autoclean -y
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
# The following is for wireguard server installations only. Uncomment if needed.
# dpkg-reconfigure wireguard
# dpkg-reconfigure wireguard-tools
# dpkg-reconfigure wireguard-dkms
# Now that the installation is complete, it's time to reboot
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment