Bug 43470 - Missing UCR ../autostart for systemd - output not logged to tty
Missing UCR ../autostart for systemd - output not logged to tty
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: General
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.2
Assigned To: Philipp Hahn
Janek Walkenhorst
: interim-3, systemd
Depends on:
Blocks: 43686 43687 43688 43691 43330 43689 43872 43875 43919
  Show dependency treegraph
 
Reported: 2017-02-01 14:51 CET by Erik Damrose
Modified: 2018-09-04 10:50 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.006
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Damrose univentionstaff 2017-02-01 14:51:49 CET
Prior to UCS 4.2, when a service was deactivated with UCR ../autostart=false, one would get a warning message when trying to start such a service: "$service disabled by ucr var $variable=$autostart" (/usr/share/univention-config-registry/init-autostart.lib)

With systemd in UCS 4.2, no message is generated at all if a service is deactivated, one has to check journalctl to see the message.

We could use an exit code !=0 in init-autostart.lib
Comment 1 Philipp Hahn univentionstaff 2017-02-22 12:46:14 CET
/etc/init.d/univention-directory-listener
 /lib/lsb/init-functions
  /lib/lsb/init-functions.d/40-systemd
   /bin/systemctl start $service # <<<<<<<
    /etc/init.d/univention-directory-listener
     /usr/share/univention-config-registry/init-autostart.lib
      echo 'disabled by UCR var'
      exit 0

The problem here is, that the autostart.lib runs as a child of systemd, which catches all output and re-directs it to the journal.

We also need to handle all three cases of autostart:

no = disable completely
 could be mapped to "systemd.unit Condition" or
 systemctl disable $service.service
 systemctl mask $service.service

yes = start/stop by default
 systemctl unmask $service.service
 systemctl enable $service.service

manually = do not start automatically, but only manually
 systemctl disable $service.service
 systemctl unmask $service.service


# systemctl mask cron.service
Created symlink from /etc/systemd/system/cron.service to /dev/null.
# systemctl start cron.service
Failed to start cron.service: Unit cron.service is masked.
# service cron start
Failed to start cron.service: Unit cron.service is masked.
Comment 2 Philipp Hahn univentionstaff 2017-03-14 16:31:47 CET
find \( -name .git -o -name doc -o -name test -o -name \*.py -o -name \*.po  -o -name changelog -o -name Makefile \) -prune -o -type f -exec grep --only '\<[a-z0-9][a-z0-9/-]\+/autostart' {} +

False positives:
 portmap/autostart → rpcbind
 policy/autostart: UDM module
 policies/autostart: UDM module
 usr/share/autostart: directory
 mail/antivir/clamav-daemon/autostart → clamav/daemon/autostart
 mail/antivir/clamav-freshclam/autostart → clamav/freshclam/autostart

