Bug 1012047

Summary: start on boot is not ticked in yast-dns-server
Product: [openSUSE] openSUSE Tumbleweed Reporter: Petr Matula <petr.m>
Component: YaST2Assignee: Stefan Schubert <schubi>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P5 - None CC: christos.varelas, conde.philippe, filip, igonzalezsosa, jpupava, junguo.wang, kanderssen, lchiquitto, maintenance, schubi
Version: Current   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://trello.com/c/oOIBL9bk/
Whiteboard:
Found By: --- Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: y2log file

Description Petr Matula 2016-11-24 09:34:23 UTC
start on boot is not ticked in yast-dns-server if i've ticked it and named started on boot
Comment 1 Imobach Gonzalez Sosa 2016-11-24 15:08:42 UTC
*** Bug 1007010 has been marked as a duplicate of this bug. ***
Comment 2 Imobach Gonzalez Sosa 2016-11-24 15:34:00 UTC
It looks like the problem is no in YaST at all. Typing "systemctl status named" returns this information:

● named.service - LSB: Domain Name System (DNS) server, named
   Loaded: loaded (/etc/init.d/named; bad; vendor preset: disabled)
   Active: inactive (dead) since Thu 2016-11-24 16:22:39 CET; 8min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 2431 ExecStop=/etc/init.d/named stop (code=exited, status=0/SUCCESS)
  Process: 1680 ExecStart=/etc/init.d/named start (code=exited, status=0/SUCCESS)

Nov 24 16:22:39 linux-crtk named[1727]: shutting down: flushing changes
Nov 24 16:22:39 linux-crtk named[1727]: stopping command channel on 127.0.0.1#953
Nov 24 16:22:39 linux-crtk named[1727]: stopping command channel on ::1#953
Nov 24 16:22:39 linux-crtk named[1727]: no longer listening on ::#53
Nov 24 16:22:39 linux-crtk named[1727]: no longer listening on 127.0.0.1#53
Nov 24 16:22:39 linux-crtk named[1727]: no longer listening on 192.168.122.63#53
Nov 24 16:22:39 linux-crtk named[1727]: exiting
Nov 24 16:22:39 linux-crtk named[2431]: Shutting down name server BIND ..done
Nov 24 16:22:39 linux-crtk systemd[1]: Stopped LSB: Domain Name System (DNS) server, named.
Nov 24 16:23:26 linux-crtk systemd[1]: Stopped LSB: Domain Name System (DNS) server, named.

Pay attention to this line: "loaded (/etc/init.d/named; bad; vendor preset: disabled)". So instead of "enabled" or "disabled", we get a "bad".

"named" is not a systemd service at all (it lives in /etc/init.d/named) and it's handled through some kind of integration. So I'm reassigning the bug to systemd maintainers.

Please, could you have a look?
Comment 3 Filip Kołodziejczyk 2016-12-08 14:58:46 UTC
This also happens on Leap 42.2
Comment 4 Franck Bui 2017-01-05 10:27:00 UTC
(In reply to Imobach Gonzalez Sosa from comment #2)
> 
> Pay attention to this line: "loaded (/etc/init.d/named; bad; vendor preset:
> disabled)". So instead of "enabled" or "disabled", we get a "bad".
> 

That's indeed a shortcoming that has been fixed by upstream commit a3c4eb07106b29, which is included in v230+.

This means that the pending systemd update (v232) for factory will "fix" the description of the unit state ("bad"). But the change won't fix this particular bug, see below.

@Imobach, it seems that yast is parsing the output and of "systemctl status" and expect to either find "enabled" or "disabled". If it's the case, this doesn't sound correct as:

 1. there's no guaranty that the output of "systemctl status" will be stable.
    For example with v232 (which has the "fix") you'll see "generated"
    (instead of "bad").

 2. systemd provides a real (D-BUS) API to query the state of a unit file.

 3. if 2. is not an option you still might rely on "systemctl is-enabled", which
    seems more appropriate and has at least a well defined behavior.

