Bug#1004217: /bin/systemctl: Cannot enable units where the Install section is in a truncated override file

Adam Dinwoodie debian-reportbug at post.dinwoodie.org
Sat Jan 22 23:04:58 GMT 2022


Package: systemd
Version: 249.7-1+rpi1
Severity: normal
File: /bin/systemctl

Dear Maintainer,

If one creates a unit with a name like `test-test.service`, one can put
override files in the drop-in directory with the truncated name
`test-.service.d`, and have them be picked up by systemd, at least for
the most part.  However, it appears that `systemctl enable` does not
respect these files.

See the below simple test case, with a unit file and override file:

```
$ systemctl --user cat test-test.service
# /home/test/.config/systemd/user/test-test.service
[Service]
ExecStart=sleep 5000d

# /home/test/.config/systemd/user/test-.service.d/override.conf
[Install]
WantedBy=default.target

$ systemctl --user status test-test.service
○ test-test.service
     Loaded: loaded (/home/test/.config/systemd/user/test-test.service; static)
    Drop-In: /home/test/.config/systemd/user/test-.service.d
             └─override.conf
     Active: inactive (dead)

$ systemctl --user enable test-test.service
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.

Possible reasons for having this kind of units are: <trimmed...>
```

Clearly `systemctl cat` was able to locate the override file above, and
therefore I had expected `systemctl enable` to take note of the override
file's [Install] section.  That would mean that `systemctl enable` would
actually create a symlink from default.target.wants/test-test.service to
test-test.service.

At the very least, if this were expected behaviour (and it doesn't seem
grossly unreasonable; I know I was doing something unusual to hit
this!), I would have expected to see it mentioned in the paragraph about
drop-in directories, and/or the section on "[Install] Section Options"
in the systemd.unit(5) man page.

Kind regards,

Adam

-- Package-specific info:

-- System Information:
Distributor ID:	Raspbian
Description:	Raspbian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye
Architecture: armv7l

Kernel: Linux 5.10.92-v7l+ (SMP w/4 CPU threads)
Kernel taint flags: TAINT_CRAP
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages systemd depends on:
ii  adduser          3.118
ii  libacl1          2.2.53-10
ii  libapparmor1     2.13.6-10
ii  libaudit1        1:3.0-2
ii  libblkid1        2.36.1-8
ii  libc6            2.32-4+rpi1
ii  libcap2          1:2.44-1
ii  libcrypt1        1:4.4.18-4
ii  libcryptsetup12  2:2.4.3-1
ii  libgcrypt20      1.9.4-5
ii  libgnutls30      3.7.2-5
ii  libgpg-error0    1.38-2
ii  libip4tc2        1.8.7-1
ii  libkmod2         28-1
ii  liblz4-1         1.9.3-2
ii  liblzma5         5.2.5-2
ii  libmount1        2.36.1-8
ii  libpam0g         1.4.0-9+deb11u1
ii  libseccomp2      2.5.1-1+rpi1+deb11u1
ii  libselinux1      3.1-3
ii  libsystemd0      249.7-1+rpi1
ii  libzstd1         1.4.8+dfsg-2.1+rpi1
ii  mount            2.36.1-8
ii  util-linux       2.36.1-8

Versions of packages systemd recommends:
ii  dbus [default-dbus-system-bus]   1.12.20-2
ii  systemd-timesyncd [time-daemon]  249.7-1+rpi1

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

Versions of packages systemd is related to:
pn  dracut           <none>
ii  initramfs-tools  0.140
ii  libnss-systemd   249.7-1+rpi1
ii  libpam-systemd   249.7-1+rpi1
ii  udev             247.3-6+rpi1

-- no debconf information


More information about the Pkg-systemd-maintainers mailing list