Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] postfix fails at default level, starts OK later
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
urcindalo
l33t
l33t


Joined: 08 Feb 2005
Posts: 623
Location: Almeria, Spain

PostPosted: Mon Dec 03, 2012 3:55 pm    Post subject: [SOLVED] postfix fails at default level, starts OK later Reply with quote

Hi and thanks for reading this.

I have this problem with postfix on my laptop. It fails to start at boot time (default level):
Code:
* Starting postfix  ...        [!!]
* ERROR: postfix failed to start

However, it is able to start once I login into the DE:
Code:
# /etc/init.d/postfix start
* Starting postfix  ...         [ ok ]


Why is that? I'm completely clueless.
Any help is greatly appreciated.


Last edited by urcindalo on Tue Dec 04, 2012 10:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
py-ro
Veteran
Veteran


Joined: 24 Sep 2002
Posts: 1734
Location: Velbert

PostPosted: Mon Dec 03, 2012 5:26 pm    Post subject: Reply with quote

Look into your postfix logs, they are pretty useful. You can us provide this information, too.
Back to top
View user's profile Send private message
urcindalo
l33t
l33t


Joined: 08 Feb 2005
Posts: 623
Location: Almeria, Spain

PostPosted: Tue Dec 04, 2012 3:58 pm    Post subject: Reply with quote

Thanks for your help.

These are the results found in /var/log/messages:
Code:
log # cat messages | grep postfix
...
Dec  4 16:37:26 localhost postfix[3799]: fatal: parameter inet_interfaces: no local interface found for 192.168.1.40
Dec  4 16:37:27 localhost /etc/init.d/postfix[3791]: ERROR: postfix failed to start


The parameter inet_interfaces is defined in /etc/postfix/main.cf this way:
Code:
inet_interfaces = $myhostname, localhost


192.168.1.40 is the IP address the router assigns to my box based on its MAC address. As a side note, NetworkManager connects wirelessly to the router before my user logs into KDE. This is the booting info after starting NetworkManager as a default level service:
Code:
 * Starting NetworkManager ...                                                       [ ok ]
Connecting...............    1s
 * Marking NetworkManager as inactive. It will automatically be marked
 * as started after a network connection has been established.
 * WARNING: NetworkManager has started, but is inactive
 * Starting syslog-ng ...                                                            [ ok ]
 * Starting acpid ...                                                                [ ok ]
 * Starting ConsoleKit daemon ...                                                    [ ok ]
 * WARNING: netmount is scheduled to start when NetworkManager has started
 * Starting gpm ...                                                                  [ ok ]
 * Setting up kdm ...                                                                [ ok ]
 * Running anacron ...                                                               [ ok ]
 * Starting cupsd ...                                                                [ ok ]
 * Starting laptop_mode ...                                                          [ ok ]
 * WARNING: noip is scheduled to start when NetworkManager has started
 * WARNING: ntpd is scheduled to start when NetworkManager has started
 * Enabling numlock on ttys ...                                                      [ ok ]
 * Starting postfix  ...                                                             [ !! ]
 * ERROR: postfix failed to start
 * WARNING: samba is scheduled to start when NetworkManager has started
 * WARNING: sshd is scheduled to start when NetworkManager has started
 * Doing udev cleanups
 * Starting vixie-cron ...                                                           [ ok ]
 * Starting VMware USB Arbitrator ...                                                [ ok ]
 * Starting VMware services ...                                                      [ ok ]
Started Bridge networking on vmnet0
Enabled hostonly virtual adapter on vmnet1
Started DHCP service on vmnet1
Started NAT service on vmnet8
Enabled hostonly virtual adapter on vmnet8
Started DHCP service on vmnet8
Started Network detection service
Started all configured services on all networks                                      [ ok ]
 * WARNING: vsftpd is scheduled to start when NetworkManager has started
 * Starting local                                                                    [ ok ]


Hope this info helps to track down the problem. I've been using the above config in /etc/postfix/main.cf for a few years now with no issues. Only recently I've seen the failure.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Tue Dec 04, 2012 4:43 pm    Post subject: Reply with quote

Is this a VM session you're starting?

Up at the top of your last listing, it says "Starting Networkmanager", then a few lines later says that it's inactive because there's not network connection. After that you try to start netmount, noip, ntpd, sambe, sshd, and vsftpd, and they all say, "scheduled to start when Networkmanager is active."

