[Bug 1873545] Re: Permission denied error from show-motd when updates available
Hayden Barnes
1873545 at bugs.launchpad.net
Sat Apr 18 04:15:19 UTC 2020
/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
** Also affects: update-motd
Importance: Undecided
Status: New
** Also affects: ubuntu-release-upgrader (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to update-motd in Ubuntu.
https://bugs.launchpad.net/bugs/1873545
Title:
Permission denied error from show-motd when updates available
Status in Ubuntu WSL:
New
Status in update-motd:
New
Status in ubuntu-release-upgrader package in Ubuntu:
New
Status in update-motd package in Ubuntu:
New
Bug description:
motd on demo of 20.04:
Welcome to Ubuntu 20.04 LTS (GNU/Linux 4.19.84-microsoft-standard
x86_64)
....
26 updates can be installed immediately.
0 of these updates are security updates.
To see these additional updates run: apt list --upgradable
/usr/lib/ubuntu-release-upgrader/release-upgrade-motd: 31: cannot
create /var/lib/ubuntu-release-upgrader/release-upgrade-available:
Permission denied
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntuwsl/+bug/1873545/+subscriptions
More information about the foundations-bugs
mailing list