Comments (9)
Duplicate of #17403
from systemd.
It does not seem like this is a duplicate of the referenced issue. That one is about persisting the dhcp hostname as a static hostname whereas mine is about the behavior of the hostname when dhcp does not even send one. In that case the transient hostname seems to go bonkers, gets lost/reset or whatever.
from systemd.
@septatrix the transient hostname is transient, i.e. it lives only as long as the dhcp lease it is defined in is valid. We revert back to the static hostname once the dhcp lease ended. If no static hostname is defined, we fall back to the fallback hostname instead.
What you are asking for is that the hostname from a DHCP least is applied not just transiently, but persistently, and that's what the "static" hostname is for. Hence to me it appears this is simply the same issue?
from systemd.
What you are asking for is that the hostname from a DHCP least is applied not just transiently, but persistently, and that's what the "static" hostname is for. Hence to me it appears this is simply the same issue?
No, I do not really care about the static hostname. My DHCP lease (to my knowledge) does not send even send any hostname - at least I never configured my router to do so.
The "Foobar" hostname is transient and was set by me. The "Digital-Signage-Player" is not from DHCP. I actually do not know where systemd gets it from. It is the one set in the initrd (and was the hostname originally before I set it to "Foobar") but I have no clue from where systemd gets this name after I overwrote it with "Foobar". Then, after the DHCP lease expires the hostname is reset to "fedora" which is the default hostname as per os-release. I would expect it to not change the hostname (because the DHCP lease never set one) or at least revert it to "Foobar".
from systemd.
The "Foobar" hostname is transient and was set by me. The "Digital-Signage-Player" is not from DHCP. I actually do not know where systemd gets it from.
this smells a lot as if it actually does come from DHCP. If you look at the sources the hostname changes the moment the dhcp lease is acquire and later lost.
maybe you have a DHCP server on your wifi you are not aware of?
consider setting UseHostname=no to make sure networkd doesn't use the hostname?
from systemd.
The "Foobar" hostname is transient and was set by me. The "Digital-Signage-Player" is not from DHCP. I actually do not know where systemd gets it from.
this smells a lot as if it actually does come from DHCP. If you look at the sources the hostname changes the moment the dhcp lease is acquire and later lost.
maybe you have a DHCP server on your wifi you are not aware of?
Upon further inspection it seems that you are correct. The router apparently sends out hostnames - I assume to resolve hostname conflicts if several devices announce the same hostname.
consider setting UseHostname=no to make sure networkd doesn't use the hostname?
Even though we do not expect to have duplicate devices on the same network we would like to preserve the ability for our customers to assign custom hostnames if they so desire. The solution we are doing now is to adjust the hostname in os-release:
sed -i \
-e 's/DEFAULT_HOSTNAME="fedora"/DEFAULT_HOSTNAME="Digital-Signage-Player"/' \
"$BUILDROOT"/usr/lib/os-release
Thanks for your help!
from systemd.
@septatrix Editing os-release per-host is not good. Using /etc/hostname (and /etc/machine-info) is better solution.
from systemd.
@septatrix Editing os-release per-host is not good. Using /etc/hostname (and /etc/machine-info) is better solution.
We are using usr/-only images and while we do have a persistent root we try to avoid putting files. We build our images using mkosi and the above hostname really is our "default hostname" for all devices so setting the field in os-release seems like a reasonable solution.
I also opened an issue in mkosi to do this when Hostname=
is present in the mkosi configuration
from systemd.
I see. Note, if you use newer systemd, then you can use systemd.hostname= kernel command line option. (Though, I am not sure if it will be reused or not when a transient hostname is revoked.)
from systemd.
Related Issues (20)
- userdb API: Support notifications about changes HOT 1
- SLAAC addrs perceived as foreign and removed during systemd-network start HOT 2
- systemd-resolved: "DNSSEC=allow-downgrade" still fails HOT 11
- mountfsd fails compilation if zlib or xz are not available (hidden dependency on lib_import_common) HOT 4
- Missing credentials in `ExecStartPost=/ExecStop*=` when `ReadWritePaths=` is used HOT 3
- LUKS unlock failure with a FIDO2 token when using gpt-auto-generator HOT 1
- Not able to add device/event to watch list of systemd-logind HOT 4
- systemd-homed fscrypt-backed files are still visible after logout HOT 1
- `systemctl disable [--now] someunit@*` gives wrong error message HOT 2
- TPM2 support: Compatibility with older Intel PTT HOT 3
- Log output can be lost from services using log namespaces that only produce output immediately before exiting HOT 2
- `systemctl disable [--now] someunit@*` gives an error message HOT 2
- Try unlock with FIDO2 key before asking for password(/PIN). HOT 2
- systemd.network Kind=/Type= ambiguity
- systemd.network Name=enp* matches eno* HOT 4
- Strange results when using sd_device_monitor to monitor USB device events HOT 15
- IPv6 Compliance Failure Summary (April 25, 2024)
- systemctl hibernate error message on "not enough space" could use more detail
- machined: Assertion '(_error) != 0' failed at src/shared/discover-image.c:1450, function image_read_metadata(). Aborting. (in developer mode)
- WorkingDirectory= feature to normalize or ability to use ".." ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from systemd.