Where does "0 packages can be updated." come from?

Where does 0 packages can be updated. come from in the login process?


Solution 1:

These messages come from update-motd.

The /etc/update-motd.d/updates-available script generates this specific output from cat /var/lib/update-notifier/updates-available

Solution 2:

In answer to where do all of the MOTD messages come from, first look at the PAM configs.

 % grep -C1 motd /etc/pam.d/*
 /etc/pam.d/sshd:session optional pam_motd.so motd=/run/motd.dynamic

Look to see what pam_motd.so runs.

 % strings /lib/x86_64-linux-gnu/security/pam_motd.so
 run-parts /etc/update-motd.d > /run/motd.dynamic.new

'run-parts' runs all the scripts, in order, in a directory.

 % ls /etc/update-motd.d/
 00-header*     80-esm*  91-release-upgrade*  98-reboot-required*
 10-help-text*  80-livepatch*          95-hwe-eol*
 50-motd-news*  90-updates-available*  98-fsck-at-reboot*

Helper scripts are in /usr/lib/update-notifier/update-motd*

 /usr/lib/update-notifier/update-motd-fsck-at-reboot*
 /usr/lib/update-notifier/update-motd-hwe-eol*
 /usr/lib/update-notifier/update-motd-reboot-required*
 /usr/lib/update-notifier/update-motd-updates-available*

Data files are in /var/lib/update-notifier

 dpkg-run-stamp  hwe-eol                  updates-available
 fsck-at-reboot  package-data-downloads/  user.d/

To output the MOTD info from the command line, either

$ ssh localhost

or

# run-parts /etc/update-motd.d