[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Setting hostnames with hostnamectl on AWS AMIs, missing dbus?



On 14/02/17 21:30, Marcin Kulisz wrote:
I ran into a problem with the official Debian AMIs missing 'dbus' - trying to
set the hostname with 'hostnamectl', the command fails as below. A quick
apt-get update and install of dbus lets hostnamectl behave as expected.

     root@ip-10-200-10-94:~# hostnamectl
     Failed to create bus connection: No such file or directory

I ran into this error as it blocked my Ansible setup (v2.2), as the standard
hostname module sets names via hostnamectl.
And I'd say this is the clue of the issue, Ansible is not checking what is
actually available but assuming that it has whole Systemd ecosystem to it's
disposal.
I just have to point out that I used Ansible for few times even in big
installations including writing some modules and extensions but my knowledge
can be out dated a bit.
Anyway from what I know Ansible can run on BSDs as well so this will fail there
entirely as hostnamectl is not available, thus I'd log this as a bug against
Ansible cause it assumes Systemd + surroundings without checking (and if it
checks then doing it badly).
Thanks for all the info Marcin.

Regarding Ansible, as far as I'm aware, it does check what's available - and hostnamectl is present, it's just broken without dbus. I think it's reasonable for a third party to assume that if something is present, that it works.

Run manually on that fresh install of the 8.7 AMI, I get the same error as Ansible reports: 'hostnamectl' is present, but broken. It seems like something that should either be fixed or removed. The error message doesn't make it immediately obvious what needs to be done to fix it. I've got a hacky workaround at the moment - install dbus before setting the hostname :)

Cheers,

Paul


Reply to: