Today I tried to update my Linux operating system via SSH using the command sudo yum update (sudo apt-get update may be working too, depending on the Linux distrubtion). Most updates worked fine, except for one, where I received this error:
http://mirrors.ustc.edu.cn/centos/6/updates/x86_64/Packages/libssh2-1.4.2-3.el6_10.1.i686.rpm: [Errno 12] Timeout on http://mirrors.ustc.edu.cn/centos/6/updates/x86_64/Packages/libssh2-1.4.2-3.el6_10.1.i686.rpm: (28, 'Operation too slow. Less than 1 bytes/sec transferred the last 30 seconds') Trying other mirror.
It seemed that the package libssh that was hosted on a given server (ustc.edu .cn) timed out. In this case, your Linux distro will try to contact another mirror and download the software package from there. But in my case apparently, there was no alternative backup server available for my operating system to try:
Error Downloading Packages: libssh2-1.4.2-3.el6_10.1.i686: failure: Packages/libssh2-1.4.2-3.el6_10.1.i686.rpm from updates: [Errno 256] No more mirrors to try.
Solve error [Errno 12] Timeout – Operation too slow. Less than 1 bytes/sec transferred the last 30 seconds
When you receive this error, there are multiple root causes:
- The server is down: in this case, you can wait some minutes or hours and try again later
- Bad network connection: your firewall is blocking the connection, or your internet connection is not working correctly
Often, an old yum cache is the bad guy. Try clearing the yum cache with these two commands:
rm -fr /var/cache/yum/*
yum clean all
The output should be something like:
Cleaning repos: base epel extras rpmforge updates vz-base vz-updates Cleaning up Everything
Now try again to update the system with sudo yum update. or (apt-get update) and the mirrors should be refreshed based on reachability and how fast they connect to your server:
Setting up Update Process
Determining fastest mirrors
Solve error [Errno 256] No more mirrors to try
When receiving this error. it means that you didn’t specify any (working) mirrors to update your system. You can either retry to update your operating system (so that your main mirror is working again), or you can add extra mirrors so that this error message is solved.
Adding a new repo to Linux can be done with just one single SSH command. Here is an example:
yum-config-manager --add-repo=http://vault.centos.org/centos/7.4.1708/extras/x86_64/