Ignore:
 test/**
 nagios/**
 doc/**
 *.po
 *.py

Bugs:
 clamav/freshclam/autostart was not working as it was used nowhere
 mail/antispam/autostart is not used by "spamassassin"
 kdm/autostart was not used by "kdm"
 snmpd/autostart was not used by "snmpd"
 snmptrapd/autostart was not used by "snmptrapd" - it used "/etc/default/snmptrapd" and no longer "/etc/default/snmpd"
Comment 3 Philipp Hahn univentionstaff 2017-03-16 12:16:05 CET
r77803 | Bug #43470 udn: Revert ucs-4.2-0@77762
r77800 | Bug #43470 uvmm: Handle UCRV */autostart through systemd
r77794 | Bug #43470 dansguardian: Handle UCRV */autostart through systemd
r77793 | Bug #43470 dns: Handle UCRV */autostart through systemd
r77792 | Bug #43470 apache: Handle UCRV */autostart through systemd
r77791 | Bug #43470 bacula: Handle UCRV */autostart through systemd
r77790 | Bug #43470 dhcp: Handle UCRV */autostart through systemd
r77789 | Bug #43470 nfs: Handle UCRV */autostart through systemd
r77788 | Bug #43470 print: Handle UCRV */autostart through systemd
r77787 | Bug #43470 radius: Handle UCRV */autostart through systemd
r77786 | Bug #43470 samba: Handle UCRV */autostart through systemd
r77785 | Bug #43470 squid: Handle UCRV */autostart through systemd
r77784 | Bug #43470 umc: Handle UCRV */autostart through systemd
r77783 | Bug #43470 ldap: Handle UCRV */autostart through systemd
r77782 | Bug #43470 udn: Handle UCRV */autostart through systemd
r77781 | Bug #43470 udl: Handle UCRV */autostart through systemd
r77780 | Bug #43470 spamassassin: Handle UCRV */autostart through systemd
r77779 | Bug #43470 postgrey: Handle UCRV */autostart through systemd
r77778 | Bug #43470 dovecot: Handle UCRV */autostart through systemd
r77777 | Bug #43470 postfix: Handle UCRV */autostart through systemd
r77776 | Bug #43470 fetchmail: Handle UCRV */autostart through systemd
r77775 | Bug #43470 av: Handle UCRV */autostart through systemd
r77774 | Bug #43470 psql: Handle UCRV */autostart through systemd
r77773 | Bug #43470 s4c: Handle UCRV */autostart through systemd
r77772 | Bug #43470 adc: Handle UCRV */autostart through systemd
r77771 | Bug #43470 nagios: Handle UCRV */autostart through systemd
r77770 | Bug #43470 kde: Handle UCRV */autostart through systemd
r77769 | Bug #43470 cyrus: Handle UCRV */autostart through systemd
r77768 | Bug #43470 docker: Handle UCRV */autostart through systemd
r77767 | Bug #43470 novnc: Handle UCRV */autostart through systemd
r77766 | Bug #43470 uvmm: Handle UCRV */autostart through systemd
r77765 | Bug #43470 uvmm: Handle UCRV */autostart through systemd [→77800]
r77764 | Bug #43470 snmp: Handle UCRV */autostart through systemd
r77763 | Bug #43470 kerberos: Handle UCRV */autostart through systemd
r77762 | Bug #43470 welcome: Handle UCRV */autostart through systemd [→77803]
r77761 | Bug #43470 mysql: Handle UCRV */autostart through systemd
r77760 | Bug #43470 base: Handle UCRV */autostart through systemd
r77759 | Bug #43470 ucr: Validate univention-service
r77758 | Bug #43470 ucr: Debug regular expressions
r77757 | Bug #43470 base: Infrastructure for systemd UCRV */autostart handling
r77756 | Bug #43470: Fix UTF-8 encoding

Package: univention-base-files
Version: 6.0.0-10A~4.2.0.201703151905

Package: univention-config-registry
Version: 12.0.1-5A~4.2.0.201703151910

Package: univention-heimdal
Version: 10.0.0-5A~4.2.0.201703151912

Package: univention-runit
Version: 8.0.0-7A~4.2.0.201703151914

Package: univention-docker
Version: 2.0.0-5A~4.2.0.201703151915

Package: univention-kdm
Version: 3.0.0-2A~4.2.0.201703151917

Package: univention-antivir-mail
Version: 8.0.0-2A~4.2.0.201703151919

Package: univention-fetchmail
Version: 10.0.0-2A~4.2.0.201703151921

Package: univention-mail-cyrus
Version: 9.0.0-2A~4.2.0.201703151922

Package: univention-mail-dovecot
Version: 3.0.0-3A~4.2.0.201703151924

Package: univention-mail-postfix
Version: 11.0.0-4A~4.2.0.201703151926

Package: univention-postgrey
Version: 5.0.0-2A~4.2.0.201703151927

Package: univention-spamassassin
Version: 8.0.0-2A~4.2.0.201703151929

