Under what circumstances is a reboot of an Ubuntu system necessary? I often read in answers that after changes in the system the system is to be restarted, but is that absolutely necessary?
Under what circumstances is a reboot of an Ubuntu system necessary? I often read in answers that after changes in the system the system is to be restarted, but is that absolutely necessary?
There are generally two situations where a reboot is usually necessary:
libc
(rather,glibc
) is upgraded.There is a mechanism for reloading the kernel without restarting (How can I upgrade my server's kernel without rebooting?). With
glibc
, the biggest problem is init. It is possible to restart init (see Restarting init without restarting the system).For the average user, neither is recommended, and restarting is necessary.
Apparently, there exists a third case:
dbus
has been upgraded.dbus-daemon
is apparently incapable of restarting (from what I can understand of the discussion on this LWN article). And since a lot of things rely on DBus...Actually, it depends what you're trying to accomplish:
If you do an
apt-get dist-upgrade
and a new kernel comes in, and you want to activate it, you need a reboot.If a new version of FireFox comes in, you obviously don't.
And in between those two extremes are 50 shades of grey:
;-)
I can't think of any situations of where a reboot is absolutely necessary.
Really, you can leave Ubuntu running indefinitely. It might get malware (because kernel and libc updates aren't applied) and it might panic or crash out... But what are avoiding those actually going to do for you?
Given the complexities of life, it might be more necessary to ignore the constant demands of computers, and sustain yourself in other ways. Like breathing, eating, loving... living.
But even then, are they absolutely necessary? Is your existence on this plane within the absolute definition of necessity? I honestly don't know. Bit of a weird question to ask.
To the two big-fat-joke-spoilers who downvoted this post and those that follow,
This question was incomplete, or at least open-ended. When you throw around words like necessary, you need to give a context.
Many answers already assumed the OP meant highly desirable (in a technical sense), so posted answers that fit contexts like necessary to avoid being hacked or necessary if your computer crashes. They're good answers. Adding another wasn't really warranted.
But they say assumptions are the mother of all muck ups (or something like that anyway) so I peeled it back to absolute necessity. If you insist on using an old copy of 10.10, Time and Space will carry rolling on, as are their wonts.
You'll note I'm not recommending that position.
I actually had a situation earlier today that proves this. Sometimes, there are residual things left over in the system after a change is made. For example, I had a user that was not able to access
/dev/dsp
despite having been added to the appropriate groups. There was a lock placed on it by the first user that accessed it. However, even after killing that user, the lock was still in place and the second user could not access it. However, after a reboot, both users were able to simultaneously use/dev/dsp
without any conflict. Doing a reboot releases any residual things that could prevent changes from properly taking effect.The question should really be closed as primarily opinion based.
The fact is, it depends on what was updated, how exposed your system is to the open Internet, and what system services you have/need running.
Simply installing new versions of a package does not result in the related services and applications being restarted. For example, if you are running Firefox while you install an updated package for it, then you will be notified within the browser when you switch back to it, that it needs to be restarted, after the update was installed. Likewise, the kernel itself needs to be "restarted" when updates are applied for it. Because the kernel is the lowest level above the hardware, you do need to reboot the system, for the new kernel to be loaded. For other services, they can be restarted without rebooting. An update to Unity or underlying libraries used by the services of the environment, will need you to log out and back in, to restart them. For system services, it may be possible to manually restart them after an update is applied, but doing so automatically could be very disruptive if you are trying to use the system.
The only way to know absolutely certain if a certain action is necessary, is to know what the changes are, and what your risk is for not performing that action. Security fixes obviously require more abrupt action than simple changes to other things, that you may never directly encounter. The more directly your computer is connected to the Internet, the more risk there is, as well. You'll have to consider all the variables, and make a decision whether to reboot now, or later, when you install updates.
A running machine and strictly when doing an update/upgrade? Probably never (but do read on). The Linux system is set up in such a way that after you updated the system where it would require a reboot to activate the new features (ie. read the kernel got changed; changes to apache, mysql only require a restart of the service) you can always keep working with the current state the system is on.
Now if you want these new features active the easiest method of doing so is rebooting. But for all we care you keep working on this machine and reboot it the next weekend or the weekend after that. Or next christmas. Is it smart? Maybe not. But there is nobody stopping you from doing so. The system is smart enough to not accept the next update if the server has not rebooted yet.
To me the only reasons where a reboot is necessary is after first install or when doing maintenance where single user is required (think things like partitioning, fixing hard disk errors) or when some idiot ran the famous fork bomb (though that one could be fixed from the system itself).
For all other reboots to occur is at the grace of the administrator. And I can not call that "necessary".
First of all, I appreciate this question because it will always be current.
The other answers are correct and very detailed - that is why I go short.
There are scenarios where a reboot is necessary, like after installing a new kernel.
There are scenarios where it is recommended, like after the install of a new desktop.
In most scenarios, like after installing or upgrading software rebooting is not necessary.
Whenever you are in doubt I recommend to perform a restart, so you are on the safe side.
Install the package
debian-goodies
:and run the command
You will see a list of services and now you have the choice:
or