You are not logged in.

#1 2013-01-15 06:03:57

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 135
Website

hostname issues after upgrading to systemd

Before the switch to systemd, I was able to ssh between my two machines via user@hostname but now I get a "could not resolve hostname" error and have to use the IP address instead. I set the hostname with hostnamectl and in /etc/hostname but curiously enough, my wireless router no longer displays the hostname under DHCP clients.


There is no system but GNU and Linux is one of its kernels.

Offline

#2 2013-01-15 12:24:56

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,416
Website

Re: hostname issues after upgrading to systemd

Nothing to do with systemd... you may need to define your hosts in /etc/hosts in this format:

192.168.0.105     mars

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2013-01-15 16:58:53

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 947

Re: hostname issues after upgrading to systemd

kahlil88 wrote:

Before the switch to systemd, I was able to ssh between my two machines via user@hostname but now I get a "could not resolve hostname" error and have to use the IP address instead. I set the hostname with hostnamectl and in /etc/hostname but curiously enough, my wireless router no longer displays the hostname under DHCP clients.

On the top of my head, it looks like a problem with /etc/nsswitch.conf, specifically the "hosts:" entry. Can you post this file? AFAICT, my arch clients successfully advertise their names to the router. So if I use the router as a DNS server, I can refer to my machines by name.

Note that with nss-myhostname,  /etc/hosts becomes largerly irrelevant. In fact, on a non-router machine with non-empty /etc/hostname, you can simply revert the hosts file to its default state (shipped with core/filesystem).

If you run an arch-based router, you still need to add router's hostname if you want to refer to the router by its name from any  LAN device , e.g.

% cat /etc/hosts 
#
# /etc/hosts: static lookup table for host names
#

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1 localhost.localdomain localhost
10.0.0.1 router1.homenet router1

# End of file

where LAN is on the 10.0.0.0/24 subnet. Then, I can do "ssh router1" instead of "ssh 10.0.0.1".


Arch Linux is more than just GNU/Linux -- it's an adventure

Offline

#4 2013-01-19 02:51:28

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 135
Website

Re: hostname issues after upgrading to systemd

I'd rather not manually define local IP addresses when it worked automatically before. Oddly enough, a recent update introduced a package conflict between systemd and nss-myhostname...


There is no system but GNU and Linux is one of its kernels.

Offline

#5 2013-01-19 09:49:00

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,416
Website

Re: hostname issues after upgrading to systemd

It's not odd, it's by design.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#6 2013-03-04 12:43:15

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 135
Website

Re: hostname issues after upgrading to systemd

Finally fixed this by adding my hostname to /etc/hosts!

#
# /etc/hosts: static lookup table for host names
#

#<ip-address>   <hostname.domain.org>   <hostname>
127.0.0.1       localhost.localdomain   localhost       hostname
::1             localhost.localdomain   localhost

# End of file

Last edited by kahlil88 (2013-03-04 13:04:04)


There is no system but GNU and Linux is one of its kernels.

Offline

#7 2013-03-05 23:38:34

UnhappymealQQ
Member
Registered: 2013-02-07
Posts: 5

Re: hostname issues after upgrading to systemd

Hey guy, I was banging my head on something similar too for a little while.  If you install Avahi (https://wiki.archlinux.org/index.php/Avahi) and it will take care of your hostname resolution.  Now I can finally ssh to a name and not an IP again

Offline

#8 2013-03-06 07:43:53

kahlil88
Member
From: Mendocino, CA
Registered: 2010-08-10
Posts: 135
Website

Re: hostname issues after upgrading to systemd

UnhappymealQQ wrote:

Hey guy, I was banging my head on something similar too for a little while.  If you install Avahi (https://wiki.archlinux.org/index.php/Avahi) and it will take care of your hostname resolution.  Now I can finally ssh to a name and not an IP again

Avahi is already installed and enabling the service didn't seem to make a difference. Turns out the dhcpcd service was disabled, working great now.

Last edited by kahlil88 (2013-03-06 11:00:12)


There is no system but GNU and Linux is one of its kernels.

Offline

Board footer

Powered by FluxBB