Can I update Ubuntu with active users logged in? [closed]

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


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/ and putting /lib/x86_64-linux-gnu/ 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.

Source : Link , Question Author : anregen , Answer Author : Antonis Christofides

Leave a Comment