52

Oftentimes I try to ‘beat’ the update manager by opening a console and entering the sequence

sudo apt-get update
sudo apt-get upgrade

which, to the best of my knowledge, should update all packages to their newest stable releases. The update manager does the same, as far as I know.

However, the update manager sometimes (most frequently when a new kernel is distributed) requires a restart after terminating. apt-get never does, even when it looks like I’m upgrading the kernel. Why is this so?


In response to the duplicate vote: I am not asking which packages require a reboot as the linked question is. Rather I am asking why apt-get does not ask me to reboot even when I recognise a package being updated that the update manager would require a reboot for.

  • 10
    it's also worth noting that the sort of updates that are covered by apt-get dist-upgrade but not by apt-get updgrade are more likely to be those that would have caused update manager to suggest a reboot. – Jon Hanna Jun 9 '15 at 22:19
  • 4
    FWIW, you can check if restart is required by checking the existence of /var/run/reboot-required. Also, Byobu shows an "update required" icon in the status bar when needed. – Andrea Corbellini Aug 11 '15 at 18:00
  • 2
    @Pilot6 Not even remotely close to being a duplicate. The question you marked is asking which packages require a reboot. My question is asking why one updating method is not asking me to reboot even though I recognise a package being updated that would require reboots. – Jan Feb 10 '16 at 19:28
  • 1
    OK. But it is closely related. – Pilot6 Feb 10 '16 at 19:31
  • 1
    @Pilot6 That I can agree to ;) – Jan Feb 10 '16 at 19:32
80

Because apt-get (or plain simple apt) is for the pros and when the pros do a:

sudo apt-get dist-upgrade

and see a new kernel being installed, the pros know they have to reboot to activate it...

The automatic update is for everyone else out there!

;-)

Alternatively, you can now install Ubuntu Live kernel Patching from version 16.04 onwards.

  • 4
    I wish I could accept all three answers because they technically all say the same thing. But I think I’ll take yours because you made me grin most ;-) – Jan Jun 9 '15 at 20:29
  • 5
    >:) A little bit of humour in an answer is never bad! ;-) – Fabby Jun 9 '15 at 20:36
  • 4
    Kernel livepatching support is in mainstream kernels now, so with a bit of luck we may not have to reboot anymore once we get to LTS 16.04. – kasperd Jun 10 '15 at 7:02
  • Your description of the apt-get upgrade vs. apt-get dist-upgrade matches neither man apt-get nor my experience using the tool. I'm pretty sure the difference has to do with how dependencies that would require installing or removing packages are handled; "upgrade" skips those packages, "dist-upgrade" attempts install/remove packages to make the upgrade happen. – derobert Mar 7 '16 at 17:18
  • 1
    @Fabby somewhat confused as you've currently removed that paragraph, but if you look at the apt-get man page, the description of "upgrade" says e.g., "under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed.". So if a normal app update requires installing a new package (new library soname, for example), it won't be done. Or if a kernel update used the same package name, it would be done. – derobert Mar 9 '16 at 18:23
36

Update manager suggests to restart when kernels are upgraded or some other system packages with services that are marked for reboot when upgraded.

In this case /var/run/reboot-required is set by a package installation script.

Command line apt-get upgrade does not suggest anything, because it is targeted to more advanced users that can decide themselves when to restart the system ;-)

But after upgrade using apt-get Update Manager in a while will suggest to restart too.

  • I can't believe that, is that true? "services that can not be restarted without rebooting the whole system." – A.B. Jun 9 '15 at 20:33
  • 2
    Yes this is true. Like "upstart" and some others. Not many. – Pilot6 Jun 9 '15 at 20:34
  • 2
    @Pilot6 Sounds ridiculous if upstart cannot be restarted without a reboot. It was supposed to be an upgrade from SysV init which can be restarted without a reboot. – kasperd Jun 10 '15 at 6:59
  • @kasperd That was just an example. I noticed that Update manager asks for restart on some non-kernel packages. There must be some list of these packages. I am not quite sure upstart is there. – Pilot6 Jun 10 '15 at 8:15
  • 1
    @MaxNanasy Update manager will popup and suggest to reboot. it may happen in a while. – Pilot6 Jun 10 '15 at 19:50
14

When you install a new kernel you have to restart the machine in order for the changes to take effect, apt-get just doesn't nag about it.

  • Not just kernel updates. 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 depends on directly or indirectly via other software. I don't necessarily 100% trust the graphical update manager to know, either. – thomasrutter Jun 11 '15 at 5:46
7

apt-get actually notifies you on terminal when after installing a certain package, if it requires to reboot.

update-manager is an all-in-one type of solution that takes care all of your upgrade needs by itself.

I do prefer apt-get though , don't know why :)

2

apt-get upgrade does not update the kernel.

apt-get dist-upgrade updates the kernel in Ubuntu.

Linux kernel versions before 4.1 need a reboot when the kernel is updated.

Other packages don't need a reboot, just a restart of the application itself. Some Windows applications running on Wine request a reboot but just type the command:

wineserver -k

and restart the application.

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.