You are not logged in.

#1 2013-02-11 12:09:52

quayasil
Member
Registered: 2008-11-09
Posts: 102

incorrect setting hostname over DHCP with systemd

I'm using `netcfg' with `ethernet-dhcp'. My `/etc/dhcpcd.conf' contains the line

option domain_name_servers, domain_name, domain_search, host_name

Unfortunately in most cases (randomly?) my host introduces itself as `localhost'. If I run:

# dhcpcd -k eth0
# dhcpcd eth0

it gets quite confusing:

$ hostname
correct.one.obtained.from.dhcp
$ hostnamectl 
   Static hostname: n/a
Transient hostname: localhost
   Pretty hostname: n/a
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: fcad978cb45784804c79ace4000004dc
           Boot ID: a282df65df6c4ed0910536ab38087300
  Operating System: Arch Linux
            Kernel: Linux 3.7.5-1-ARCH
      Architecture: x86_64

and for some ttys it is `localhost' while for others: `correct.one.obtained.from.dhcp'.
Looks like a kind of magic or systemd bug?

Offline

#2 2013-02-11 12:59:59

quayasil
Member
Registered: 2008-11-09
Posts: 102

Re: incorrect setting hostname over DHCP with systemd

However: when using dhcpcd.service instead of netcfg.service it works fine. Somethoing wrong with netcfg :-(

Offline

#3 2013-02-11 13:38:32

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: incorrect setting hostname over DHCP with systemd

Can you post your /etc/hosts file?  From netcfg.profiles man:

HOSTNAME

    Set the system hostname. Ensure any hostname is correctly referenced in /etc/hosts

Edit: Also, a redaction of the profile you are using to connect would help.

Last edited by the sad clown (2013-02-11 13:40:01)


I laugh, yet the joke is on me

Offline

#4 2013-02-11 14:59:38

quayasil
Member
Registered: 2008-11-09
Posts: 102

Re: incorrect setting hostname over DHCP with systemd

???

Offline

#5 2013-02-11 17:16:24

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: incorrect setting hostname over DHCP with systemd

quayasil wrote:

???

Seriously, that is your response?


I laugh, yet the joke is on me

Offline

#6 2013-02-11 17:29:32

quayasil
Member
Registered: 2008-11-09
Posts: 102

Re: incorrect setting hostname over DHCP with systemd

/etc/host allows static IP to name bindings. It has absolutely nothing to do with the problem described above.

We are using DHCP. A workstation can obtain any IP address (one of 200) and any name (one of 200) via DHCP. The workstation name can be work27 or work85 or work165 or work194 - I don't know it initially. I ask the DHCP server for it and the server sends me some. The daemon (service) that controls DHCP is responsible for obtaining it and setting for the system. Dhcpcd.service does it. Netcfg.service does it or does it not - depending on some random factor.

Last edited by quayasil (2013-02-15 15:03:20)

Offline

#7 2013-02-12 03:14:06

the sad clown
Member
From: 192.168.0.X
Registered: 2011-03-20
Posts: 837

Re: incorrect setting hostname over DHCP with systemd

Sorry, I misunderstood you.  I don't have a solution to your problem other than to suggest you could try netctl, which is looking to be netcfg's replacement and should integrate better with systemd:

netctl
Announcing netctl


I laugh, yet the joke is on me

Offline

Board footer

Powered by FluxBB