Bug 1373950

Summary: systemctl preset prints extraneous message
Product: Red Hat Enterprise Linux 7 Reporter: Michal Sekletar <msekleta>
Component: systemdAssignee: systemd-maint
Status: CLOSED ERRATA QA Contact: Frantisek Sumsal <fsumsal>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.3CC: fdeutsch, fsumsal, ovasik, systemd-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: systemd-219-30.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 00:56:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Michal Sekletar 2016-09-07 13:51:51 UTC
Description of problem:
If systemctl preset is called on unit file that is disabled and its default preset state state is also disabled, then systemd will not alter current unit file state, but systemctl prints following 

The unit files have no [Install] section. 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, ...).

Version-Release number of selected component (if applicable):
systemd-219-27.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. yum install rsync (should provide /usr/lib/systemd/system/rsyncd.service)

2. systemctl daemon-reload

3. systemctl show -p UnitFileState,UnitFilePreset rsyncd.service

UnitFileState=disabled
UnitFilePreset=disabled

4. systemctl preset rsyncd.service

Actual results:
systemctl prints,

The unit files have no [Install] section. 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, ...).


Expected results:
No action is taken by systemd and systemctl prints no message and returns with exit code 0.

Additional info:
This is already fixed upstream,

https://github.com/systemd/systemd/commit/39207373dd638e548019ddb49929f15795b8b404

Comment 4 Frantisek Sumsal 2016-09-21 11:07:07 UTC
Verified with systemd-219-30.el7.

Old package:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: systemctl preset without [Install] section
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [  BEGIN   ] :: Running 'systemctl daemon-reload'
:: [   PASS   ] :: Command 'systemctl daemon-reload' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'systemctl preset rsyncd.service'
The unit files have no [Install] section. 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, ...).
:: [   PASS   ] :: Command 'systemctl preset rsyncd.service' (Expected 0, got 0)
:: [  BEGIN   ] :: Running '[[ -r /var/tmp/tmp.MFt51eAMlo && ! -s /var/tmp/tmp.MFt51eAMlo ]]'
:: [   FAIL   ] :: Command '[[ -r /var/tmp/tmp.MFt51eAMlo && ! -s /var/tmp/tmp.MFt51eAMlo ]]' (Expected 0, got 1)

New package:
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: [   LOG    ] :: systemctl preset without [Install] section
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [  BEGIN   ] :: Running 'systemctl daemon-reload'
:: [   PASS   ] :: Command 'systemctl daemon-reload' (Expected 0, got 0)
:: [  BEGIN   ] :: Running 'systemctl preset rsyncd.service'
:: [   PASS   ] :: Command 'systemctl preset rsyncd.service' (Expected 0, got 0)
:: [  BEGIN   ] :: Running '[[ -r /var/tmp/tmp.jizxInWtIb && ! -s /var/tmp/tmp.jizxInWtIb ]]'
:: [   PASS   ] :: Command '[[ -r /var/tmp/tmp.jizxInWtIb && ! -s /var/tmp/tmp.jizxInWtIb ]]' (Expected 0, got 0)

Comment 6 errata-xmlrpc 2016-11-04 00:56:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2216.html