Comment 2 for bug 1873545

Revision history for this message
Hayden Barnes (haydenb) wrote :

/etc/update-motd.d/91-release-upgrade:

 #!/bin/sh

 # if the current release is under development there won't be a new one
 if [ "$(lsb_release -sd | cut -d' ' -f4)" = "(development" ]; then
    exit 0
 fi
 if [ -x /usr/lib/ubuntu-release-upgrader/release-upgrade-motd ]; then
    exec /usr/lib/ubuntu-release-upgrader/release-upgrade-motd
 fi

calls /usr/lib/ubuntu-release-upgrader/release-upgrade-motd:

 stamp=/var/lib/ubuntu-release-upgrader/release-upgrade-available
 if [ -f "$stamp" ]; then
 # Stamp exists, see if it's expired
 now=$(date +%s)
        lastrun=$(stat -c %Y "$stamp") 2>/dev/null || lastrun=0
        expiration=$(expr $lastrun + 86400)
        if [ $now -ge $expiration ]; then
  # Older than 1 day old, so update in the background
  /usr/lib/ubuntu-release-upgrader/check-new-release -q > "$stamp" & # <--- Line 31
 elif [ -s "$stamp" ]; then
  # Less than 1 day old, and non-empty, so display now
  cat "$stamp"
  echo
 fi
 elif [ "$(id -u)" = 0 ]; then
 # No cache at all, so update in the background
 /usr/lib/ubuntu-release-upgrader/check-new-release -q > "$stamp" &
 fi

on 20.04 wsl:

 $stat -c '%A %a %n' /var/lib/ubuntu-release-upgrader/
 drwxr-xr-x 755 /var/lib/ubuntu-release-upgrader/

 $ ls -la /var/lib/ubuntu-release-upgrader
 drwxr-xr-x 2 root root 4096 Nov 8 13:31 .

same on 16.04 wsl

I don't think /var/lib/ubuntu-release-upgrader/release-upgrade-available can be created because /var/lib/ubuntu-release-upgrader/ belongs to root.

This works fine in containers where users are privileged by default but runs into an issue when WSL starts as an unprivileged user.

Users are not going to invoke motd with sudo normally and this error is confusing to inexperienced users so it should be fixed.

/usr/lib/ubuntu-release-upgrader/release-upgrade-motd is in ubuntu-release-upgrader-core: https://git.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/tree/debian/release-upgrade-motd?h=ubuntu/focal