Package: univention-directory-listener
Version: 11.0.1-25A~4.2.0.201703151931

Package: univention-directory-notifier
Version: 11.0.0-3A~4.2.0.201703151932
Version: 11.0.0-4A~4.2.0.201703160603

Package: univention-ldap
Version: 13.0.5-5A~4.2.0.201703151934

Package: univention-management-console
Version: 9.0.64-1A~4.2.0.201703151936

Package: univention-nagios
Version: 10.0.1-2A~4.2.0.201703151941

Package: univention-ad-connector
Version: 11.0.6-7A~4.2.0.201703151942

Package: univention-apache
Version: 9.0.4-1A~4.2.0.201703151944

Package: univention-bacula
Version: 8.0.0-3A~4.2.0.201703151947

Package: univention-bind
Version: 11.0.0-18A~4.2.0.201703151948

Package: univention-dansguardian
Version: 10.0.0-2A~4.2.0.201703151950

Package: univention-dhcp
Version: 11.0.0-8A~4.2.0.201703151951

Package: univention-mysql
Version: 4.0.0-3A~4.2.0.201703151953

Package: univention-net-installer
Version: 10.0.0-3A~4.2.0.201703151954

Package: univention-nfs
Version: 9.0.0-2A~4.2.0.201703151956

Package: univention-postgresql
Version: 9.0.0-4A~4.2.0.201703151958

Package: univention-printserver
Version: 10.0.1-2A~4.2.0.201703151959

Package: univention-radius
Version: 4.0.0-2A~4.2.0.201703152001

Package: univention-s4-connector
Version: 11.0.6-11A~4.2.0.201703152003

Package: univention-samba
Version: 11.0.1-5A~4.2.0.201703152005

Package: univention-samba4
Version: 6.0.9-8A~4.2.0.201703152007

Package: univention-snmpd
Version: 8.0.0-2A~4.2.0.201703152008

Package: univention-squid
Version: 10.0.0-8A~4.2.0.201703152010

Package: univention-novnc
Version: 1.0.0-5A~4.2.0.201703152012

