RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1209006 - Possibly dovecot.socket systemd unit needs network.target requirement
Summary: Possibly dovecot.socket systemd unit needs network.target requirement
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: dovecot
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Hlavinka
QA Contact: Frantisek Sumsal
URL:
Whiteboard:
: 1309946 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-04-05 04:11 UTC by George Notaras
Modified: 2016-11-04 07:22 UTC (History)
3 users (show)

Fixed In Version: dovecot-2.2.10-7.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-04 07:22:18 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1309946 0 unspecified CLOSED dovecot fails to start on boot with error: Cannot assign requested address 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2016:2477 0 normal SHIPPED_LIVE dovecot bug fix and enhancement update 2016-11-03 14:08:22 UTC

Internal Links: 1309946

Description George Notaras 2015-04-05 04:11:31 UTC
Description of problem:

I noticed this on CentOS Linux release 7.1.1503 (Core). Thought about submitting a bug report here. I'm sorry of this is the normal procedure.

I was getting these errors in /var/log/maillog after rebooting. Networking uses both IP and IPv6. Both addresses exist in /etc/hosts and resolve to system FQDN.

Apr  5 03:37:33 server1 dovecot: master: Error: bind(NNNN:NNNN:NNNN:NNNN::64, 995) failed: Cannot assign requested address
Apr  5 03:37:33 server1 dovecot: master: Error: service(pop3-login): listen(server1.example.net, 995) failed: Cannot assign requested address
Apr  5 03:37:33 server1 dovecot: master: Error: bind(NNNN:NNNN:NNNN:NNNN::64, 993) failed: Cannot assign requested address
Apr  5 03:37:33 server1 dovecot: master: Error: service(imap-login): listen(server1.example.net, 993) failed: Cannot assign requested address
Apr  5 03:37:33 server1 dovecot: master: Fatal: Failed to start listeners

Adding a file /etc/systemd/system/dovecot.socket with the following contents seems to have resolved the issue:

~~~~~~~~~~~~
.include /usr/lib/systemd/system/dovecot.socket

[Unit]
After=network.target
~~~~~~~~~~~~

Version-Release number of selected component (if applicable):

dovecot-2.2.10-4.el7_0.1.x86_64

Comment 2 George Notaras 2016-02-19 04:22:18 UTC
Please close this bug report. See: 1309946  which contains more up to date information.

Comment 3 Michal Hlavinka 2016-02-19 16:46:44 UTC
(In reply to George Notaras from comment #2)
> Please close this bug report. See: 1309946  which contains more up to date
> information.

If there is an existing bug, always add information there, it's not necessary to file new bug reports

Comment 4 Michal Hlavinka 2016-02-19 16:47:30 UTC
*** Bug 1309946 has been marked as a duplicate of this bug. ***

Comment 5 George Notaras 2016-02-19 19:28:00 UTC
Hi Michal,

> If there is an existing bug, always add information there, it's not necessary to file new bug reports

Please, as mentioned above, I'd greatly appreciate if you kept 1309946 open, as it contains more up to date feedback and information about how to work around the issue in 7.2. This bugtracker does not let assigning multiple product versions to the report. Besides the resolution is different in 7.1 and 7.2. I have not tested if the workaround of 1309946 works in this case.

May I ask why aren't you fixing the problem? It's clearly a problem of the default systemd configuration files that ship with the RPM package. Moreover, it's surprising that you have responded after 10 months for an organizational matter instead of the actual issue.

Kind Regards,
George

Comment 6 George Notaras 2016-02-21 10:50:49 UTC
Hello,

I've got some more feedback about this issue. All readers should bare in mind that the following info is about *7.2*.

Dovecot failed to start with the messages posted at :

https://bugzilla.redhat.com/show_bug.cgi?id=1309946


Workaround:


1. Create a file at /etc/systemd/system/dovecot.service with the following contents:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.include /usr/lib/systemd/system/dovecot.service

[Unit]
After=network-online.target
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


2. In case your dovecot instance is also configured for access over the POP3/POP3S protocol (quite common), create a file at /etc/systemd/system/dovecot.socket with the following contents:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.include /usr/lib/systemd/system/dovecot.socket

[Socket]
ListenStream=0.0.0.0:110
ListenStream=[::]:110
ListenStream=0.0.0.0:995
ListenStream=[::]:995
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


3. Issue the command:

~]# systemctl daemon-reload


