Discussion:
[systemd-devel] How do you set the machine's domain name with systemd?
Adam Nielsen
2013-02-10 19:41:15 UTC
Permalink
Hi all,

I have just switched my Arch Linux machine to systemd and it mostly works, but
I'm encountering a few issues.

For one, all my NFS mounts are failing, and it seems to be because I have
granted permission via domain name, and since switching to systemd my machine
no longer has a domain name, so I'm getting access denied errors:

$ cat /etc/hostname
korath

$ hostname
korath

$ hostname -s
localhost

$ hostname -f
localhost.localdomain

Why is the short name being reported as localhost? How can I change the
domain to my actual domain name instead of "localdomain"? According to all
the documentation, the domain name should not be specified in /etc/hostname -
so where should it go?

Many thanks,
Adam.
Reindl Harald
2013-02-10 19:49:34 UTC
Permalink
Post by Adam Nielsen
$ cat /etc/hostname
korath
$ hostname
korath
$ hostname -s
localhost
$ hostname -f
localhost.localdomain
Why is the short name being reported as localhost? How can I change the domain to my actual domain name instead of
"localdomain"? According to all the documentation, the domain name should not be specified in /etc/hostname - so
where should it go?
besides that this is more a question for your distributions
list and not the DEVEL upstream-list:

[***@srv-rhsoft:~]$ cat /etc/hostname
srv-rhsoft.rhsoft.net

[***@srv-rhsoft:~]$ hostname
srv-rhsoft.rhsoft.net
[***@srv-rhsoft:~]$ hostname -s
srv-rhsoft
[***@srv-rhsoft:~]$ hostname -d
rhsoft.net
[***@srv-rhsoft:~]$ hostname -f
srv-rhsoft.rhsoft.net

[***@srv-rhsoft:~]$ rpm -q systemd
systemd-197-1.fc18.2.x86_64
David Strauss
2013-02-11 00:58:31 UTC
Permalink
Use hostnamectl, assuming your systemd version is new enough:

http://www.freedesktop.org/software/systemd/man/hostnamectl.html
Post by Reindl Harald
Post by Adam Nielsen
$ cat /etc/hostname
korath
$ hostname
korath
$ hostname -s
localhost
$ hostname -f
localhost.localdomain
Why is the short name being reported as localhost? How can I change the domain to my actual domain name instead of
"localdomain"? According to all the documentation, the domain name should not be specified in /etc/hostname - so
where should it go?
besides that this is more a question for your distributions
srv-rhsoft.rhsoft.net
srv-rhsoft.rhsoft.net
srv-rhsoft
rhsoft.net
srv-rhsoft.rhsoft.net
systemd-197-1.fc18.2.x86_64
_______________________________________________
systemd-devel mailing list
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
David Strauss
| ***@davidstrauss.net
| +1 512 577 5827 [mobile]
Adam Nielsen
2013-02-12 19:42:41 UTC
Permalink
Post by David Strauss
http://www.freedesktop.org/software/systemd/man/hostnamectl.html
Thanks for the suggestion, but unfortunately this doesn't seem to work:

$ hostnamectl set-hostname korath.my.domain.com

$ cat /etc/hostname
korathmydomaincom

$ pacman -Qi systemd | grep Ver
Version : 197-4

At a suggestion from my distro's discussion forum, manually editing
/etc/hostname and putting the FQDN back in there works. So I'm not sure
whether this is a bug in hostnamectl or whether editing /etc/hostname is still
the preferred way to set a machine's FQDN.

Also for the record the "localhost.localdomain" was because my short hostname
was listed against 127.0.0.1 in /etc/hosts. Removing that fixed that issue.

Thanks,
Adam.
Jóhann B. Guðmundsson
2013-02-12 21:32:43 UTC
Permalink
Post by Adam Nielsen
Post by David Strauss
http://www.freedesktop.org/software/systemd/man/hostnamectl.html
$ hostnamectl set-hostname korath.my.domain.com
$ cat /etc/hostname
korathmydomaincom
Known and annoying bug...

JBG
Lennart Poettering
2013-02-13 02:50:32 UTC
Permalink
This post might be inappropriate. Click to display it.
Reindl Harald
2013-02-13 09:23:13 UTC
Permalink
Post by Lennart Poettering
Post by Adam Nielsen
Post by David Strauss
http://www.freedesktop.org/software/systemd/man/hostnamectl.html
$ hostnamectl set-hostname korath.my.domain.com
So, we currently clean up names here a bit too drastically
you are making a big mistake here
if you think the input is wrong stop with a error message
but do NOT write different things as the users input in config files

this is a very bad style which became visible with this bug
Lennart Poettering
2013-02-13 19:12:45 UTC
Permalink
Post by Reindl Harald
Post by Lennart Poettering
Post by Adam Nielsen
Post by David Strauss
http://www.freedesktop.org/software/systemd/man/hostnamectl.html
$ hostnamectl set-hostname korath.my.domain.com
So, we currently clean up names here a bit too drastically
you are making a big mistake here
if you think the input is wrong stop with a error message
but do NOT write different things as the users input in config files
this is a very bad style which became visible with this bug
Well, it's not as simple as it might appear. "hostnamectl set-hostname"
actually sets the pretty hostname (and should do that unaltered), then
strips all the weird chars and sets the result as the unix hostname. You
should always have the pretty hostname in place.

The idea is that "Lennart's PC" as pretty hostname becomes "lennarts-pc"
as Unix hostname.

