Bug#1021348: exim4-base: race in system boot causes exim4 to fail starting automatically

2022-10-09 Thread Andreas Metzler
On 2022-10-06 Giacomo Mulas  wrote:
> Package: exim4-base
> Version: 4.96-4
> Severity: normal

> Dear Maintainer,

> Since several months now I noticed that exim4.service fails to start 
> at boot when I am at work.

> If I run

> systemctl status exim4

> I get:

[...]
> ott 06 12:43:29 capitanata exim4[4169]: 2022-10-06 12:43:29 Exim 
> configuration error in line 508 of /var/lib/exim4/config.autogenerated.tmp:
> ott 06 12:43:29 capitanata exim4[4169]:   Unexpected end of configuration 
> file: .endif missing
> ott 06 12:43:29 capitanata exim4[4245]: Invalid new configfile 
> /var/lib/exim4/config.autogenerated.tmp, not installing
[...]
> Exim4 invariably starts without a hitch if I manually issue a

> systemctl start exim4

> after boot.
[...]


Hello,

this is pretty strange since /usr/sbin/update-exim4 does not rely on
dynamic data. Is your configuration data valid?
/usr/sbin/update-exim4.conf -v --output  /tmp/testme
/usr/sbin/exim4 -bV -C /tmp/testme

cu Andreas



Bug#1021348: exim4-base: race in system boot causes exim4 to fail starting automatically

2022-10-06 Thread Giacomo Mulas
Package: exim4-base
Version: 4.96-4
Severity: normal

Dear Maintainer,

Since several months now I noticed that exim4.service fails to start 
at boot when I am at work.

If I run

systemctl status exim4

I get:

exim4.service - LSB: exim Mail Transport Agent
 Loaded: loaded (/etc/init.d/exim4; generated)
 Active: failed (Result: exit-code) since Thu 2022-10-06 12:43:29 CEST; 
1min 10s ago
   Docs: man:systemd-sysv-generator(8)
Process: 2777 ExecStart=/etc/init.d/exim4 start (code=exited, 
status=1/FAILURE)
CPU: 238ms

ott 06 12:43:29 capitanata systemd[1]: Starting LSB: exim Mail Transport 
Agent...
ott 06 12:43:29 capitanata exim4[2777]: Starting MTA:
ott 06 12:43:29 capitanata exim4[4169]: 2022-10-06 12:43:29 Exim configuration 
error in line 508 of /var/lib/exim4/config.autogenerated.tmp:
ott 06 12:43:29 capitanata exim4[4169]:   Unexpected end of configuration file: 
.endif missing
ott 06 12:43:29 capitanata exim4[4245]: Invalid new configfile 
/var/lib/exim4/config.autogenerated.tmp, not installing
ott 06 12:43:29 capitanata exim4[4245]: /var/lib/exim4/config.autogenerated.tmp 
to /var/lib/exim4/config.autogenerated
ott 06 12:43:29 capitanata systemd[1]: exim4.service: Control process exited, 
code=exited, status=1/FAILURE
ott 06 12:43:29 capitanata systemd[1]: exim4.service: Failed with result 
'exit-code'.
ott 06 12:43:29 capitanata systemd[1]: Failed to start LSB: exim Mail Transport 
Agent.
ott 06 12:43:29 capitanata systemd[1]: exim4.service: Unit cannot be reloaded 
because it is inactive.

This does _not_ occur if I boot up my laptop with wifi disabled, or at home.
My guess is that exim4 at work tries to start when the laptop already 
successfully associated to the access point, but it did not yet get an
IP address assigned by the DHCP server (somewhat slow). In turn, this causes
some problem with the autogeneration of the total config file from all the 
configuration fragments, resulting in an invalid config and hence failure 
to start. Exim4 invariably starts without a hitch if I manually issue a

systemctl start exim4

after boot.

This is somewhat a problem, since it may result in a system in which email
is not working without the user(s) realising that.

I guess a simple workaround might be to just add some delay before
attempting to start exim4. Or adding some dependency that makes sure
that the construction of the total config file is done when the system is
either properly connected or disconnected from the net, but not in the
middle of connecting. Of course, I'm willing to help finding out the
precise concatenation of causes that makes this happen, and/or testing 
solutions.

Thanks, best regards
Giacomo Mulas

-- Package-specific info:
Exim version 4.96 #2 built 11-Sep-2022 11:38:26
Copyright (c) University of Cambridge, 1995 - 2018
(c) The Exim Maintainers and contributors in ACKNOWLEDGMENTS file, 2007 - 2022
Berkeley DB: Berkeley DB 5.3.28: (September  9, 2013)
Support for: crypteq iconv() IPv6 PAM Perl Expand_dlfunc GnuTLS TLS_resume 
move_frozen_messages Content_Scanning DANE DKIM DNSSEC Event I18N OCSP 
PIPECONNECT PRDR PROXY Queue_Ramp SOCKS SPF SRS TCP_Fast_Open
Lookups (built-in): lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmjz 
dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql sqlite
Authenticators: cram_md5 cyrus_sasl dovecot external plaintext spa tls
Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Malware: f-protd f-prot6d drweb fsecure sophie clamd avast sock cmdline
Fixed never_users: 0
Configure owner: 0:0
Size of off_t: 8
Configuration file search path is 
/etc/exim4/exim4.conf:/var/lib/exim4/config.autogenerated
Configuration file is /var/lib/exim4/config.autogenerated
# /etc/exim4/update-exim4.conf.conf
#
# Edit this file and /etc/mailname by hand and execute update-exim4.conf
# yourself or use 'dpkg-reconfigure exim4-config'
#
# Please note that this is _not_ a dpkg-conffile and that automatic changes
# to this file might happen. The code handling this will honor your local
# changes, so this is usually fine, but will break local schemes that mess
# around with multiple versions of the file.
#
# update-exim4.conf uses this file to determine variable values to generate
# exim configuration macros for the configuration file.
#
# Most settings found in here do have corresponding questions in the
# Debconf configuration, but not all of them.
#
# This is a Debian specific file

dc_eximconfig_configtype='smarthost'
dc_other_hostnames='capitanata.oa-cagliari.inaf.it:capitanata.ca.astro.it'
dc_local_interfaces=''
dc_readhost=''
dc_relay_domains=''
dc_minimaldns='true'
dc_relay_nets=''
dc_smarthost='smtp.gmail.com::587'
CFILEMODE='644'
dc_use_split_config='true'
dc_hide_mailname='false'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'
mailname:capitanata.oa-cagliari.inaf.it
# /etc/default/exim4
EX4DEF_VERSION=''

#