My First Time Updating a Raspberry Pi with apt update
Updating a Raspberry Pi for the first time can feel like a rite of passage for anyone diving into the world of single-board computers. The Raspberry Pi, running a Linux-based operating system like Raspberry Pi OS, relies on tools like apt
to keep its software fresh and secure. In this post, I’ll walk you through my experience performing my first apt update
and apt upgrade
, including a moment of decision when I encountered a configuration file prompt, what I learned by checking the differences, and how I wrapped it all up with a cleanup command.
Step 1: Opening the Terminal
I started by opening the terminal on my Raspberry Pi. If you’re using the graphical interface, you can find the terminal in the menu or press Ctrl + Alt + T
. If you’re working over SSH or on a headless setup, you’re already in the right place.
Step 2: Running apt update
To begin, I ran the following command to update the package lists for upgrades and new package installations:
sudo apt update
The sudo
part is necessary because updating the system requires superuser privileges. This command refreshes the list of available packages and their versions from the repositories. After running it, I saw lines showing the system fetching data, ending with a summary like “All packages are up to date” or a list of packages that could be upgraded.
Step 3: Running apt upgrade
Next, I wanted to install the available updates, so I ran:
sudo apt upgrade
This command downloads and installs the latest versions of the packages. Progress bars showed downloads and installations in action, but then I hit a prompt that made me pause.
Step 4: The Configuration File Prompt
During the upgrade, I encountered this message:
Configuration file '/etc/initramfs-tools/initramfs.conf'
==> Modified (by you or by a script) since installation.
==> Package distributor has shipped an updated version.
What would you like to do about it ? Your options are:
Y or I : install the package maintainer's version
N or O : keep your currently-installed version
D : show the differences between the versions
Z : start a new shell to examine the situation
The default action is to keep your current version.
*** initramfs.conf (Y/I/N/O/D/Z) [default=N] ?
This prompt indicated that the initramfs.conf
file, part of the initramfs-tools
package used to generate the initial ramdisk for booting, had been modified since installation. The package maintainer provided a new version, and I needed to decide what to do.
Understanding the Options
Here’s what I learned about the options:
- Y or I: Install the package maintainer’s new version, overwriting my current file. This ensures the latest configuration but might discard custom changes.
- N or O: Keep my current version, preserving modifications but potentially missing updates or fixes.
- D: Show the differences between the two versions, useful for comparing changes.
- Z: Open a shell to investigate further, ideal for advanced users.
Since this was my first update and I hadn’t intentionally modified initramfs.conf
, I was curious about the changes. I first selected D to view the differences.
Step 5: Analyzing the Differences
Selecting D
showed a diff between my current file (/etc/initramfs-tools/initramfs.conf
) and the maintainer’s new version (/etc/initramfs-tools/initramfs.conf.dpkg-new
). Here’s what I saw:
--- /etc/initramfs-tools/initramfs.conf 2025-05-12 20:17:48.163045799 -0400
+++ /etc/initramfs-tools/initramfs.conf.dpkg-new 2025-07-21 03:33:02.000000000 -0400
@@ -17,7 +17,7 @@
# list - Only include modules from the 'additional modules' list
#
-MODULES=dep
+MODULES=most
#
# BUSYBOX: [ y | n | auto ]
@@ -74,11 +74,11 @@
#
# RUNSIZE: ...
#
-# The size of the /run tmpfs mount point, like 256M or 10%
+# The size of the /run tmpfs mount point, like 256M or 20%
# Overridden by optional initramfs.runsize= bootarg
#
-RUNSIZE=10%
+RUNSIZE=20%
Breaking Down the Changes
The diff revealed two changes:
- MODULES: Changed from
dep
tomost
.dep
means the initramfs includes only modules needed for the specific hardware, keeping the initramfs small.most
includes a broader set of modules, ensuring compatibility with a wider range of hardware but increasing the initramfs size.
- RUNSIZE: Changed from
10%
to20%
.- This setting controls the size of the
/run
tmpfs mount point, used for temporary files during boot. Increasing it to20%
allocates more memory, potentially improving performance for systems needing more temporary storage during boot.
- This setting controls the size of the
Since I hadn’t made these changes myself, they were likely made by a script or another package. The maintainer’s version seemed to prioritize broader compatibility (MODULES=most
) and more memory allocation (RUNSIZE=20%
), which made sense for a general-purpose update.
My Decision: Choosing “Yes”
After reviewing the diff, I chose Y to install the package maintainer’s version. I typed Y
and pressed Enter. My reasoning was that I hadn’t customized initramfs.conf
intentionally, and the changes (broader module support and increased tmpfs size) were likely beneficial for stability and compatibility with the updated system. If I had specific hardware constraints or custom boot settings, I might have chosen N to keep my version or merged changes manually after selecting Z, but Y was the safest choice for a beginner like me.
The upgrade continued, installing the new version of the configuration file and completing the package updates without further prompts.
Step 6: Cleaning Up with apt autoremove
Once the upgrade finished, I wanted to clean up unneeded packages to free up space. I ran:
sudo apt autoremove
This command removes packages that were automatically installed as dependencies but are no longer required. It freed up some disk space, which is especially helpful on a Raspberry Pi with limited storage.
Step 7: Verifying the Update
To ensure everything was applied correctly, I rebooted my Raspberry Pi with:
sudo reboot
After rebooting, I checked that my system was running smoothly. Everything worked as expected, confirming the update was successful.
Key Takeaways
- Run
sudo apt update
first to refresh package lists, thensudo apt upgrade
to install updates. - Configuration file prompts like the one for
initramfs.conf
are normal. Use D to inspect differences, which can help you decide between Y (maintainer’s version) or N (keep yours). - The diff for
initramfs.conf
showed changes toMODULES
(fromdep
tomost
) andRUNSIZE
(from10%
to20%
), which improve compatibility and allocate more memory for boot processes. - Choosing Y is often safe for beginners if you haven’t customized the file.
- Clean up with
sudo apt autoremove
to remove unneeded packages. - Reboot after updates to ensure changes take effect.
Updating my Raspberry Pi was a learning experience, especially with the configuration file prompt. Checking the differences with D
gave me confidence in choosing Y
, and the cleanup command kept my system tidy. I hope this guide helps other first-timers navigate their Raspberry Pi updates with ease!
No comments:
Post a Comment