Comment 3 for bug 2040924

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Some findings:

a) the bug won't manifest itself it bin:landscape-common is not installed (obviously: just to note it's not a dependency of the test, maybe it should be)
b) bin:landscape-common's postinst runs update-motd once, which generates the /var/lib/landscape/landscape-sysinfo.cache file
c) the landscape-sysinfo motd script checks the age of the cache file. If it's less than 1min old, it WON'T regenerate it, and just display it[1]:

stamp="/var/lib/landscape/landscape-sysinfo.cache"
NEED_UPDATE="FALSE"
[ -z "$(find "$stamp" -newermt 'now-1 minutes' 2> /dev/null)" ] && NEED_UPDATE="TRUE"

Given (c), if the debian/tests/show-motd is reached quickly enough, the bug won't manifest itself. This, maybe with (a), might explain why the bug hasn't shown itself since now.

To test this, I ran the dep8 tests in a jammy container. First, without any changes, it passed. Then I added a sleep 60s, like so:

--- a/debian/tests/show-motd
+++ b/debian/tests/show-motd
@@ -2,6 +2,9 @@

 unset MOTD_SHOWN

+echo "Sleeping 60s"
+sleep 60
+echo "Continuing"
 RET=0
 bash -i -c '. /etc/profile.d/update-motd.sh' 2> stdout || RET=$?
 egrep -v '(bash: cannot set terminal process group|no job control in this shell)' stdout >&2 || true

And now it fails:
autopkgtest [11:05:10]: test show-motd: [-----------------------
Sleeping 60s
Continuing
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 6.5.0-13-generic x86_64)

 * Documentation: https://help.ubuntu.com
 * Management: https://landscape.canonical.com
 * Support: https://ubuntu.com/advantage

                         .--._ _.--.
                        ( \ / )
                         \ /\ /
                          \_ \/ _/
                           / \
                          ( /\ )
                           `--' `--'

                           FreedomBox

FreedomBox is a pure blend of Debian GNU/Linux. Web interface is available at
https://localhost/ . FreedomBox manual is available in /usr/share/doc/freedombox
and from the web interface.

  System information as of Mon Dec 4 14:04:30 UTC 2023

  System load: 1.66357421875 Temperature: 76.0 C
  Usage of /home: unknown Processes: 27
  Memory usage: 0% Users logged in: 0
  Swap usage: 0% IPv4 address for eth0: 10.0.102.17

If the empty file ~/.hushlogin exists on the server, login to the server
will be super quiet. Only the bash prompt is displayed.

Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status

*** System restart required ***

This message is shown once a day. To disable it please create the
/home/test/.hushlogin file.
/etc/update-motd.d/50-landscape-sysinfo: 17: cannot create /var/lib/landscape/landscape-sysinfo.cache: Permission denied
autopkgtest [11:06:11]: test show-motd: -----------------------]
autopkgtest [11:06:11]: test show-motd: - - - - - - - - - - results - - - - - - - - - -
show-motd FAIL stderr: /etc/update-motd.d/50-landscape-sysinfo: 17: cannot create /var/lib/landscape/landscape-sysinfo.cache: Permission denied
autopkgtest [11:06:11]: test show-motd: - - - - - - - - - - stderr - - - - - - - - - -
/etc/update-motd.d/50-landscape-sysinfo: 17: cannot create /var/lib/landscape/landscape-sysinfo.cache: Permission denied

d) if the cache file is older than 1min, landscape-sysinfo's motd script will attempt to write to it again, regardless if update-motd(8) was called with --show-only or not.

I suggest to revert the change in 23.08-0ubuntu2 asap.

1. https://git.launchpad.net/ubuntu/+source/landscape-client/tree/debian/landscape-sysinfo.wrapper