[systemd-devel] getent hosts <machine>

Colin Guthrie gmane at colin.guthr.ie
Tue Jun 30 09:48:06 PDT 2015


Colin Guthrie wrote on 30/06/15 11:58:
> Johannes Ernst wrote on 29/06/15 19:51:
>>> On Jun 29, 2015, at 10:32, Johannes Ernst <johannes.ernst at gmail.com
>>> <mailto:johannes.ernst at gmail.com>> wrote:
>>>
>>> I was hoping that
>>> getent hosts <containername>
>>> would work, just like
>>> getent hosts <hostname>
>>> where <hostname> can be anything else in the hosts: field in
>>> nsswitch.conf. But no such luck.
>>>
>>> The <containername> does get resolved correctly in other cases, e.g.
>>> when pinging it.
>>>
>>> Not knowing how getent actually works, I don’t know why that is, but I
>>> figured I mention it.
>>
>> I take it back. A reboot fixed it.
>>
>> It appears I had a different problem: machinectl (suddenly) stopped
>> showing any containers, but ps still showed several systemd-nspawn
>> processes.
> 
> FWIW, my machine is also currently in that state:
> 
> [root at jimmy ~]# pgrep systemd-nspawn
> 25917
> [root at jimmy ~]# ps aux | grep [s]ystemd-nspawn
> root     25917  0.0  0.0  15380   200 ?        Ss   Jun26   0:00
> /usr/bin/systemd-nspawn -b -M tl.dev -D
> /home/colin/Development/Work/container7
> --bind=/home/colin/Development/Work/trunk
> [root at jimmy ~]# machinectl
> MACHINE CLASS SERVICE
> 
> 0 machines listed.
> 
> 
> Not sure what caused it (machined logs say it was terminated just under
> 15mins after it started)
> 
> I did have issues that a previous machine was not marked as having been
> stopped (i.e. machinectl listed it after I'd stop the service unit for
> the machine and systemd-nspawn processes had gone - pretty much the
> opposite problem!). I edited my unit file to rename the -M argument
> passed to systemd nspawn and reloaded systemd to reread the unit. I
> notice that machined said my old machine name terminated at the same
> time systemd was reloaded...
> 
> What adds to the curiosity now I look at my logs, the current name was
> also ejected when I reloaded systemd again.
> 
> Jun 26 13:58:44 jimmy systemd[1]: Reloading.
> Jun 26 13:58:44 jimmy systemd-machined[16851]: Machine tl.dev7 terminated.
> Jun 26 13:58:44 jimmy systemd[1]: Failed to enumerate devices: Invalid
> argument
> Jun 26 13:58:44 jimmy systemd[1]: Failed to reload: Invalid argument
> 
> 
> Jun 26 14:13:40 jimmy systemd[1]: Reloading.
> Jun 26 14:13:41 jimmy systemd-machined[16851]: Machine tl.dev terminated.
> Jun 26 14:13:41 jimmy systemd[1]: Failed to enumerate devices: Invalid
> argument
> Jun 26 14:13:41 jimmy systemd[1]: Failed to reload: Invalid argument
> 
> 
> 
> Random guess: Perhaps machined is using fd storage facility of systemd
> and the reload borks it and it sees it as the machine going away?

On a hunch I reverted
https://github.com/systemd/systemd/commit/9b420b3cfb8b93daf50e4cdbc92b05f2209ef893
and this seemed to fix this issue for me.

I'll do some more tests, but with this reverted, restarting the service
on the host works well (not tried reboots from within the container
itself tho').

But anyway, multiple "systemctl daemon-reloads" since and machined is
still keeping track nicely.

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/


More information about the systemd-devel mailing list