# Dovecot gives me Fatal: Invalid system hostname: ''.



## R6exe (Jan 11, 2021)

When I try to restart the service with the command `service dovecot restart` it just gives me this error `Fatal: Invalid system hostname: ''` which I don't know how to solve.
I tried to find in the dovecot.conf and in other configuration files some keywords about hostname, but I couldn't find anything. 
All I did just for now was install the service dovecot 2.3.13, copy the files it needed on it's config directory, and that's it, I didn't make any other actions or changes to the service.
As I can see there's not so much information about this problem in the internet, so that's why I decided to ask for help in here.
Thank you so much for your help.
Regards.


----------



## VladiBG (Jan 11, 2021)

Edit the /usr/local/etc/dovecot/conf.d/15-lda.conf


----------



## R6exe (Jan 12, 2021)

VladiBG said:


> Edit the /usr/local/etc/dovecot/conf.d/15-lda.conf


Hi, I did uncomment the variable hostname in that file but unfortunately when I restart the service again it gaves me the same problem. Even if I reboot. But thank you anyways.


----------



## SirDice (Jan 12, 2021)

R6exe said:


> I did uncomment the variable hostname in that file


Just uncommenting it doesn't help. You need to provide the actual hostname of the machine here. But you shouldn't need to set this anyway as it automatically picks the hostname from the host itself. Which leads me to believe you haven't set a proper hostname in rc.conf, there really should be one (unless this is a jail, in which case it needs to be set in jail.conf). What does `hostname -f` output?


```
hostname="myhost.example.com"
```


----------



## R6exe (Jan 12, 2021)

SirDice said:


> Just uncommenting it doesn't help. You need to provide the actual hostname of the machine here. But you shouldn't need to set this anyway as it automatically picks the hostname from the host itself. Which leads me to believe you haven't set a proper hostname in rc.conf, there really should be one (unless this is a jail, in which case it needs to be set in jail.conf). What does `hostname -f` output?
> 
> 
> ```
> ...


Hi SirDice.
With the command hostname -f doesn't output anything to the terminal.
Y added two quotation marks in the hostname value and it's still giving me the error.
Thank you.


----------



## R6exe (Jan 12, 2021)

All right so in rc.conf I added a name to the hostname and now dovecot is giving me another problem.

```
doveconf: Error: t_readlink(/var/run/dovecot/dovecot.conf) failed: readlink() failed: No such file or directory. Dovecot is not running.
```
Should I pass the dovecot.conf file in the etc folder inside /var/run/dovecot/? 
Thanks.


----------



## SirDice (Jan 12, 2021)

How are you starting dovecot? You should start it with `service dovecot start`.


----------



## R6exe (Jan 12, 2021)

SirDice said:


> How are you starting dovecot? You should start it with `service dovecot start`.


With that command exactly, I tried restarting the OS but unfortunately nothing changes.


----------



## SirDice (Jan 13, 2021)

/var/run/dovecot should contain a symlink:

```
root@mail:~ # ls -l /var/run/dovecot/dovecot.conf
lrwx------  1 root  wheel  35 Jan 10 14:54 /var/run/dovecot/dovecot.conf -> /usr/local/etc/dovecot/dovecot.conf
```


----------