4. Make sure both dovecot.service and dovecot.socket unit files are enabled:

~]# systemctl enable dovecot.service
~]# systemctl enable dovecot.socket


5. Reboot and check the status of the dovecot service.


Suggestions:

1. Add ListenStream directives about the POP3/POP3S service in the dovecot.socket unit file.
2. Also add support for sieve service (port 4190 IIRC).


Questions:

1. Why is hard-coding the ports in dovecot.socket file necessary? Maybe this file is not needed at all and all that is required is the addition of 'After=network-online.target' in dovecot.service.


Kind Regards,
George

Comment 7 George Notaras 2016-02-21 10:53:06 UTC
BTW, I haven't tested removing the dovecot.socket unit file.

Comment 8 Michal Hlavinka 2016-02-22 10:58:02 UTC
(In reply to George Notaras from comment #5)
> I'd greatly appreciate if you kept 1309946 open,

there's no reason to have two bugs opened for the same issue, when closing duplicates 99% of time we close the new one, as the old one is usually already in trackers, have customer cases assigned, knowledge base articles assigned, we can see how long has it been opened,...

> as it contains more up to date feedback and information about how to work
> around the issue in 7.2.

if there is an issue reported in 7.1, it is not fixed and the same is in 7.2, they are probably the same

> This bugtracker does not let assigning multiple product versions to the report.

not necessary, as explained above

> May I ask why aren't you fixing the problem? It's clearly a problem of the
> default systemd configuration files that ship with the RPM package.
> Moreover, it's surprising that you have responded after 10 months for an
> organizational matter instead of the actual issue.

We can't fix everything immediately, resources are always limited. We have to prioritize, to fix important issues with big impact first. Fixing a bug is a quite complex process which includes QA, writing automated regression tests so it does not change in future, etc. Priority is usually based on how critical issue something is. This is a configuration issue, not a crash or a data corruption. Also not everyone needs this (in fact most users don't) and it causes slower startup for them. This bugs was reported just by one person, there are no related customer reports and no other people in the cc list which also indicates that it does not bother many people thus this bug has lower priority.

Comment 9 George Notaras 2016-03-09 20:49:07 UTC
Oh, I see, Michal. Thanks for the insight! Also, I'm sorry for any misconception.

With the above workaround I haven't re-encountered the problem when rebooting.

Comment 11 Michal Hlavinka 2016-06-17 15:03:07 UTC
changed: do a proper waitonline with after:network-online.target
this needs fixes for bug #1243958 and bug #1245951 to work properly, especially in ipv6 environment

Comment 12 George Notaras 2016-06-18 06:48:35 UTC
Michal, thank you for posting these pointers. Much appreciated.

There have been some times that every solution gave inconsistent results, so I gave up and just made sure the service was auto restarted on failure. I'll soon try to test it again more thoroughly and report back if I have more feedback.

Thanks again.

Comment 14 Frantisek Sumsal 2016-08-30 14:05:12 UTC
Verified on RHEL 7.3 Beta with dovecot-2.2.10-7.el7.

File /usr/lib/systemd/system/dovecot.service contains lines 
After=local-fs.target network.target network-online.target
and
ExecStartPre=/usr/libexec/dovecot/prestartscript

which should ensure correct dovecot's functionality after system reboot.

Comment 16 errata-xmlrpc 2016-11-04 07:22:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2016-2477.html


Note You need to log in before you can comment on or make changes to this bug.