45

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.

Braiam
  • 69,112
E. Diaz
  • 599

3 Answers3

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

LiveWireBT
  • 29,597
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
Berto
  • 297
0

More (probably a lot more) details may be obtained by running

xargs apt-get changelog < /var/run/reboot-required.pkgs