Some emails are not working

MagnuM

Verified User
Joined
Oct 24, 2003
Messages
122
Location
Romania
Hello DA Team,

I have a problem with emails which have the username, the same as the user from DirectAdmin and from the OS.

Until 2 days ago (when I make the update for Apache 1.3.29 and PHP 4.3.4), they were working fine, and now they are not.

For example there are 2 diferent domains:
glas.ro and secan.net.

The username to login in SSH and Red Hat 9 are glas and secan. Well, the email [email protected] and [email protected] are not working (can't receive emails).

I am trying to send emails to them and this is what I receive:

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

[email protected] (ultimately generated from [email protected])



But the other virtual emails that I add with DirectAdmin, are working fine.

Thanks.
 
Last edited:
Hello,

Change the hostname of your server from "ehosting.ro" to something else. You've created that domain on the server, so thee system email will be caught by the catch-all for "ehosting.ro", which is probably set to fail.

Fix: Admin Panel -> Admin Settings -> change the Hostname to "server.ehosting.ro".

Be sure to add the appropriate A record in your dns settings so that the new hostname resolves. (doesn't have to be "server", but it can't be left as ehosting.ro)

John
 
OK, I do that, in Admin -> Admin Settings the Server's Name is server.ehosting.ro, and there is an A record for server.ehosting.ro in Admin -> DNS Administration -> ehosting.ro.

The OS user emails are working fine now, but I'm reciving a message sistem, which look like this:

Your hostname, ehosting.ro, and the servername you have set in DirectAdmin, server.ehosting.ro, do not match. It is recommended that these two values are the same.

Solution: Either change the servername in DirectAdmin or run the 'hostname.sh' script via ssh to change your hostname
ehosting.ro, resolves to 127.0.0.1. Please make sure that your hostname resolves to your server ip (64.5.40.184) or else your email may not work correctly.

Solution: Create an A record for your hostname (ehosting.ro.) in your DNS control panel. Point the hostname to your server's main IP address. Also check /etc/hosts to ensure that the server ip is correctly set.


This is what I find in /etc/hosts:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost.localdomain
64.5.40.184 ehosting.ro
64.5.40.184 server.ehosting.ro


If you know what to do please let me know.
Thanks.
 
First, run the hostname.sh script.

Then make sure your DNS for ehosting.ro points to the real domain name.

You may need to restart networking:

# /etc/rc.d/init.d/network restart

WARNING: Do NOT use "stop" on this command; if you do you'll have to go to the data center to restart your system.

in fact restarting the system may be a safer bet:

# /sbin/shutdown -r now

WARNING: Do NOT ever use "shutdown -h" or "halt"; if you do you'll have to go to the data center to restart your system.

Jeff
 
Hello,

the hostname.sh script is located at:
/usr/local/directadmin/scripts/hostname.sh

note that the Admin Settings uses that script so it would have already been done.... So I'm thinking there was an error when trying to set your hostname, not sure what's up...

That error is generated when your hostname doesn't match DA's hostname.
DA's hostname is set in /usr/local/directadmin/conf/directadmin.conf

type:
hostname

to see what your current hostname is. (Also restart exim.. I telnetted to port 25 and it's still showing a hostname of ehosting.ro)

one DA's matches the system's hostname, the error will go away.

John
 
After the new DA update to 1.20.3, I am receving this errors again. So DA's hostname doesn't match the system's hostname again.

This is my /etc/hosts file:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 ehosting.ro ehosting localhost localhost.localdomain
64.5.40.184 ehosting.ro
64.5.40.184 server.ehosting.ro


Should I remove something from here?

I need to mention here that my DSN servers are: ns1.ehosting.ro and ns2.ehosting.ro.

Can someone tell me what to do? I am the only one with this problem?
 
Well, I resolve it again, by removing ehosting.ro ehosting after 127.0.0.1.

Now if I type hostname, I receive: server.ehosting.ro, exactly as I wish.

But I am afraid that on each DA upgrade, I should do it again.
 
Hello,

DirectAdmin doesn't touch your hostname settings when it updates. The easy way to make sure your /etc/hosts file is setup correctly would be to set the reset (change, change back) the hostname in the Admin Panel -> Admin Settings area. It would remove the hostname from the 127.0.0.1 line.

Fyi for anyone else, it should look like:
Code:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost localhost.localdomain
64.5.40.184 server.ehosting.ro
so that the hostname isn't on the 127.0.0.1 line as the lookup is done top down, where the higher line has priority (found first). The ehosting.ro line doesn't really matter, but can be removed. We'll let the dns resolve it for us instead.

John
 
I don't know what is happening, but in December 12 (Friday), my /etc/hosts file was changed again, and ehosting.ro was added to 127.0.0.1.

So I change it back again, and now everything is working fine.

I think there is a cronjob that runs every week, and modify my file.

Can you tell me how to resolve this, because I just got tired to change /etc/hosts every week.
 
jlasman said:
in fact restarting the system may be a safer bet:

# /sbin/shutdown -r now

WARNING: Do NOT ever use "shutdown -h" or "halt"; if you do you'll have to go to the data center to restart your system.


Easier way to do a reboot:

# reboot
# /sbin/reboot

Also for a slight bit of information regarding your /etc/hosts file check the following link:

http://forum.rackshack.net/showthread.php?s=&threadid=10744

It has examples of files aswell as information on spacing for certain lines (such as using tab instaed of spaces - tab is your friend, spaces are not!)

Chris
 
1 follow up from that and it states:

"reboot" (or, actually the system call reboot(2)) also does an orderly reboot, the
difference is just in what happens before that - wheather the application shall send a
broadcast (a "wall(1)") to all users before rebooting or not

I often use /sbin/reboot on local systems, and to be honest with you have never had 1 problem.

Chris
 
Actualy I just see that everytime I reboot my VPS the file /etc/host is changed back to:

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 ehosting.ro ehosting localhost localhost.localdomain
64.5.40.184 ehosting.ro
64.5.40.184 server.ehosting.ro


And this is not good.

It happens even if I change them from DirectAdmin -> Admin Settings.
 
Will have to wait for John to answer this one, for now just set it up as he suggested with the example above in shell, once thats done just leave DirectAdmin hostname settings until we have news :D

Chris
 
Hello,

Well I'm not too sure what script would be doing that, probably something with your network setup. If you say it is resetting without a reboot then, you might have a look in either your /etc/crontab file, /etc/cron.d/* or /etc/cron.weekly for any scripts that might be causing it.

Beyond that, hunting it down could be trickey as hundreds are loaded at boot time. Hopefully, it's just a cron file which only exist in so many places.

John
 
I think what he meant was it gets changed to that when he modifies it from the admin panel or reboots, not just automatically?

Chris
 
Well, no matter what I put manually to /etc/hosts.
After a reboot command, the first uncomented line becomes:
127.0.0.1 ehosting.ro ehosting localhost localhost.localdomain

But a strange thing is this:

1. If I change the server's name from DA->Admin Settings to ehosting.ro, the /etc/hosts file looks like this:

127.0.0.1 localhost localhost.localdomain
64.5.40.184 ehosting.ro


2. If I change it back to server.ehosting.ro from DA->Admin Settings the file looks like this:

127.0.0.1 localhost localhost.localdomain
64.5.40.184 ehosting.ro
64.5.40.184 server.ehosting.ro


But after this, if the VPS is somehow restarted, the /etc/hosts file becomes:

127.0.0.1 ehosting.ro ehosting localhost localhost.localdomain
64.5.40.184 .....

The point is that there is something, which modify this file when the VPS is restarted, and I don't know the solution for this problem.
 
Last edited:
a rough and nasty solution would be to let cron copy a backup file over the existing file every 10 minutes

Code:
*/10 * * * *  cp /etc/hosts.bak /etc/hosts

Not too sure about the 10 minutes this way, still learning cron daemon ;)
 
Back
Top