'qemu-system-x86_64 : address resolution failed for ::1:46189: Name or service not known

I have the following problem. When I run emulator @avdname the following error is thrown:

(...)
qemu-system-x86_64: -chardev socket,port=46189,host=::1,nowait,nodelay,ipv6,id=modem: address resolution failed for ::1:46189: Name or service not known
(...)

I tried to find the solution on the internet (here and here) but still without success.

/etc/hosts file

127.0.0.1   localhost
127.0.1.1   luis-HP-ProBook-450-G2

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


Solution 1:[1]

I don't know what causes this, but following the advice at https://issuetracker.google.com/issues/215231636, I can confirm that turning off IPv6 completely fixed my issue.

Temporary: sysctl net.ipv6.conf.all.disable_ipv6=1

Permanent setting: put net.ipv6.conf.all.disable_ipv6=1 in /etc/sysctl.conf or in /etc/sysctl.d/99-sysctl.conf (whichever is the right way in your system).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 The Vee