After an update it is not always clear whether you need to reboot. On Ubuntu, and on Debian with the right package, the system tells you through a small file.
ls /var/run/reboot-required && cat /var/run/reboot-required.pkgs
When a package such as a new kernel or libc wants a reboot, its install hook writes *** System restart required *** into /var/run/reboot-required and appends its own name to reboot-required.pkgs. That is the line you see in the login banner. The second file is the useful one: it tells you which packages asked, such as libc6, or linux-base after a kernel update.
I’d put a one liner like this in scripts and monitoring:
[ -f /var/run/reboot-required ] && echo "reboot needed for: $(sort -u /var/run/reboot-required.pkgs | tr '\n' ' ')"
unattended-upgrades checks the same file when you enable its automatic reboot option. Because /var/run lives in memory, the files disappear at the next boot, so you never have to clean them up.
The file is written by the hooks from the update-notifier-common package, which Ubuntu installs by default. On a minimal Debian system without it, nothing writes the file and the check always says no. It also only covers packages that asked for it. A library update that leaves old copies in memory in running services does not create the file; for those, a tool like needrestart tells you which services to restart.
Further reading: update-notifier notify-reboot-required script, Ubuntu Server: automatic updates