Bug 1478335

Summary: rhel-dmesg service always enabled even after systemctl disable rhel-dmesg.service
Product: Red Hat Enterprise Linux 7 Reporter: masanari iida <masanari.iida>
Component: initscriptsAssignee: David Kaspar // Dee'Kej <deekej>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: low Docs Contact:
Priority: unspecified    
Version: 7.4CC: deekej, initscripts-maint-list
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-23 15:10:16 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:
Embargoed:

Description masanari iida 2017-08-04 10:54:39 UTC
Description of problem:
rhel-dmesg service always enabled even after systemctl disable 
rhel-dmesg.service

[root@kc0005 basic.target.wants]# systemctl status rhel-dmesg.service
* rhel-dmesg.service - Dump dmesg to /var/log/dmesg
   Loaded: loaded (/usr/lib/systemd/system/rhel-dmesg.service; disabled; vendor preset: disabled) <== disabled status
   Active: active (exited) since Thu 2017-08-03 10:33:01 JST; 1 day 9h ago
  Process: 1034 ExecStart=/usr/lib/systemd/rhel-dmesg (code=exited, status=0/SUCCESS)
 Main PID: 1034 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/rhel-dmesg.service

Version-Release number of selected component (if applicable):
initscripts-9.49.37-1.el7_3.1.x86_64

How reproducible:
Always

Steps to Reproduce:
1. systemctl disable rhel-dmesg.service 
2. Reboot the system

Actual results:
rhel-dmesg.service always started. And generate dmesg log under /var/log.

Expected result.
One can enable/disable rhel-dmesg.service using systemctl.

Additional info:
My understanding is that this symptom happen because
the initscripts RPM install symlink when the RPM install files.
But it is not the way how to "enable" the unit by default with systemd.

man systemd.preset

DESCRIPTION
       Preset files may be used to encode policy which units shall be enabled
       by default and which ones shall be disabled. 

I think the initscript packager should make use of this method.

Workaround:
Remove symlink under /usr/lib/systemd/system/basic.target.wants
And systemctl enable rhel-dmesg, then the system writes dmesg in /var/log.
And systemctl disable rhel-dmesg, then the system stop output dmesg in /var/log.

Background:
One customer asked HPE that why rhel-dmesg output the logs even it
has "disabled" status.
The I troubleshoot and found the reason.

I know that current method (provide the symlink by initscript RPM) 
does the job.
But I think it doesn't follow the rule under systemd.
That's why the customer could not stop the service.

Severity: low

Comment 2 David Kaspar // Dee'Kej 2017-08-23 15:10:16 UTC
Hello Masanari,

I'm closing this as a duplicate. If needed, please follow up in the former BZ.

Best regards,

David

*** This bug has been marked as a duplicate of bug 1395391 ***