If the command doesn't work as expected, check these common areas: Retrieve Hostname & IP - Knowledge Center
If hostname -i fails or returns an unexpected result, it often indicates a mismatch between /etc/hostname and /etc/hosts , a common cause for the "unable to resolve host" error. Troubleshooting "Hostname -i" Failures hostname - i
This flag displays the IP address(es) associated with the host name. This might only return a single address (like 127.0.1.1 on some Debian-based systems) if the host name is mapped to a loopback address in /etc/hosts . If the command doesn't work as expected, check