So IMHO, a better fix would be to change yast to do the right thing.

WDYT ?
Comment 5 Philippe Condé 2017-01-08 08:39:44 UTC
Hello,

not sure if this problem is related
I try to update a zone definiton via Yast. I add a A record in the zone:
When I save it and try applying chnage nothingoccurs in the zone ( dat doesnt change for the zone definito and the reverse wone in /var/lib/named/dyn/)

Seems that all updates are ignored by Yast not only the start on boot
My system
Tumbleweed current
only one zone defined ( only internal use)
ouput of:  systemctl status named
   named.service - LSB: Domain Name System (DNS) server, named
   Loaded: loaded (/etc/init.d/named; bad; vendor preset: disabled)
   Active: active (running) since Sun 2017-01-08 09:14:09 CET; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 7057 ExecReload=/etc/init.d/named reload (code=exited, status=0/SUCCESS)
    Tasks: 15 (limit: 512)
   CGroup: /system.slice/named.service
           └─5849 /usr/sbin/named -t /var/lib/named -u named

Jan 08 09:16:29 hpprol2 named[6656]: ..done
Jan 08 09:16:29 hpprol2 systemd[1]: Reloaded LSB: Domain Name System (DNS) server, named.
Jan 08 09:16:34 hpprol2 systemd[1]: Reloading LSB: Domain Name System (DNS) server, named.
Jan 08 09:16:34 hpprol2 named[6753]: Reloading name server BIND server reload successful
Jan 08 09:16:34 hpprol2 named[6753]: ..done
Jan 08 09:16:34 hpprol2 systemd[1]: Reloaded LSB: Domain Name System (DNS) server, named.
Jan 08 09:16:37 hpprol2 systemd[1]: Reloading LSB: Domain Name System (DNS) server, named.
Jan 08 09:16:38 hpprol2 named[7057]: Reloading name server BIND server reload successful
Jan 08 09:16:38 hpprol2 named[7057]: ..done
Jan 08 09:16:38 hpprol2 systemd[1]: Reloaded LSB: Domain Name System (DNS) server, named.

Using webmin allowed doing the change in the zone
Regards
Philippe
Comment 6 Imobach Gonzalez Sosa 2017-01-09 15:14:23 UTC
I think both problems are not related.

@Philippe, please, could you open a new bug report attaching logs (using save_y2logs)? Thanks in advance!

@Franck you're right. We have a similar problem in bug 1017166 because we don't handle the "indirect" value properly.

So I'm moving this bug report to our SCRUM incoming board so we can plan for it. Thanks!
Comment 7 Stefan Schubert 2017-01-24 12:57:27 UTC
A fix is in review:
https://github.com/yast/yast-services-manager/pull/117/files
Maint. team would you like to have a maint. update ?
Comment 8 Benjamin Brunner 2017-01-24 13:12:02 UTC
yast2-services-manager for Leap 42.2 is inherited from SUSE:SLE-12-SP2:Update (see openSUSE:Leap:42.2:Update 00Meta lookup.yml).

This means that we need to start an update for SLE and Leap would automatically receive the fix after the SLE-update is released.

Stefan, could you create a maintenancerequest for SUSE:SLE-12-SP2:Update please?
Comment 9 Stefan Schubert 2017-01-25 08:50:22 UTC
I have tested the interaction between the two YaST modules (service, dns-server) and has worked well. the "named" service has been shown/set correctly in the service and dns-server module.
Fix has been submitted.
https://build.suse.de/request/show/127038
Comment 10 Christos Varelas 2017-03-07 16:18:38 UTC
Hello everyone,
The bug still looks unresolved to me. Here's what I've done trying to reproduce it:

* On a refhost (sles12sp2-x86_64) with the maintenance update applied, I installed bind:

chakotay:~ # zypper -n in bind

* Then I checked if named is enabled:

chakotay:~ # systemctl is-enabled named
named.service is not a native service, redirecting to systemd-sysv-install
Executing /usr/lib/systemd/systemd-sysv-install is-enabled named
disabled