Package: univention-virtual-machine-manager-node
Version: 5.0.0-6A~4.2.0.201703152036
Comment 4 Janek Walkenhorst univentionstaff 2017-03-19 20:26:29 CET
(In reply to Philipp Hahn from comment #3)
> r77803 | Bug #43470 udn: Revert ucs-4.2-0@77762
OK
> r77800 | Bug #43470 uvmm: Handle UCRV */autostart through systemd
OK
> r77794 | Bug #43470 dansguardian: Handle UCRV */autostart through systemd
OK
> r77793 | Bug #43470 dns: Handle UCRV */autostart through systemd
OK
> r77792 | Bug #43470 apache: Handle UCRV */autostart through systemd
OK, but apache2 has a PIDFile, please add?
> r77791 | Bug #43470 bacula: Handle UCRV */autostart through systemd
OK
> r77790 | Bug #43470 dhcp: Handle UCRV */autostart through systemd
OK
> r77789 | Bug #43470 nfs: Handle UCRV */autostart through systemd
OK
> r77788 | Bug #43470 print: Handle UCRV */autostart through systemd
OK
> r77787 | Bug #43470 radius: Handle UCRV */autostart through systemd
OK
> r77786 | Bug #43470 samba: Handle UCRV */autostart through systemd
OK
> r77785 | Bug #43470 squid: Handle UCRV */autostart through systemd
OK
> r77784 | Bug #43470 umc: Handle UCRV */autostart through systemd
OK
> r77783 | Bug #43470 ldap: Handle UCRV */autostart through systemd
OK
> r77782 | Bug #43470 udn: Handle UCRV */autostart through systemd
OK
> r77781 | Bug #43470 udl: Handle UCRV */autostart through systemd
OK
> r77780 | Bug #43470 spamassassin: Handle UCRV */autostart through systemd
OK
> r77779 | Bug #43470 postgrey: Handle UCRV */autostart through systemd
OK
> r77778 | Bug #43470 dovecot: Handle UCRV */autostart through systemd
OK
> r77777 | Bug #43470 postfix: Handle UCRV */autostart through systemd
OK
> r77776 | Bug #43470 fetchmail: Handle UCRV */autostart through systemd
OK
> r77775 | Bug #43470 av: Handle UCRV */autostart through systemd
OK
> r77774 | Bug #43470 psql: Handle UCRV */autostart through systemd
OK
> r77773 | Bug #43470 s4c: Handle UCRV */autostart through systemd
OK
> r77772 | Bug #43470 adc: Handle UCRV */autostart through systemd
OK
> r77771 | Bug #43470 nagios: Handle UCRV */autostart through systemd
OK
> r77770 | Bug #43470 kde: Handle UCRV */autostart through systemd
OK
> r77769 | Bug #43470 cyrus: Handle UCRV */autostart through systemd
OK
> r77768 | Bug #43470 docker: Handle UCRV */autostart through systemd
OK
> r77767 | Bug #43470 novnc: Handle UCRV */autostart through systemd
OK
> r77766 | Bug #43470 uvmm: Handle UCRV */autostart through systemd
OK
> r77765 | Bug #43470 uvmm: Handle UCRV */autostart through systemd [→77800]
OK
> r77764 | Bug #43470 snmp: Handle UCRV */autostart through systemd
OK
> r77763 | Bug #43470 kerberos: Handle UCRV */autostart through systemd
OK
> r77762 | Bug #43470 welcome: Handle UCRV */autostart through systemd [→77803]
OK
> r77761 | Bug #43470 mysql: Handle UCRV */autostart through systemd
OK
> r77760 | Bug #43470 base: Handle UCRV */autostart through systemd
OK
> r77759 | Bug #43470 ucr: Validate univention-service
OK
> r77758 | Bug #43470 ucr: Debug regular expressions
OK
> r77757 | Bug #43470 base: Infrastructure for systemd UCRV */autostart
> handling
OK
> r77756 | Bug #43470: Fix UTF-8 encoding
OK


Tests: OK
Comment 5 Philipp Hahn univentionstaff 2017-03-20 08:15:32 CET
(In reply to Janek Walkenhorst from comment #4)
> (In reply to Philipp Hahn from comment #3)
> > r77792 | Bug #43470 apache: Handle UCRV */autostart through systemd
> OK, but apache2 has a PIDFile, please add?

This bug is about adding systemd.service information to the .univention-service files for UCRV autostart to work again.
Adding the "# pidfile: " annotation to init files is Bug #43874 - and there I only touched the UCS source code, not all those patches Debian packages. The addition of autostart to Apache and merge or UCS specific patches was done through Bug #41929. So either re-open that bug and ask for adding pidfile there for proper systemd integration, or open a new bug the review those autostart patches again and to add the pidfile annotation too.
Comment 6 Janek Walkenhorst univentionstaff 2017-03-20 12:01:15 CET
(In reply to Philipp Hahn from comment #5)
> (In reply to Janek Walkenhorst from comment #4)
> > (In reply to Philipp Hahn from comment #3)
> > > r77792 | Bug #43470 apache: Handle UCRV */autostart through systemd
> > OK, but apache2 has a PIDFile, please add?
> 
> This bug is about adding systemd.service information to the
> .univention-service files for UCRV autostart to work again.
> Adding the "# pidfile: " annotation to init files is Bug #43874 - and there
> I only touched the UCS source code, not all those patches Debian packages.
OK

Changelog: OK
Comment 7 Stefan Gohmann univentionstaff 2017-04-04 18:29:13 CEST
UCS 4.2 has been released:
 https://docs.software-univention.de/release-notes-4.2-0-en.html
 https://docs.software-univention.de/release-notes-4.2-0-de.html

If this error occurs again, please use "Clone This Bug".