Transient hostname with wicked networking

Hi, i want to use Leap 15.2 LXC containers and im found problem with hostname settings when wicked networking is used.

Setting hostname with

hostnamectl set-hostname somename

sucessfully change hostanme and /etc/hostanme modified.

But after restaring container this stay only as Static hostname
and old name was set as Transient hostname
As i read about transient it was changed by networking but i don found any configuration to be able change it.

There is only static network settings, no DHCP, no mDNS, no yast net configuraion.

When NetworkManager is used for networking it works correctly and it set hostname after container re/start.
But i don want to have NM for networking.

Im thaks for any advice to solve this issue.

Did you see YaST > System > Network Settings > Hostname/DNS > Set Hostname via DHCP ?

openSUSE Documentation…

Yast is not installed in LXC container by default.
DHCP is not configured, i try also disable and mask wickedd-dhcp4, wickedd-dhcp6, wickedd-auto4 services to be sure that is not used.
Im checked jourrnal boot messages and no dhcp try start.

Temporary im created systemd service which run hostanamectl.


Transient hostname is still set by some service after this. Im not sure which one but with

[Unit] dbus-org.freedesktop.hostname1.service

hostname stay correctly set.

For what purpose are you using the Hostname?
Technically, a hostname is any name which will resolve to the ip address of the machine (or container in this case) and a machine can have any number and multiple hostnames that resolve to
The system Hostname is only the default hostname the machine advertises to others how it wants to be known, but there is usually no requirement that others need to resolve that specific name to access your machine.

For example
Although a Hostname is always set that’s unique on the network (A requirement), you’ll notice in the DHCP settings that allows the DHCP server to assign a different name to your machine.
Another example would be if you deploy a webserver on your machine supporting multiple websites that share the same IP address but use different host headers (different hostnames) to serve different websites. Typically in this and many other scenarios, a DNS server provides the mapping of hostnames to IP addresses.

Locally on a machine with multi-tenant apps like LXC dnsmasq might provide the hostname mapping in place of a full blown DNS server.
It’s also possible to use /etc/hosts entries to do something similar.

There’s many ways to set up hostname resolution, and any can be used unless you are running an app that requires a specific way… eg an app that might connect through UNIX sockets instead of network sockets, so can’t contact a name resolution server over a network.


Thanks guys for your opinions.

Some applications read hostname to build their registry on that key. And is not read as fdqn from dns.

Im read documentation about wicked and its mechanism is use dbus for managing, and I dont found way how to set hostname when DHCP or mDNS is not used.

Im found that LXD report hostname to container as LXC container name (even dhcp is not used) so wicked take it as static hostname and then it is set via DBUS. And because host have set different hostname in /etc/hostname
it will be set by wicked as Transient. It can be changed via Yast but only temporary (after reboot is old again).

So i see the only way to rename container to that name which i want or use NetworkManager or additional systemd service as i created to update hostname.

This would probably work,
“In the old days” before systemd and more often than not still an acceptable practice nowadays,
If you want to run a system configuration command that won’t remain persistent across reboots,

Place the command within the following file and it will always run on bootup.


So, in your case, you can run your hostnamectl command within that file.
I don’t know for sure, but would assume it would be run in an LXC container… of course the slight issue might be that a container image might “just run” and not go through the usual bootup process as a normal machine.

A long time ago,
I published the following which includes using the sysctl.conf file to modify proc values persistently (after all these years the paper is still completely applicable to all current openSUSE). The following link is to the actual use of sysctl.conf, but you can backup several pages to get an idea what is happening

You might want to post wherever you obtained your image, then someone can take a look at that image.
You might also consider contacting the author of that image to see what he recommends.


Thanks TSU.
Im tested it before to set kernel.hostname in sysctl.conf and also with sysctl -w approach dont work.

BUT finally im figure out the problem:

  • What im try set as hostname (/etc/hostname) is same string as FDQN.
  • The NetworkManager (ifup ifdown network manging) and hostnamectl don’t have any restriction to it and they do it.
  • looks like wicked recognize that it is FDQN and take from it first part as hostame and as it differ from /etc/hsotname … it is set as Transient.

So it looks that Wicked is more strict to this hostname as others and don’t allow you to have hostname similar to FDQN ?

I dont see/read any strict definition what have to be in /etc/hostname and we can see lot of discussion about it or some best practices.

In my opinion it is not problem to have hostname same as FDQN :slight_smile:

I set hostname with hostnamectl, fqdn is in /etc/hosts file…

For the sake of archives - you seem to believe that wicked does something special so set “transient” name. “Transient” exists only in systemd-hostnamed run-time properties and means that current hostname as set in kernel is different from hostname recorded in /etc/hostname. Nothing more, nothing else. Nobody “sets Transient name”.

If you actually showed value of /etc/hostname and hostnamectl output at least once, someone would have answered it already. Instead you continued with long descriptions of what you thought have happened without showing any fact.

This is text book example of how to not ask questions. Sorry.

Read up on this a bit more…
Seems that there are multiple recommended methods how to set the container’s hostname…
This only applies to LXD

  1. Perhaps the simplest, the container’s hostname is created by default based on the container’s configuration file. So, just rename the file!
mv old_name new_name
  1. LXC has the “rename” command but that looks like it only works for the current session. I don’t see that settings are likely to survive a reboot.

  2. LXD installs and uses dnsmasq as its local and private (utilized only by the local machine and any containers or machines on your machine, not accessible by remote machines) name resolution. You can create and modify dnsmasq zone and records directly. Although the following was written for Ubuntu, I see nothing that should work differently on other distros including openSUSE

  3. Although I don’t see examples, looks to me that you can set the hostname as part of your container startup command, placing the setting in your container file.

Correcting some misconceptions in your post…
The Fully Qualified Domain Name (FQDN) means that the name includes both the hostname(eg fu) and domain name (eg bar) which together creates the FQDN example
I don’t know that there are any restrictions on what you should enter for your hostname partly because technically you can also have subdomains in the name, but it’s unorthodox to enter an entire FQDN in the hostname variable… A DNS may try to use your hostname variable in combination with a domain variable which would result in a weird result.


I agree with you. Im in learning process and it will be better :slight_smile:

Good point, thanks. So it is not problem of wicked, now its clear to me.

Im find some documentantion and regarding that semantics Transient hostname dont have be set beacause /etc/hostanme have higher priority.
“Note that systemd-hostnamed.service(8) gives higher priority to the static hostname, so the transient hostname will only be used if the static hostname is not configured.”*

I dont know how it is releavant.

Regarding that documentation
*“It is recommended that this name contains only a single label, i.e. without any dots.”

So that the reason why it ignore /etc/hostname when i use FDQN or any subdomain. But it dont correspond to docu that it have filter that characters :slight_smile:

Simply when I use single word like “somehost” it is set correctly also in container. So no subdomain no FDQN in hostname.

I also want thanks to** TSU** for your help.*