As expected, it was disabled.

* I started YaST2 Services Manager:

chakotay:~ # yast2 services-manager

* Looked for named service and confirmed that it appeared as disabled.

* I clicked on the [Enable/Disable] button to enable the named service,
then clicked on [OK] to apply the change and quit YaST2 Services Manager.

* Checked if named was enabled:

chakotay:~ # systemctl is-enabled named
named.service is not a native service, redirecting to systemd-sysv-install
Executing /usr/lib/systemd/systemd-sysv-install is-enabled named
enabled

As expected, the service was enabled.

* Started YaST2 Services Manager (again):

chakotay:~ # yast2 services-manager

* I looked for named service and checked if it appeared as enabled or disabled.
I realized that it still appeared as disabled.

Seems to me that YaST still parses the output of "systemctl status something" 
and expects to find either "enabled" or "disabled". In the case of named we
have neither "enabled" nor "disabled":

chakotay:~ # systemctl status named
● named.service - LSB: Domain Name System (DNS) server, named
   Loaded: loaded (/etc/init.d/named; bad; vendor preset: disabled)
   Active: inactive (dead) since þri 2017-03-07 15:36:46 CET; 51min ago
   Docs: man:systemd-sysv-generator(8)

So, YaST still concludes that the service is _not_ enabled, while in reality it actually is.
Comment 11 Leonardo Chiquitto 2017-03-15 12:14:23 UTC
Confirmed not fixed by the update. Both the Services Manager and the DNS Server modules still think named.service is disabled.

Can someone please take a look?
Comment 12 Stefan Schubert 2017-03-15 12:49:45 UTC
Which version of yast2-services-manager have you installed ?
Could you please add the y2logs.
Are you using TW/SLES/..... ?
Comment 13 Leonardo Chiquitto 2017-03-15 12:57:14 UTC
SLES 12-SP2 system with all updates applied plus the yast2-services-manager update candidate that's currently in SUSE:Maintenance:4062.

