43

Every so often, I'll SSH into a box with unattended-upgrades and be greeted with "** System restart required ***" with no additional information.

My '/var/run/reboot-required.pkgs' file contains:

linux-image-3.13.0-61-generic
linux-base
linux-base
linux-base

I don't mind rebooting, but I don't like rebooting without having details of WHY I should reboot in the first place. Above, I see two packages triggered the message, but there's no explanation beyond that.

Is there a way to get additional details about the reason for the reboot to also show up on SSH sign in?

Ideally, I would like to pull in a file that contains something human-readable like, "Package xyz was updated at [date/time]. It needed to modify files a, b, and c but could not because the system blocked/would block the action. During the next reboot, files a, b, and c will be replaced." But something not completely human-readable is probably okay too.

4
  • IMO it seems obvious: The kernel got upgraded and it can't replace itself live (at least, not yet).
    – muru
    Aug 13, 2015 at 19:11
  • 10
    Of course it is obvious to you but only because I went digging and looked everything up so that I could demonstrate what I want. It is NOT obvious as soon as I SSH into the box. Showing the package list that requires a reboot is also insufficient. I want to know what date and time that package was updated and a human-readable reason that explains why the package wants the reboot. If your toaster wanted a reboot, you'd want to know why. So why not demand as much, if not more, from a highly complex operating system?
    – E. Diaz
    Aug 13, 2015 at 19:17
  • 1
    Because I'm an idiot? Feel free to edit if you think the question needs clarification.
    – E. Diaz
    Aug 13, 2015 at 19:23
  • related: serverfault.com/questions/846478/…
    – golimar
    Sep 18, 2020 at 8:44

2 Answers 2

37

Edit: Another, probably relevant or useful article.

As you already found out you can find the packages that require a restart in /var/run/reboot-required.pkgs

Now you just need to look in the changelog of the package to find the information you are looking for.

  • If you are already on the machine you can find the changelogs in /usr/share/doc/${package_name} (example: zless /usr/share/doc/linux-image-3.13.0-61-generic/changelog.Debian.gz).
  • Debian provides some tools like apt-listchanges to make this more convenient (1, 2, 3).
  • Another way to do that would be to use packages.ubuntu.com.

    In your case:

    image showing where to find the link for the changelog on packages.ubuntu.com

0
14

The file ultimately called is /usr/lib/update-notifier/update-motd-reboot-required (it's called by /etc/update-motd.d/98-reboot-required).

Inside the conditional if statement of one of those files, simply add this:

    echo "Packages causing reboot:"
    cat /var/run/reboot-required.pkgs

So, for instance, your /usr/lib/update-notifier/update-motd-reboot-required file would look something like this:

#!/bin/sh -e
#
# helper for update-motd

if [ -f /var/run/reboot-required ]; then
        cat /var/run/reboot-required
        echo "Packages causing reboot:"
        cat /var/run/reboot-required.pkgs
fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .