5

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?

1
  • As others have Answered it is not straightforward. I always reboot after an upgrade that changes any library files; Kernel and Firmware are a no brainer. It only takes a minute. I also backup before any update that makes more than trivial changes. – Milliways Mar 10 '20 at 6:19
3

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

8
  • 1
    This is not strictly true. apt get upgrade may also update the kernel/firmware which requires a reboot to take effect. ` "dist-upgrade` will replace deprecated packages, upgrade will just update things that are already installed" - it DOES NOT update the kernel (unless upgrade would on its own) – Milliways Mar 9 '20 at 1:38
  • 2
    The last - Firmware upgrade Feb 12 2020. You CAN continue without, running the old kernel, because the kernel hack makes a temporary copy of the old but ignoring it is not a good idea. – Milliways Mar 9 '20 at 2:00
  • 1
    Restarting services is mostly triggered by the upgrade script so you don't have to worry about it. – Ingo Mar 9 '20 at 9:58
  • 1
    I believe this answer is incorrect. man apt-get doesn't mention that the dist-upgrade has anything to do with updating the kernel; neither does the official documentation. Where do you get that information? – Seamus Mar 9 '20 at 19:28
  • 1
    @Seamus Thank you for your Carefulness. The answer has a source, it was one of the good sources that I added. However, in the link you've mentioned, it is said that even upgrade and full-upgrade going to be updated infrequently. Could you please mention the incorrect part of this answer? – M. Rostami Mar 9 '20 at 22:32
4

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:

  1. One could play it entirely safe & reboot after each and every upgrade, or dist-upgrade.

  2. One could look for tell tales of a kernel upgrade. For example, after the sudo apt-get upgrade command, 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 :)

  3. Some Debian distros/offspring (Ubuntu for example) set a flag at /var/run/reboot-required to indicate the kernel has been upgraded, and therefore required a reboot. However, last I checked (on stretch I 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.

2
  • On the other hand, you can also reboot if you actually see "unpredictable things" happening. – Dmitry Grigoryev Mar 12 '20 at 19:36
  • @DmitryGrigoryev: Yes - that's exactly how I "learned" this. It still amazes me though... apt is so good at working out all the package dependencies, yet the system has a blind spot where kernel upgrades are concerned. – Seamus Mar 12 '20 at 22:30
0

It is not a must to restart, pi has a refresh function that operates automatically just like when you use the 'remove' function. So a reboot is not priority

1
  • 1
    What "refresh function" are you talking about? – Dmitry Grigoryev Mar 12 '20 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.