24

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?

22
  • After kernel panic;
  • After partitioning or filesystem modifications (more specifically, resizing root partition; I'd recommend to avoid resizing the hard drive from which you boot in general, regardless of partition; if you are resizing something external, like SD card or USB, no reboots necessary );
  • After kernel upgrade and security patches (although that might not always be necessary);
  • After system became unresponsive for whatever reason, and you've no option but to use magic SYSRQ keys or hard reset
  • After making changes to some dconf schemas , depending on the way application may have been developed. Related answer
  • Your CPU is overheating (you don't wanna keep on roasting those cores, do you ?)
  • Why would you need to reboot Ubuntu after partitioning? – UTF-8 Sep 10 '15 at 16:49
  • @UTF-8 Typically, it's recommended to partition an unmounted filesystem to prevent data loss. So, if you were to partition your hard drive, you'd need to insert live USB/DVD and reboot; when you done partitioning, reboot back to hard-drive. – Sergiy Kolodyazhnyy Sep 10 '15 at 17:16
  • 2
    Yes, but then rebooting is something you do anyways. If you partition something the system doesn't depend on (data partition, thumb drive, SD card, external HDD, file container, whatever), you don't need to reboot. I didn't reboot when I made a new partition table for 2 devices 2 hours ago. – UTF-8 Sep 10 '15 at 17:56
  • @UTF-8 I guess I should have been more specific in my answer. Will get that fixed in a second :) – Sergiy Kolodyazhnyy Sep 10 '15 at 18:07
  • 1
    With the partitioning thing, sometimes gparted etc says 'can't inform the kernel plz restart' – Wilf Sep 12 '15 at 13:42
17

There are generally two situations where a reboot is usually necessary:

  1. The kernel is upgraded.
  2. 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:

  1. 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...
12

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:

enter image description here

;-)

  • 1
    Indeed 50 shades :) – A.B. Sep 9 '15 at 19:13
  • 1
    This 50 Shades response is awesome! :) – Terrance Sep 10 '15 at 15:42
  • 1
    I created an account on this SE simply to upvote this answer... And yes, for the 50 shades of grey. – CDub Oct 2 '16 at 15:19
9

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.

  • Ok, the restart brought the desired effect, but was it really necessary. – A.B. Sep 9 '15 at 19:15
  • Yes, because killing the oss process that I was working with has been shown to leave it in a somewhat inconsistent state where it does not always work afterwards. – user323419 Sep 9 '15 at 22:50
9

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.

  • 2
    +1 and a broad smile for preferring eating over rebooting! :D – Byte Commander Sep 10 '15 at 15:48
  • Malware? Come on, kernel updates and libc updates have nothing to do here. Okay, maybe kernel could play a part, but it all depends on the internet, and also, Linux has a much less risk of getting infected. Ubuntu has auto-updates too. Linux is super stable too, but I agree that there is a risk. Otherwise, Kudos. – angulared Nov 1 '15 at 3:49
5

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.

5

When is it necessary to reboot an Ubuntu system?

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".

4

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.

  • 2
    Agreed. It's always better to stay on the safe side – Sergiy Kolodyazhnyy Sep 10 '15 at 15:45
  • "There are scenarios where it is recommended, like after the install of a new desktop." Wouldn't logging out and back in be sufficient for that case? – Eliah Kagan Sep 12 '17 at 17:00
  • @EliahKagan Yes, generally it of course should be sufficient to logout and back in when you install a new desktop environment, but I have seen many cases where something went wrong and that's why I said, it's recommended. :) – cl-netbox Sep 12 '17 at 17:35
1

Install the package debian-goodies:

sudo apt-get install debian-goodies

and run the command

sudo checkrestart

You will see a list of services and now you have the choice:

  • Restart each service

or

  • Reboot your system

$ checkrestart
Found 20 processes using old versions of upgraded files
(15 distinct programs)
(14 distinct packages)

Of these, 12 seem to contain init scripts which can be used to restart them:
The following packages seem to have init scripts that could be used to restart them:
gpm:
        3044    /usr/sbin/gpm
rpcbind:
        2208    /sbin/rpcbind
bind9:
        8463    /usr/sbin/named
openssh-server:
        22124   /usr/sbin/sshd
ntp:
        4078    /usr/sbin/ntpd
tftpd-hpa:
        3417    /usr/sbin/in.tftpd
uptimed:
        2704    /usr/sbin/uptimed
cron:
        3019    /usr/sbin/cron
postfix:
        22145   /usr/lib/postfix/qmgr
        8892    /usr/lib/postfix/master
hddtemp:
        3174    /usr/sbin/hddtemp
autofs:
        2792    /usr/sbin/automount
openbsd-inetd:
        3254    /usr/sbin/inetd

These are the init scripts:
service gpm restart
service rpcbind restart
service bind9 restart
service ssh restart
service ntp restart
service tftpd-hpa restart
service uptimed restart
service cron restart
service postfix restart
service hddtemp restart
service autofs restart
service openbsd-inetd restart

These processes do not seem to have an associated init script to restart them:
isc-dhcp-client:
       3775    /sbin/dhclient

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.