View Issue Details

IDProjectCategoryView StatusLast Update
0017661CentOS-8systemdpublic2020-08-11 07:45
ReporterYenya 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version8.2.2004 
Target VersionFixed in Version 
Summary0017661: "The unit files have no installation config" even though they do (Also=... line)
DescriptionI want to create a unit file for losetup of a block device image (not a filesystem, so cannot use mount -o loop instead), but systemctl enable complains that the unit file has no installation config. This has probably been already fixed upstream, because in Fedora systemd-245.7-1.fc32.x86_64 the same unit file works.
Steps To Reproduce# cat <<EOF > /lib/systemd/system/loop0.service
[Unit]
Description=Setup loop device
DefaultDependencies=false
Before=local-fs.target
After=systemd-udev-settle.service
Wants=systemd-udev-settle.service

[Service]
Type=oneshot
ExecStart=/usr/sbin/losetup /dev/loop0 /var/lib/drbd0
TimeoutSec=60
RemainAfterExit=yes

[Install]
WantedBy=local-fs.target
Also=systemd-udev-settle.service
EOF

# systemctl daemon-reload
# systemctl enable loop0.service

Expected behaviour:
Created symlink /etc/systemd/system/local-fs.target.wants/loop0.service → /usr/lib/systemd/system/loop0.service.

Observed behaviour:
=====
Created symlink /etc/systemd/system/local-fs.target.wants/loop0.service → /usr/lib/systemd/system/loop0.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:
1) A unit may be statically enabled by being symlinked from another unit's
   .wants/ or .requires/ directory.
2) A unit's purpose may be to act as a helper for some other unit which has
   a requirement dependency on it.
3) A unit may be started when needed via activation (socket, path, timer,
   D-Bus, udev, scripted systemctl call, ...).
4) In case of template units, the unit is meant to be enabled with some
   instance name specified.
=====
Additional InformationThe "systemctl enable" returns exit code 0 and the symlink is created nevertheless.

With the the "Also=..." line in the unit file commented out, systemctl enable works as expected without the error message.
TagsNo tags attached.

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-08-11 07:45 Yenya New Issue