Same thing happened to me today. I checked/checksummed that /usr/bin/hostname file hasn't changed recently.
I grepped the strace output for opened files (excluding "No Such Files" in alternative $PATH's):
$ strace hostname -i |& grep open | grep -v "No such file"
open("/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/etc/resolv.conf", O_RDONLY|O_CLOEXEC) = 3
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libnss_files.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/etc/host.conf", O_RDONLY|O_CLOEXEC) = 3
open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libnss_mymachines.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libresolv.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libcap.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libnss_resolve.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
open("/usr/lib/libnss_dns.so.2", O_RDONLY|O_CLOEXEC) = 4
One-by-one inspection and comparison with the incremental backups for the last few days showed that /etc/nsswitch.conf changed from its previous version as of Sep 30, 2015, on Dec 10, 2016.
A side-by-side diff shows the differences (left side previous and restored, right side latest and backed-up):
$ diff -y /etc/nsswitch.conf /etc/nsswitch.conf.bck | grep \|
passwd: files | passwd: compat mymachines systemd
group: files | group: compat mymachines systemd
shadow: files | shadow: compat
hosts: files dns myhostname | hosts: files mymachines resolve [!UNAVAIL=return] dns myhostn
Restoring the previous /etc/nsswitch.conf solves the problem and "hostname -i" returns the IPs given by interfaces as usual. You should backup the latest one just in case.
Update:
After the bug I filed (https://bugs.archlinux.org/task/52133), systemd package maintainer Dave Reisner pointed out that the problem only occurs when the system-resolved daemon does not work. I checked and it is correct. In order for the new /etc/nsswitch.conf to work:
systemctl enable systemd-resolved
is needed.
According to the "top" output this adds a resident size of around 4m. Alternatively, one can go on with the previous line without systemd-resolved.