Feel free to use d282.qam.suse.de (root, standard R&D password) for testing.
Comment 14 Christos Varelas 2017-03-15 13:17:19 UTC
Created attachment 717538 [details]
y2log file
Comment 15 Christos Varelas 2017-03-15 13:18:07 UTC
(In reply to Stefan Schubert from comment #12)
> Which version of yast2-services-manager have you installed ?
> Could you please add the y2logs.
> Are you using TW/SLES/..... ?

I tested on SLES 12 SP2 (chakotay.qam.suse.de), having installed the maintenance update version of yast2-services-manager (3.1.44-5.6.1, http://download.suse.de/ibs/SUSE/Updates/SLE-SERVER/12-SP2/x86_64/update/noarch/yast2-services-manager-3.1.43-6.1.noarch.rpm)

Please, find attached the y2log also.
Comment 16 Stefan Schubert 2017-03-15 15:30:25 UTC
Yes, I can reproduce it. Evaluation of enabling state will be done in two steps:

- checking UnitFileState for enable/disable
- If it is empty "systemctl is-enabled...." will be called.

Unfortunately named and appamor service have an error there and the default
value "disabled" will be taken:

d282:/usr/share/YaST2 # systemctl show named.service  --property=Id  --property=MainPID  --property=Description  --property=LoadState  --property=ActiveState  --property=SubState  --property=UnitFileState  --property=FragmentPath 
MainPID=0
Id=named.service
Description=LSB: Domain Name System (DNS) server, named
LoadState=loaded
ActiveState=active
SubState=running
FragmentPath=/run/systemd/generator.late/named.service
UnitFileState=bad

d282:/usr/share/YaST2 # systemctl is-enabled named.service
named.service is not a native service, redirecting to systemd-sysv-install
Executing /usr/lib/systemd/systemd-sysv-install is-enabled named
enabled

My test machines (TW) are returning empty "UnitFileState" entries. That's why I have not seen this error.

So
Comment 17 Stefan Schubert 2017-03-16 13:50:37 UTC
The fix is in review:
https://github.com/yast/yast-yast2/pull/550/files
Comment 18 Stefan Schubert 2017-03-16 15:21:56 UTC
Merged to SLES12-SP2:
package yast2 3.1.214

Thanks for the running test machine. Otherwise I would have not been able
to find the bug :-)
Comment 19 Leonardo Chiquitto 2017-04-21 08:03:03 UTC
Resubmitted to QA now that the yast2 update is released.
Comment 20 Swamp Workflow Management 2017-04-21 13:09:10 UTC
SUSE-RU-2017:1083-1: An update that has four recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1012047,1017716,1027582,1028721
CVE References: 
Sources used:
SUSE Linux Enterprise Server for Raspberry Pi 12-SP2 (src):    yast2-3.1.215-37.14.1, yast2-http-server-3.1.8-6.3.3
SUSE Linux Enterprise Server 12-SP2 (src):    yast2-3.1.215-37.14.1, yast2-http-server-3.1.8-6.3.3
SUSE Linux Enterprise Desktop 12-SP2 (src):    yast2-3.1.215-37.14.1
Comment 22 Stefan Schubert 2017-04-25 14:07:52 UTC
May be you also need a new yast-yast2 package:

-------------------------------------------------------------------
Thu Mar 16 13:48:06 CET 2017 - schubi@suse.de

- UnitFileState will be used for evaluating enable state of
  services. If it has an invalid value "systemctl is-enabled...."
  has to be called instead. (bnc#1012047)
- 3.2.17
Comment 23 Leonardo Chiquitto 2017-04-25 14:53:28 UTC
For 12-SP2 this would be:

* Thu Mar 16 2017 schubi@suse.de
- UnitFileState will be used for evaluating enable state of
  services. If it has an invalid value "systemctl is-enabled...."
  has to be called instead. (bnc#1012047)
- 3.1.214

Jun, please confirm the ref host is up-to-date.
Comment 24 jun wang 2017-04-26 02:57:26 UTC
(In reply to Leonardo Chiquitto from comment #23)
> For 12-SP2 this would be:
> 
> * Thu Mar 16 2017 schubi@suse.de
> - UnitFileState will be used for evaluating enable state of
>   services. If it has an invalid value "systemctl is-enabled...."
>   has to be called instead. (bnc#1012047)
> - 3.1.214
> 
> Jun, please confirm the ref host is up-to-date.

yes, you are right.
all works well after updating all packages.
Comment 25 Swamp Workflow Management 2017-04-28 10:11:06 UTC
SUSE-RU-2017:1123-1: An update that has three recommended fixes can now be installed.

Category: recommended (low)
Bug References: 1012047,1017166,956043
CVE References: 
Sources used:
SUSE Linux Enterprise Server for Raspberry Pi 12-SP2 (src):    yast2-services-manager-3.1.44-5.6.12
SUSE Linux Enterprise Server 12-SP2 (src):    yast2-services-manager-3.1.44-5.6.12
SUSE Linux Enterprise Desktop 12-SP2 (src):    yast2-services-manager-3.1.44-5.6.12
Comment 26 Swamp Workflow Management 2017-04-28 16:09:59 UTC
openSUSE-RU-2017:1126-1: An update that has four recommended fixes can now be installed.

Category: recommended (moderate)
Bug References: 1012047,1017716,1027582,1028721
CVE References: 
Sources used:
openSUSE Leap 42.2 (src):    yast2-3.1.215-5.3.1, yast2-http-server-3.1.8-2.3.1
Comment 27 Swamp Workflow Management 2017-05-08 16:15:04 UTC
openSUSE-RU-2017:1202-1: An update that has three recommended fixes can now be installed.

Category: recommended (low)
Bug References: 1012047,1017166,956043
CVE References: 
Sources used:
openSUSE Leap 42.2 (src):    yast2-services-manager-3.1.44-20.3.1