[Bug 1685193] Re: [17.04] systemd-udevd. Scripts started by a rule won't write to /var/log
Dan Streetman
1685193 at bugs.launchpad.net
Wed Jun 30 20:14:58 UTC 2021
please reopen if this is still an issue
** Changed in: systemd (Ubuntu)
Status: Confirmed => Won't Fix
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/1685193
Title:
[17.04] systemd-udevd. Scripts started by a rule won't write to
/var/log
Status in systemd package in Ubuntu:
Won't Fix
Bug description:
this is rather weird problem but after upgrading to the 17.04 the pm-
powersave script I start by a udev rule stopped working. After
debuggin a bit I found a place that causes the error. In the /usr/lib
/pm-utils/pm-functions there's the init_logfile function that called
exec to redirect script's output to the /var/log/pm-powersave.log. And
it fails to do so because root (under which the script is started) has
no permission to write to anything under the /var/log/
Inside of that functions I added additional logging to prove that
1. the script is started under root
2. the file /var/log/pm-powersave.log exist and it has 644 permissions
3. the root can read from /var/log/*
4. /var permissions are 755, /var/log permissions are 775
If the script is started with 'sudo /usr/sbin/pm-powersave true' then
it works!
So what could this be? Could the apparmor prevent udevd to write to
/var/log ?
Temporary solution is to write to /tmp/pm-powersave.log
How to reproduce:
1. add the following rule to /etc/udev/rules.d/test.rules
SUBSYSTEM=="power_supply", ATTR{online}=="0", RUN+="/usr/sbin/testudev true"
SUBSYSTEM=="power_supply", ATTR{online}=="1", RUN+="/usr/sbin/testudev false"
2. create /usr/sbin/testudev script and make it executable
#!/usr/bin/env bash
logger "testudev: I'm: $(whoami)"
echo test >> /var/log/testudev.log
3. Plug and unplug the power plug. Check the syslog:
Apr 21 13:17:06 chrome root: testudev: I'm: root
Apr 21 13:17:06 chrome systemd-udevd[23333]: Process '/usr/sbin/testudev false' failed with exit code 1.
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1685193/+subscriptions
More information about the foundations-bugs
mailing list