Is it necessary to reboot after an apt-get update; apt-get upgrade? Or can I just continue to execute apt-gets and installs and hold off on the reboot?
When you install a new kernel or change/update part of that by commands like
apt-get dist-upgrade, you must restart the raspberry pi in order for the changes to take effect.
You also have to either reboot or restart some services when certain other packages are upgraded. If you're savvy you can often restart relevant services and avoid a reboot.
If you're not, then a reboot will always work. It's often not simple to work out what services need a restart, because upgraded packages could involve shared libraries that lots of other software depend on directly or indirectly via other software. Source
In general, a reboot is necessary only when the kernel is upgraded during the
apt-get upgrade (or dist-upgrade) process. Please refer to
man apt-get for details, and The Organization's docs on Updating and Upgrading.
Next question is, "How do you know when the kernel has been upgraded?"
That's a more difficult question, and there are several ways to approach it:
One could play it entirely safe & reboot after each and every
One could look for tell tales of a kernel upgrade. For example, after the
sudo apt-get upgradecommand, the packages to be upgraded will be listed. Check this list for something like
raspberrypi-kernel. Yeah - that sounds like a dead giveaway, but I'd caution against assuming too much. If you see it in The Organization's docs, I think you can rely on it, but as I've not seen it, I don't :)
Some Debian distros/offspring (Ubuntu for example) set a flag at
/var/run/reboot-requiredto indicate the kernel has been upgraded, and therefore required a reboot. However, last I checked (on
stretchI think), this feature had not been adopted by the Raspbian team.
Wrt rebooting, I tend to operate somewhere between reboot after every upgrade and look for telltales. If it's only a few packages that are upgraded, and I'm certain the kernel was not upgraded, I skip the reboot.
I think the danger of not rebooting is disconnects between a package and the new kernel; in other words, if an upgraded package depends on an upgraded kernel, and it uses the older kernel because we didn't
reboot, then unpredictable things may happen. In other words, I think that Raspbian expects us (the users) to make intelligent reboot decisions.