11

One of the benefits that is always touted for Linux over Windows is that Linux servers don't need to be rebooted all the time, but it seems like our Ubuntu servers always want to reboot after installing the weekly, if not daily, updates. What gives? Is this just an Ubuntu issue or is this how all distros are now because security issues have become more of a problem?

Welcome to Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-72-generic x86_64)

 * Documentation:  https://help.ubuntu.com  
 * Management:     https://landscape.canonical.com  
 * Support:        https://ubuntu.com/advantage

6 packages can be updated. 
0 updates are security updates.

*** System restart required ***
Ron Smith
  • 213
  • 2
  • 6

3 Answers3

12

Ubuntu will suggest a restart after the update if it can't restart the affected components in a meaningful way.

In a nutshell:

  • Things like editors or command line tools don't need any kind of restart, they just get replaced.

  • Services like a web server might need to be restarted by itself.

  • Other things like the kernel or the core libc that affect everything will require a reboot, as they can't be easily replaced in a running system (NB: Things like ksplice exist that allows to patch some things in a running kernel).

But even with kernel updates without ksplice you don't strictly need to restart the system in every case - you have to carefully read the update notes to check if you are affected by the fixed bug(s) - if not, it's often safe to ignore this until the next update or regular maintenance cycle.

Sven
  • 98,649
  • 14
  • 180
  • 226
  • 1
    LivePatch from Canonical would be a good option if you want live kernel patching in Ubuntu. https://www.ubuntu.com/server/livepatch – Dylan Knoll Apr 25 '17 at 21:06
  • 2
    In addition, a restart will show you whether any of the updates made one of your services unstartable. If you restart immediately after update, you'll know which update caused it, but if you'd wait and reboot only after a dozen upgrades, it'll be hard to know what caused the problem. – Jenny D May 09 '17 at 07:59
6

You may check var/run/reboot-required.pkgs to check which packages got recently installed and require a reboot to get fully applied - usually kernel packages.

Xavy
  • 159
  • 3
4

when you have upgraded a package, the older version of that package may still be loaded into memory.

In some cases, you can restart a service if there's been an upgrade to the package containing it or to a library used by that service, but for packages like for example libc or the kernel, you need to restart. Kernel is loaded during boot and the libc is used by most programs in a typical ubuntu system.

Wether you need to restart or not depends on what you have upgraded and why.

Petter H
  • 3,443
  • 1
  • 16
  • 19