Lennart
--
Lennart Poettering - Red Hat, Inc.
Reindl Harald
2013-02-13 19:23:54 UTC
Permalink
Post by Lennart Poettering
Post by Reindl Harald
Post by Lennart Poettering
Post by Adam Nielsen
Post by David Strauss
http://www.freedesktop.org/software/systemd/man/hostnamectl.html
$ hostnamectl set-hostname korath.my.domain.com
So, we currently clean up names here a bit too drastically
you are making a big mistake here
if you think the input is wrong stop with a error message
but do NOT write different things as the users input in config files
this is a very bad style which became visible with this bug
Well, it's not as simple as it might appear. "hostnamectl set-hostname"
actually sets the pretty hostname (and should do that unaltered), then
strips all the weird chars and sets the result as the unix hostname. You
should always have the pretty hostname in place.
The idea is that "Lennart's PC" as pretty hostname becomes "lennarts-pc"
as Unix hostname
and this idea is wrong
there is no need for a "pretty hostname"

* a hostname is a hostname with it's rules
* a pretty name is a pretty name with no technical relation
Lennart Poettering
2013-02-13 19:26:52 UTC
Permalink
Post by Reindl Harald
Post by Lennart Poettering
Post by Reindl Harald
this is a very bad style which became visible with this bug
Well, it's not as simple as it might appear. "hostnamectl set-hostname"
actually sets the pretty hostname (and should do that unaltered), then
strips all the weird chars and sets the result as the unix hostname. You
should always have the pretty hostname in place.
The idea is that "Lennart's PC" as pretty hostname becomes "lennarts-pc"
as Unix hostname
and this idea is wrong
there is no need for a "pretty hostname"
* a hostname is a hostname with it's rules
* a pretty name is a pretty name with no technical relation
Well, read a book.

The pretty host name is inherent to mDNS/DNS-SD and used in Avahi, GNOME
and others for various purposes...

Lennart
--
Lennart Poettering - Red Hat, Inc.
Reindl Harald
2013-02-13 20:01:10 UTC
Permalink
Post by Lennart Poettering
Post by Reindl Harald
Post by Lennart Poettering
Post by Reindl Harald
this is a very bad style which became visible with this bug
Well, it's not as simple as it might appear. "hostnamectl set-hostname"
actually sets the pretty hostname (and should do that unaltered), then
strips all the weird chars and sets the result as the unix hostname. You
should always have the pretty hostname in place.
The idea is that "Lennart's PC" as pretty hostname becomes "lennarts-pc"
as Unix hostname
and this idea is wrong
there is no need for a "pretty hostname"
* a hostname is a hostname with it's rules
* a pretty name is a pretty name with no technical relation
Well, read a book.
The pretty host name is inherent to mDNS/DNS-SD and used in Avahi, GNOME
and others for various purposes...
and there is which technical need to make it not "lennarts-pc"
if you say "set-hostname" and not say "set-pretty-hostname"
besides that "Lennart's PC" is technical absoluetly not needed
and so this idea should never have side effects to the unix
hostname - KISS principle!
Colin Guthrie
2013-02-14 09:29:19 UTC
Permalink
This post might be inappropriate. Click to display it.
Jóhann B. Guðmundsson
2013-02-13 10:43:47 UTC
Permalink
Post by Lennart Poettering
I am figure "hostnamectl set-hostname" is currently a bit too drastic,
but I am not fond at all of the idea of adovcate this
fqdn-as-kernel-hostname nonsense any further, it sounds like the wrong
idea, from a very narrow IP+DNS mindset...
I would hardly call decades of networking, standard practices ( both
networking and sysadmin ) and all the experience that comes with it "a
very narrow IP+DNS mindset".

JBG
Larry Baker
2013-02-11 17:55:30 UTC
Permalink
# cd /etc/network.d
# mv wired-eth0{,.orig}
# cp examples/ethernet-static ./wired-eth0
# vi /etc/network.d/wired-eth0
# Set DECnet MAC address for host address 54.147, ALLMULTI
PRE_UP='ip link set eth0 address AA:00:04:00:93:D8 allmulticast on'
CONNECTION='ethernet'
DESCRIPTION='A basic static ethernet connection using iproute'
INTERFACE='eth0'
IP='static'
ADDR='130.118.44.225'
NETMASK='255.255.252.0'
#ROUTES=('192.168.0.0/24 via 192.168.1.2')
GATEWAY='130.118.44.1'
HOSTNAME='sheeva'
DNS=('130.118.4.2 130.118.4.7')
## For IPv6 autoconfiguration
#IP6=stateless
## For IPv6 static address configuration
#IP6='static'
#ADDR6=('1234:5678:9abc:def::1/64' '1234:3456::123/96')
#ROUTES6=('abcd::1234')
#GATEWAY6='1234:0:123::abcd'
Larry Baker
US Geological Survey
650-329-5608
Hi all,
I have just switched my Arch Linux machine to systemd and it mostly works, but I'm encountering a few issues.
$ cat /etc/hostname
korath
$ hostname
korath
$ hostname -s
localhost
$ hostname -f
localhost.localdomain
Why is the short name being reported as localhost? How can I change the domain to my actual domain name instead of "localdomain"? According to all the documentation, the domain name should not be specified in /etc/hostname - so where should it go?
Many thanks,
Adam.
_______________________________________________
systemd-devel mailing list
http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Loading...