-2

I would like to run apt-get dist-upgrade, but I don't know how this will affect the currently logged in users. How can I find out:
1. will a restart be required
2. will the system be stable/functional until the restart if required (this page implies that there are times when the server will become non-functional until the restart)
3. will users have to log out before I run apt for updates to succeed

9
  • Could someone shed some light on the -1?
    – anregen
    Oct 20, 2014 at 22:29
  • It's a flaw of serverfault where people can downvote without leaving a comment. It's really sad. Hope you have a thick skin.
    – captcha
    Oct 20, 2014 at 23:11
  • 1
    Seroiusly, you should be testing a dist-upgrade in your lab against your regression tests. At the same time you'll learn the answers to the rest of your questions.
    – user9517
    Oct 21, 2014 at 8:28
  • 1
    @captcha all stack exchanges sites allow you to downvote with no comment.
    – tombull89
    Oct 21, 2014 at 8:30
  • 1
    @anregen I believe that people are downvoting the question because it seems to indicate that you aren't experienced enough. Your question could marginally fail the test "Shows sufficient skill in the technology under question to be able to work on it for pay" (meta.serverfault.com/questions/4111/…). I myself flirted with the idea of flagging your question as off-topic, although in the end I chose to reply to it. Oct 21, 2014 at 8:37

2 Answers 2

7

In Linux, like I think in all Unixes, when a process has an open file, it can continue to access it even if you delete it. After deletion the file is unreachable by other processes (there is no directory entry for it), but processes that had opened it before deletion can continue to access it using the handle the kernel gave them when they had opened it. The kernel only goes on to really free up the disk space when the file is closed by all processes that use it.

So, when you run a small upgrade, such as apt-get upgrade, this usually does not affect the system much. Suppose, for example, that apt upgrades glibc by deleting /lib/x86_64-linux-gnu/libc-2.13.so and putting /lib/x86_64-linux-gnu/libc-2.14.so in its place. This is an important update because practically everything uses the glibc library. However, there will probably not be any glitches, because already running processes will continue to use the old, deleted file. New processes will use the new file. This is why, when there is a glibc security update, we must restart all services after the update, but it's usually not necessary to restart the system.

There may be glitches, however, if a running process opens new files while it is running. A process might have the old version of file A already open, and it might attempt to open the new version of file B, and the new B could be incompatible with the old A. Or a program that had already been running before the update might try to open some libraries, and it might be incompatible with these. Or a program might try to access a library that used to be in some specific location, and now it might have been moved elsewhere. In my experience, such glitches happen mostly with big graphical applications. If I upgrade my system while working, at some point firefox stops responding or starts to behave strangely. Applications that run in terminals are less likely to be affected, but in major upgrades it's unlikely there won't be any glitch at all.

In addition, during the upgrades some services are turned down for some amount of time. And, also, things frequently go wrong in upgrades, resulting in crippled systems, which you then have to fix and it may take some time.

Bottom line: The extent to which your users will be affected depends on what they're doing and largely on chance. It is not unusual for them to not notice anything, but it would be unwise to bet your life on it.

As for the restart, apt-get dist-upgrade will probably install a new kernel, but it will not uninstall the already running kernel. If you don't mind the fact you will still be running the old kernel, you can skip restarting. I believe that in theory you can fix almost any glitch without restarting the system (just by restarting services), but it's usually easier to restart the entire machine after big upgrades.

2
  • Informative and nice answer, but I really don't get why anyone would run a dist-upgrade without rebooting the system. You're basically replacing everything in the base OS (including init and the kernel), why upgrade if you're not going to use it? Is it safe to wait until the next time you desperately need to reboot and land in a situation where the server might not boot up due to a incorrect upgrade?
    – pauska
    Oct 21, 2014 at 8:33
  • restarting every service does not fix kernel issues if there are some security problems with the kernel itself, so unless you are able to patch the running kernel (which is partly possible) you should restart for the kernel patches/the new kernel to actually be used. Oct 21, 2014 at 8:34
0
  1. will a restart be required
  2. will the system be stable/functional until the restart if required
  3. will users have to log out before I run apt for updates to succeed
  • You should probably restart if this includes glibc and kernel updates.
  • The system will likely function until you can restart, but if that's a concern, you should schedule a maintenance window and take care of your updates and downtime at the same time.
  • You users should not need to log out, but again, coordinate your maintenance window with the users and the business.

This is a situation where you (as sysadmin?) have to manage user expectations. If you have a set of updates important enough to consider running them outside of a maintenance window, I think you can make the business case to get real downtime and do the work properly.

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