Issue
Getting the mirror issues on CloudLinux 6 or CloudLinux 7 system, for example:
Error while downloading packages metainfo: Error communicating with server. The message was: Unable to connect to the host and port specified. Trying again.
Environment
CloudLinux OS 6
CloudLinux OS 7
Solution
1. Find your CloudLinux mirror, it's specified in the yum output, like in this example:
[root@host /var/crash]# yum update
Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from CLN.
Loading mirror speeds from cached hostfile
* cloudlinux-x86_64-server-7: cl-mirror.fr.planethoster.net
* epel: d2lzkl7pfhq30w.cloudfront.net
check if the mirror is alive and available with ping, the command is below:
ping cl-mirror.fr.planethoster.net
Expected output:
root@host :~$ ping cl-mirror.fr.planethoster.net
PING cl-mirror.fr.planethoster.net (146.88.232.172) 56(84) bytes of data.
64 bytes from cl-mirror.fr.planethoster.net (146.88.232.172): icmp_seq=1 ttl=47 time=121 ms
64 bytes from cl-mirror.fr.planethoster.net (146.88.232.172): icmp_seq=2 ttl=47 time=120 ms
64 bytes from cl-mirror.fr.planethoster.net (146.88.232.172): icmp_seq=3 ttl=47 time=120 ms
^C
--- cl-mirror.fr.planethoster.net ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 120.935/121.008/121.099/0.292 ms
Bad output:
[root@host /var/crash]# ping cl-mirror.fr.planethoster.net
PING cl-mirror.fr.planethoster.net (146.88.232.172) 56(84) bytes of data.
^C
--- cl-mirror.fr.planethoster.net ping statistics ---
7 packets transmitted, 0 received, 100% packet loss, time 6155ms
If the mirror is not reachable, it's possible that your firewall is blocking it,- try whitelisting the mirror host:
If you are using csf, do:
csf -a $(dig +short cl-mirror.fr.planethoster.net)
in case of using Imunify360:
imunify360-agent whitelist ip add $(dig +short cl-mirror.fr.planethoster.net)
or in case of using Iptables:
iptables -I INPUT -s cl-mirror.fr.planethoster.net -j ACCEPT
iptables -I OUTPUT -d cl-mirror.fr.planethoster.net -j ACCEPT
If these steps didn't help, or the mirror was reachable from the start, the mirror is probably faulty and it's better to switch to another mirror, in order to do so, open the file /etc/yum/pluginconf.d/fastestmirror.conf in an editor, find a string which starts with 'exclude', by default, it looks like this:
#exclude=.gov, facebook
Change it to:
exclude=cl-mirror.fr.planethoster.net
and save the file.
Then try using yum again.
Comments
1 comment
If the solution above didn't help, try disabling IPv6 at the kernel level:
Please sign in to leave a comment.