Your message dated Fri, 15 Dec 2017 13:12:05 +0100
with message-id <a81eed8c-dc47-f888-1c84-9d49d25f9...@debian.org>
and subject line Re: Bug#884454: systemd: systemd udev rule is not executed 
when removing - only when adding
has caused the Debian Bug report #884454,
regarding systemd: systemd udev rule is not executed when removing - only when 
adding
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact ow...@bugs.debian.org
immediately.)


-- 
884454: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=884454
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems
--- Begin Message ---
Package: systemd
Version: 235-3
Severity: important

Dear Maintainer,

on my system, systemd_wants udev rules get only executed when I
add devices, not when I remove them.

I have two udev rules

    ENV{PRODUCT}=="3/46d/101a/111", TAG+="systemd", ENV{SYSTEMD_WANTS}="aaa"
    ENV{PRODUCT}=="3/46d/101a/111", RUN+="/bin/bash -c '/bin/date 
+%%Y-%%m-%%d-%%H:%%M:%%S-RUN >> /tmp/log'"

The product ID belongs to my mouse. The aaa.service contains

    [Unit]
    Description=AAA

    [Service]
    Type=simple
    ExecStart=/bin/bash -c "/bin/date '+%%Y-%%m-%%d %%H:%%M:%%S AAA' >> 
/tmp/log"

When I unplug the mouse, I only see

    2017-12-15-11:40:54-RUN

in /tmp/log. When I plug the mouse, I see

    2017-12-15-11:41:22-RUN
    2017-12-15 11:41:22 AAA

as expected.

When removing the mouse, the only line in the syslog related to
aaa.service is

    Dec 15 11:40:54 cert systemd[1]: aaa.service: Collecting.


I report the problem here for SYSTEMD_WANTS, the same happens for
SYSTEMD_USER_WANTS. I would like to use the latter to run some
command in my X session when the mouse is added and removed.

Thanks for your attention,

Hendrik


-- Package-specific info:
-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: armhf, arm64

Kernel: Linux 4.13.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages systemd depends on:
ii  adduser         3.116
ii  libacl1         2.2.52-3+b1
ii  libapparmor1    2.11.1-4
ii  libaudit1       1:2.8.1-2
ii  libblkid1       2.30.2-0.1
ii  libc6           2.25-3
ii  libcap2         1:2.25-1.2
ii  libcryptsetup4  2:1.7.5-1
ii  libgcrypt20     1.8.1-4
ii  libgpg-error0   1.27-5
ii  libidn11        1.33-2
ii  libip4tc0       1.6.1-2+b1
ii  libkmod2        24-1
ii  liblz4-1        0.0~r131-2+b1
ii  liblzma5        5.2.2-1.3
ii  libmount1       2.30.2-0.1
ii  libpam0g        1.1.8-3.6
ii  libseccomp2     2.3.1-2.1
ii  libselinux1     2.7-2
ii  libsystemd0     235-3
ii  mount           2.30.2-0.1
ii  procps          2:3.3.12-3
ii  util-linux      2.30.2-0.1

Versions of packages systemd recommends:
ii  dbus            1.12.2-1
ii  libpam-systemd  235-3

Versions of packages systemd suggests:
ii  policykit-1        0.105-18
pn  systemd-container  <none>

Versions of packages systemd is related to:
pn  dracut           <none>
ii  initramfs-tools  0.130
ii  udev             235-3

-- Configuration Files:
/etc/systemd/logind.conf changed:
[Login]
HandleLidSwitch=ignore

/etc/systemd/system.conf changed:
[Manager]
LogLevel=debug


-- no debconf information

--- End Message ---
--- Begin Message ---
Am 15.12.2017 um 11:45 schrieb Hendrik Tews:
> Package: systemd
> Version: 235-3
> Severity: important
> 
> Dear Maintainer,
> 
> on my system, systemd_wants udev rules get only executed when I
> add devices, not when I remove them.
> 
> I have two udev rules
> 
>     ENV{PRODUCT}=="3/46d/101a/111", TAG+="systemd", ENV{SYSTEMD_WANTS}="aaa"
>     ENV{PRODUCT}=="3/46d/101a/111", RUN+="/bin/bash -c '/bin/date 
> +%%Y-%%m-%%d-%%H:%%M:%%S-RUN >> /tmp/log'"
> 
> The product ID belongs to my mouse. The aaa.service contains
> 
>     [Unit]
>     Description=AAA
> 
>     [Service]
>     Type=simple
>     ExecStart=/bin/bash -c "/bin/date '+%%Y-%%m-%%d %%H:%%M:%%S AAA' >> 
> /tmp/log"
> 
> When I unplug the mouse, I only see
> 
>     2017-12-15-11:40:54-RUN
> 
> in /tmp/log. When I plug the mouse, I see
> 
>     2017-12-15-11:41:22-RUN
>     2017-12-15 11:41:22 AAA
> 
> as expected.
> 
> When removing the mouse, the only line in the syslog related to
> aaa.service is
> 
>     Dec 15 11:40:54 cert systemd[1]: aaa.service: Collecting.
> 
> 
> I report the problem here for SYSTEMD_WANTS, the same happens for
> SYSTEMD_USER_WANTS. I would like to use the latter to run some
> command in my X session when the mouse is added and removed.

This is not how this works.
If you trigger the start of a service via SYSTEMD_WANTS and you want to
execute something when the device is unplugged, you would make the
.service file have a BindsTo/After=$foo.device

Then you can run a ExecStop on removal of the device.
See how ifupdown does it, specifically
/lib/systemd/system/ifup@.service


-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

Attachment: signature.asc
Description: OpenPGP digital signature


--- End Message ---
_______________________________________________
Pkg-systemd-maintainers mailing list
Pkg-systemd-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-systemd-maintainers

Reply via email to