[Bug 1803601] Re: motd-news.service scheduled even when /etc/update-motd.d/50-motd-news is not executable
Simon Déziel
1803601 at bugs.launchpad.net
Thu Nov 15 20:32:37 UTC 2018
A possible fix would be to make the unit execution conditional to the
update-motd fragment being executable:
[Unit]
ConditionFileIsExecutable=/etc/update-motd.d/50-motd-news
I'm not sure if this should be added to motd-news.service, motd-
news.timer or both.
** Description changed:
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).
+ 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.
+ 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
+ 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.
--
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:
New
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