The problem here is that postfix should have deferred it's own startup, just like all of the other service, but it didn't. To be honest, I don't know why it suddenly started failing, but it sounds like either a change in the postfix initscript or a change in timing of VMWare startup. The messages right after VMWare startup are all network-related, so it looks almost as if this is a VMWare client session, and you don't really have any network until the "Started all configured services on all networks". I suspect that that message is a bit of a misnomer, referring to VMWare internals, because the vsftpd deferred message came after. I suspect that there's a slight "timing gap" here, and all of those deferred services are really starting right after your listing ends.

Again, the mystery is why postfix didn't get deferred like the other network services. Looking on one of my machines...
postfix:
Code:
depend() {
        use logger dns ypbind amavisd mysql postgresql antivirus postfix_greylist net saslauthd
        if [ "${SVCNAME}" = "postfix" ]; then
                provide mta
        fi
}

sshd:
Code:
depend() {
        use logger dns
        need net
}

ntpd:
Code:
depend() {
        use net dns logger
        after ntp-client
}

I see minor variations, but the "net" relationship of postfix is in either sshd or ntpd, etc.

Hopefully this can point out some avenue of investigation.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
urcindalo
l33t
l33t


Joined: 08 Feb 2005
Posts: 623
Location: Almeria, Spain

PostPosted: Tue Dec 04, 2012 5:05 pm    Post subject: Reply with quote

depontius wrote:
Is this a VM session you're starting?


No, it's a real laptop. I just start the vmware service at boot time for my Windows VM when I need it every now and then.
As I said, I configured my router so that it always assigns the 192.168.1.40 address to the laptop.

Here is the content of those files in my case.
postfix:
Code:

depend() {
        use logger dns ypbind amavisd antivirus postfix_greylist net saslauthd
        if [ "${SVCNAME}" = "postfix" ]; then
                provide mta
        fi
}


sshd:
Code:
depend() {
        use logger dns
        need net
}


ntpd:
Code:
depend() {
        need net
        after ntp-client
        use dns logger
}


There's only a difference in /etc/init.d/ntpd, which in my case comes from net-misc/openntpd-3.9_p1-r3 (stable amd64).
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Tue Dec 04, 2012 5:39 pm    Post subject: Reply with quote

The difference I see here is that for you, sshd and ntpd both "need net" while postfix has "use net". Check out your other services and see if postfix is the only one with "use net" instead of "need net".

Another thought... some time in the past week or so, we moved to a newer version of openrc, and /etc/rc.conf changed. The obvious changes didn't appear significant, but suggested that things were really more significant under the covers.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
urcindalo
l33t
l33t


Joined: 08 Feb 2005
Posts: 623
Location: Almeria, Spain

PostPosted: Tue Dec 04, 2012 10:22 pm    Post subject: Reply with quote

You're right. postfix was the onlyone with "use net" instead of "need net". I changed the init script this way:
Code:
depend() {
       need net
        use logger dns ypbind amavisd antivirus postfix_greylist saslauthd
        if [ "${SVCNAME}" = "postfix" ]; then
                provide mta
        fi
}


This worked OK. However, after reading the bug postfix should use net and not need net I decided it was not such a good idea to keep the change, especially when I use it only for local mail and, besides, it will force me to change the script every time postfix gets updated. So I reverted the change back to the original setting.

Then I took another approach. Since for some reason localhost was being resolved as 192.168.1.40 I tried changing "localhost" to "127.0.0.1" for the inet_interfaces parameter in /etc/postfix/main.cf:
Code:
inet_interfaces = 127.0.0.1

This also worked. So, I decided to check my /etc/hosts file and I found out this line:
Code:
192.168.1.40 localhost localhost.localdomain
Some time ago I added it after reading this forum thread after looking for a CUPS related problem. When I rebooted with this line commented out and inet_interfaces as localhost in main.cf postfix started normally. Culprit found :D

Finally I think I will keep the 127.0.0.1 setting in /etc/postfix/main.cf and the 192.168.1.40 in /etc/hosts.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Tue Dec 04, 2012 10:51 pm    Post subject: Reply with quote

"localhost" and "localhost.localdomain" are kind-of reserved words, meant for loopback. (127.0.0.1) It's not surprising that postfix got confused. In the old one-box and two-box-with-crossover-cable days, I wasn't sure what to do about that, either. These days with 2 subnets, main+backup servers, and all that, my lan looks much more "normal", though not so normal for a home lan, I guess.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum