Bug 53337

Summary: ADC still uses SysV init script instead of systemd
Product: UCS Reporter: Philipp Hahn <hahn>
Component: AD ConnectorAssignee: Samba maintainers <samba-maintainers>
Status: NEW --- QA Contact: Samba maintainers <samba-maintainers>
Severity: normal    
Priority: P5 CC: best
Version: UCS 5.0Keywords: systemd
Target Milestone: ---   
Hardware: Other   
OS: Linux   
What kind of report is it?: Development Internal What type of bug is this?: ---
Who will be affected by this bug?: --- How will those affected feel about the bug?: ---
User Pain: Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:
Bug Depends on:    
Bug Blocks: 43691    

Description Philipp Hahn univentionstaff 2021-05-27 10:48:30 CEST
For UCS-5 we switched most services to systemd, but ADC still uses /etc/init.d/univention-ad-connector

services/univention-ad-connector/debian/univention-ad-connector.init
services/univention-ad-connector/scripts/prepare-new-instance
docs/extended-docs/windows-5.0.xml:127
Comment 1 Florian Best univentionstaff 2021-05-27 10:53:20 CEST
(In reply to Philipp Hahn from comment #0)
> For UCS-5 we switched most services to systemd
Not really true. We switched:
univention-directory-listener, univention-directory-notifier, univention-dhcp, univention-network-manager, univention-system-setup.
Missing is still:
univention-docker-container-mode, 
univention-directory-policy
univention-management-console-server
univention-management-console-web-server
univention-demo-configuration
univention-ad-connector
univention-cloud-init
univention-s4-connector
debian/univention-saml
univention-updater.univention-maintenance
univention-firewall
Comment 2 Philipp Hahn univentionstaff 2024-04-29 09:22:34 CEST
0. This needs to be migrated to a "instantiated" services to support multiple configuration, e.g. 'univention-ad-connector@$configbase'; see <man:systemd.service(5)>

1. ADC should only start *IF* it is already configured, e.g. minimum UCRV "${configbase:-connector}/ad/ldap/host" is set

```console
# systemctl status univention-ad-connector
● univention-ad-connector.service - LSB: Univention AD Connector
   Loaded: loaded (/etc/init.d/univention-ad-connector; generated)
   Active: failed (Result: exit-code) since Sun 2024-04-28 16:47:37 CEST; 16h ago
     Docs: man:systemd-sysv-generator(8)
 Main PID: 31780 (code=exited, status=1/FAILURE)

Apr 29 00:38:58 dc20 systemd[1]: /run/systemd/generator.late/univention-ad-connector.service:21: PIDFile= references path below legacy directory /var/run/, updating /var/run/univention-ad-connector → /run/univention-ad-connector; please
Apr 29 00:39:00 dc20 systemd[1]: …
Apr 29 00:39:01 dc20 systemd[1]: …
Apr 29 00:39:03 dc20 systemd[1]: …
Apr 29 00:39:20 dc20 systemd[1]: …
Apr 29 00:39:32 dc20 systemd[1]: …
Apr 29 00:39:36 dc20 systemd[1]: …
Apr 29 00:39:38 dc20 systemd[1]: …
Apr 29 00:39:39 dc20 systemd[1]: …
Apr 29 00:39:41 dc20 systemd[1]: …
```

2. Nit: Change PIDFile from /var/run/ to /run/

3. Missing 'exec ' in '/usr/sbin/univention-ad-connector' to get rid of "Mode=forking"

4. If this is migrated to systemd, /usr/share/univention-ad-connector/scripts/prepare-new-instance must also be adapted; currently is copied files shipped via the Debian package; upgrade path for old copies to new services must be handled!