How to Update Raspberry Pi OS Packages
Keeping your Raspberry Pi updated ensures your system has the latest security patches, bug fixes, and software features. This guide provides a quick, step-by-step walkthrough on how to update your system packages using the terminal, automate the process, and clean up unnecessary files to keep your Raspberry Pi OS running smoothly.
Step 1: Update the Package Lists
Before installing any updates, you need to refresh the local package index. This tells your Raspberry Pi what software versions are currently available from the official repositories. Open your terminal and run the following command:
sudo apt update
This command connects to the Raspberry Pi OS servers and downloads the latest lists of packages, but it does not modify any installed software yet.
Step 2: Upgrade the Installed Packages
Once the package lists are refreshed, you can apply the actual updates. To upgrade all the software on your system to the latest versions, execute:
sudo apt full-upgrade -y
Using full-upgrade instead of a standard
upgrade is recommended for Raspberry Pi OS. It
intelligently handles changing dependencies with new software versions
and will remove obsolete packages if necessary. The -y flag
automatically answers “yes” to the confirmation prompt, allowing the
process to run without interruption.
Step 3: Clean Up Unused Files
After the upgrade process is complete, you can free up storage space by removing software packages that were automatically installed to satisfy dependencies for other applications but are no longer required. Run this command to clean them up:
sudo apt autoremove -y
Additionally, you can run sudo apt clean to clear out
the downloaded package files (.deb files) from the local
repository cache.
Step 4: Reboot the Raspberry Pi
While many updates take effect immediately, core system updates—such as kernel changes—require a system restart to apply. If you notice that the kernel or major system libraries were updated, reboot your device by typing:
sudo reboot