I installed Fedora 26 for testing under GCC 7. F26 is installed in a 64-bit VirtualBox VM. I ran the following commands to configure the system post-install, and then rebooted:

localhost:~$ sudo hostnamectl set-chassis desktop
localhost:~$ sudo hostnamectl set-deployment production
localhost:~$ sudo hostnamectl set-hostname --static --transient --pretty asus-f26-x64.

After logon, the hostname is:

asus-f26-x64:~$ hostname

It appears the fully qualified domain name was ignored. Fully qualified domain names end in dot (.), and they signify the top of the DNS tree. Also see Steven's TCP/IP Illustrated, Volume I.

How do I set a fully qualified domain name as the hostname?

A related issue is the host does not register its name with my DHCP server. I don't see an option to send the hostname in the hostnameclt man page.

I guess the DHCP name issue is related to the FQDN issue since the machine does not need a name from a DHCP server, but the host does not realize it because the FQDN is being mishandled.

How do I instruct the machine to sends its hostname?

Below is from hostnamectl status. Things are a little worse because the dot is being interpreted as some sort of adornment for the pretty name; and not being recognized as a FQDN.

$ hostnamectl status
   Static hostname: asus-f26-x64
   Pretty hostname: asus-f26-x64.
         Icon name: computer-desktop
           Chassis: desktop
        Deployment: production
        Machine ID: 3d914cf11226f83093acc
           Boot ID: 21fb5dabfd6a0c24ba8f2
    Virtualization: oracle
  Operating System: Fedora 26 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:26
            Kernel: Linux 4.11.9-300.fc26.x86_64
      Architecture: x86-64

2 Answers 2


If you look at the hostnamectl source code here, you will see that hostnamectl will use the set_hostname function to do the deed.

A comment from that section reads the following (emphasis mine):

Now that we set the pretty hostname, let's clean up the parameter and use that as static hostname. If the hostname was already valid as static hostname, this will only chop off the trailing dot if there is one. If it was not valid, then it will be made fully valid by truncating, dropping multiple dots, and dropping weird chars. Note that we clean the name up only if we also are supposed to set the pretty name. If the pretty name is not being set we assume the user knows what he does and pass the name as-is.

Indeed, if you check the method_set_static_hostname here, where it tries to set the static hostname, the relevant part goes like this:

if (!hostname_is_valid(name, false))
    return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid static hostname '%s'", name);

The function signature of the hostname_is_valid function is this:

bool hostname_is_valid(const char *s, bool allow_trailing_dot) _pure_;

You will see then that hostname_is_valid is called with the allow_trailing_dot arugment as false - thus systemd and hostnamectl do not allow the trailing dot in the static hostname.

EDIT: Well, the systemd discussion on this matter can be found here. AFAIK, this works "as intended" - the trailing dot being optional. There are arguments for and against, but I won't go into that here.

So - you cannot do this via the systemd hostnamectl tool,...

However, you could always just add the trailing dot to the file /etc/hostname and then that'll even show up in the output of hostnamectl.

Of course, should you use hostnamectl or any other tool to set the hostname at any point in the future, it will overwrite that.


It is very seldom that tools like this use a (printed) trailing dot (even if it is accepted).
To get a fully qualified name, which should be printed with this:

$ hostname -f

You need to make /etc/resolv.conf (or equivalent in fedora) to have a domain line:

domain example.com.

But understand that it is not posible to have a fqdn of just one label:


That could be the name of the computer, one label. But you do need some other label (or labels, text limited by dots) to work as a domain (like example). And as the internet has its own list of Internet TLD that should also be added. Thus, the fqdn must be something like:

  • Thanks Arrow. I used my internal domain - asus-f26-x64.home.pvt. (home.pvt is my internal network name/domain). However, the tools discarded it, too. I really miss the old days when things "just worked".
    – user56041
    Commented Jul 14, 2017 at 6:44

You must log in to answer this question.