1

Topic: install stops due to FQDN required in /etc/hosts

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):   1.0
- Deployed with iRedMail Easy or the downloadable installer?  downloadable installer
- Linux/BSD distribution name and version:   Ubuntu 18.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): n/a
- Web server (Apache or Nginx): n/a
- Manage mail accounts with iRedAdmin-Pro? n/a
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====


Issue:   iRedMail.sh setup script immediately quits because I don't have a FQDN that it likes in /etc/hosts but I'm only deploying for my local domain which I've called "thirtynineohsix" (because ".local" is too overused).   Short of registering a domain, how can I get around this?


jg3@iredmail:~/iRedMail/iRedMail-1.0$ sudo bash iRedMail.sh
[sudo] password for jg3:
<< ERROR >> Please configure a fully qualified domain name (FQDN) in /etc/hosts before we go further.

Example:

127.0.0.1   mail.iredmail.org mail localhost

jg3@iredmail:~/iRedMail/iRedMail-1.0$

but yet...

jg3@iredmail:~/iRedMail/iRedMail-1.0$ cat /etc/hosts
127.0.0.1       mx.thirtyninohsix mx localhost.localdomain      localhost
::1             mx.thirtynineohsix mx localhost6.localdomain6   localhost6

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
jg3@iredmail:~/iRedMail/iRedMail-1.0$

2

Re: install stops due to FQDN required in /etc/hosts

You're missing your TLD from your FQDN, that's why it's not happy with your choice of *.thirtynineohsix

You can still use mx.thirtynineohsix.local even if you don't have a domain name that you own, in fact all my servers with iRedMail are set up with .local domain names in the hosts file, it's the mail domain name that's important for the actual emails, not the host name.

Since you mention it's for your local network only, I'm assuming this is a lab server for testing and/or for personal use, in which case if you want a proper TLD that works over the internet and you don't want to pay, maybe consider getting a free domain at freenom.com

3

Re: install stops due to FQDN required in /etc/hosts

Thank you for replying!   It wasn't exactly the help I needed, but it did set me off in the right direction ... on a bit of an adventure.   Also, I wasn't aware of the free TLDs so thanks, that will be fun (:

I tried what you suggested and added mx.thirtynineohsix.local and mx.local to /etc/hosts but to no avail.  When that didn't work, I wondered, "what are the TLDs this script will accept?"  Here's what I found

From conf/core:

check_hostname()
{
    echo ${HOSTNAME} | grep '\.' &>/dev/null
    [ X"$?" != X'0' ] && \
        ECHO_ERROR "Please configure a fully qualified domain name (FQDN) in /etc/hosts before we go further.\n\nExample:\n\
n127.0.0.1   mail.iredmail.org mail localhost\n" && \
        exit 255
}

So you see, the iRedMail.sh setup script is firing the error I'm seeing out of conf/core where it doesn't like that there's no "." in the variable HOSTNAME (nothing to do with a TLD at all) ... so it tells me to update /etc/hosts

From conf/core:

# Hostname.
if [ X"${IREDMAIL_HOSTNAME}" != X'' ]; then
    # Read from 'IREDMAIL_HOSTNAME'
    export HOSTNAME="${IREDMAIL_HOSTNAME}"
else
    if [ X"${DISTRO}" == X'OPENBSD' ]; then
        export HOSTNAME="$(hostname)"
    else
        export HOSTNAME="$(hostname -f)"
    fi
fi

The problem is, it sets the variable HOSTNAME out of conf/global where it uses the output of "hostname -f"  ... that makes sense alright, but (at least on Ubuntu) "hostname -f" is based on the contents of /etc/hostname, and updating the hostname on Ubuntu isn't as straightforward as just editing /etc/hostname (you are supposed to use the hostnamectl service and edit cloud.cfg, if you're on a VM). 

The guidance error message confused me because it doesn't actually have nothing to do with /etc/hosts ... until it looks up the name in and matches that with an FQDN in /etc/hosts.   Specifically, if /etc/hostname is mx.example and in /etc/hosts mx is listed before mx.example "hostname -f" will just return "mx" (and "hostname" will return mx.example), so be sure to follow the rules for ordering the aliases on the line in /etc/hosts.


Hopefully this helps someone, I've at least gotten to the first curses screen of the setup wizard now.





MuPp3t33r wrote:

You're missing your TLD from your FQDN, that's why it's not happy with your choice of *.thirtynineohsix

You can still use mx.thirtynineohsix.local even if you don't have a domain name that you own, in fact all my servers with iRedMail are set up with .local domain names in the hosts file, it's the mail domain name that's important for the actual emails, not the host name.

Since you mention it's for your local network only, I'm assuming this is a lab server for testing and/or for personal use, in which case if you want a proper TLD that works over the internet and you don't want to pay, maybe consider getting a free domain at freenom.com

4

Re: install stops due to FQDN required in /etc/hosts

I always follow the guide (as documented here) on all my Debian installs, which should be the same for your Ubuntu. Maybe just give it a double-check over smile