26

Ubuntu seems to require a reboot after almost every apt update, even those that do not include a new kernel version. Why?

  • I think you can improve the quality of your question by adding the list of packages involved in one of your updates. it makes the discussion more specific. – sazary Mar 27 '11 at 13:36
  • @ahm: Yes, I realised that. I noted on the accepted answer that I'll try to keep track of the packages before I complain again. –  Mar 27 '11 at 18:38

5 Answers5

15

I guess you are referring to the latest update.

It included a package called linux-firmware which is a package that provides firmware used by the Linux kernel drivers so it was a kernel related update.

So to answer your question or better to correct that statement, Ubuntu doesn't need to be restarted on every update but just on updates which are related to kernel stuff.

Octavian Helm
  • 14,355
  • 2
    I suppose my sample was biased. I'll try to be more scientific next time. –  Mar 26 '11 at 12:44
  • 1
    If rebooting that often is a problem for you, a package called ksplice is usable free in Ubuntu. It allows the kernel to be patched on the fly. Very impressive. – Nerdfest Mar 26 '11 at 13:36
  • @Nerdfest: I just hibernate or suspend my laptop, so every reboot is a nuisance. I hadn't heard of ksplice -- thanks. –  Mar 26 '11 at 13:46
  • As a warning, if you hibernate with an upgraded kernel, you will lose your state. I think suspend is okay though. – Nerdfest Mar 26 '11 at 18:58
  • You only need to reboot for the updates to take effect. For users who restart daily, there isn't much sense in a premature reboot. – user unknown Mar 26 '11 at 19:01
  • I am not sure this really answers what I find odd: in the past, ubuntu did not require reboots even with kernel updates. I had Ubuntu running for months, installing each and every update. Now, I have to reboot every few days. Is there no way to update and not constantly reboot? Is just doing this safe? – jpp1 Jul 29 '19 at 16:42
13

I'm not sure of all the packages that require a reboot to finish the upgrade, but it is easy to find out why in specific cases.

The warning is triggered by a postinst script in the package. It creates the file /var/run/reboot-required The file /var/run/reboot-required.pkgs will list the packages that require the reboot.

9

It's worth saying that Linux also needs rebooted after other package updates too.

I'm a big Ubuntu fan but the frequency of package updates (because it's so bleeding edge) is far higher than other distributions.

The extent of which has meant I've dropped Ubuntu on some Servers in favour of Debian.

If anyone else can add to this list of packages that need a reboot it would be appreciated.

I use the superb checkrestart from debian-goodies (it uses lsof) to check when older libraries are still in use.

Updating these packages force a reboot:

Kernel packages (not all, like the meta packages) libc dbus

I'm only really concerned with Ubuntu Server and not the Desktop because only rebooting my Servers gives me a headache!

jrg
  • 60,611
  • 3
    Bleeding Edge? Lots of packages from the Debian repositories that I'm interested in are years out-of-date. –  Mar 26 '11 at 13:34
  • I was referring to other distributions too, not just Debian-based flavours. The package versions in Ubuntu are far newer than most others which makes them less proven and more prone to updates. – Jonathan Ross Mar 26 '11 at 14:03
  • @Tim: Read again, he wrote "bleeding edge" in regards to Ubuntu. – Adam Byrtek Mar 26 '11 at 14:11
  • @Adam: Ubuntu uses the Debian repositories AFAIK. s/Debian/Ubuntu/ ín my comment if you want to. –  Mar 26 '11 at 14:22
  • @Tim: I think he meant the release cycle, but to be honest the answer is a bit difficult to comprehend. – Adam Byrtek Mar 26 '11 at 14:25
  • This answer is great. Thanks jonathan! Even though you didn't get selected, your answer is more correct. The kernel is not the only package that requests/requires a reboot. – user1974 Mar 26 '11 at 14:48
  • @Jonathan Ubuntu isn't bleeding edge; 95% of packages are out-of-date in Maverick, and 70% are out-of-date in Natty. Fedora is bleeding edge, with 70% out-of-date packages in 14 and 55% out-of-date in 15-alpha. Ubuntu just has a fast and consistent release cycle. –  Mar 30 '11 at 16:28
  • @user1974 System services can be restarted without rebooting (e.g. Apache2, OpenSSH). APT just sets the reboot-required flag (/var/run/reboot-required) for packages that affect system services or libraries. –  Mar 30 '11 at 16:32
2

If you don't want to, here is a solution for desktop Linux use: http://www.ksplice.com