[Bug 1803601] Re: motd-news.service scheduled even when /etc/update-motd.d/50-motd-news is not executable
Tired Sysadmin
1803601 at bugs.launchpad.net
Tue Jul 26 15:49:16 UTC 2022
Simon Déziel (sdeziel) wrote:
> IIRC, `chmod -x` snippets from /etc/update-motd.d/ was the way to go a
> few releases ago when it was consumed by run-parts.
In 22.04 it's still handled by run-parts, and the man page documents it
as such. Specifically by
$ strings /lib/x86_64-linux-gnu/security/pam_motd.so | grep run-parts
/usr/bin/env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin run-parts --lsbsysinit /etc/update-motd.d > /run/motd.dynamic.new
in its primary use case. The "fetch new ads on boot" motd-news.service
for this bug report runs one of the scripts directly, but the directory
is still a run-parts input.
We could disable scripts by renaming them to something that won't be
found by the '--lsbsysinit' file patterns, but that would only solve the
problem for "at login" updates, not the "at boot" updates through
systemd.
> It's merely to avoid harmless surprise and keep the old sysadmins happy,
Service errors is hardly a "surprise", and you don't need to be
condescending about it.
wontfix (wontfix) wrote:
> and that is to set ENABLED=0 in /etc/default/motd-news."
>
> This file no longer exists by default in Ubuntu 22.04 Jammy.
$ grep VERSION /etc/os-release
VERSION_ID="22.04"
VERSION="22.04 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
$ dpkg -S /etc/default/motd-news
motd-news-config: /etc/default/motd-news
$ apt show motd-news-config
Package: motd-news-config
Priority: optional
Source: base-files
Task: cloud-image, ubuntu-wsl, server, ubuntu-server-raspi
APT-Manual-Installed: no
[several header elided]
It certainly existed by default from the beginning of the server
installation I'm working with. However, it's "priority: optional" so
perhaps that's what you mean by "not default"; it likely wouldn't be
there for a standard desktop installation.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to base-files in Ubuntu.
https://bugs.launchpad.net/bugs/1803601
Title:
motd-news.service scheduled even when /etc/update-motd.d/50-motd-news
is not executable
Status in base-files package in Ubuntu:
Triaged
Bug description:
update-motd(5) says:
Executable scripts in /etc/update-motd.d/* are executed by pam_motd(8) as the root user at each
login, and this information is concatenated in /run/motd.dynamic. The order of script execu‐
tion is determined by the run-parts(8) --lsbsysinit option (basically alphabetical order, with
a few caveats).
So sysadmins are used to "chmod -x" motd fragments from /etc/update-
motd.d/ to prevent their execution. When doing so for /etc/update-
motd.d/50-motd-news, I noticed that motd-news.timer was still trying
to execute the motd-news.service unit which then logged a failure:
systemd[3704]: motd-news.service: Failed to execute command: Permission denied
systemd[3704]: motd-news.service: Failed at step EXEC spawning /etc/update-motd.d/50-motd-news:
Permission denied
systemd[1]: motd-news.service: Main process exited, code=exited, status=203/EXEC
systemd[1]: motd-news.service: Failed with result 'exit-code'.
systemd[1]: Failed to start Message of the Day.
The motd-news.service unit looks like this:
$ systemctl cat motd-news.service
# /lib/systemd/system/motd-news.service
[Unit]
Description=Message of the Day
After=network-online.target
Documentation=man:update-motd(8)
[Service]
Type=oneshot
ExecStart=/etc/update-motd.d/50-motd-news --force
This problem was observed on a Bionic system:
$ lsb_release -rd
Description: Ubuntu 18.04.1 LTS
Release: 18.04
$ apt-cache policy base-files
base-files:
Installed: 10.1ubuntu2.3
Candidate: 10.1ubuntu2.3
Version table:
*** 10.1ubuntu2.3 500
500 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
100 /var/lib/dpkg/status
10.1ubuntu2.2 500
500 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages
10.1ubuntu2 500
500 http://archive.ubuntu.com/ubuntu bionic/main amd64 Packages
But the problem also exist in Disco.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/1803601/+subscriptions
More information about the foundations-bugs
mailing list