Open In App

How to Fix - Wget: Failed: Connection Timed Out

Last Updated : 11 Apr, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

In Linux, while downloading files using the wget command, encountering the "Wget: Failed: Connection Timed Out" error is common, often due to network instability, server unavailability, or firewall restrictions. To address this, adjusting timeout settings, implementing retry options, or utilizing mirrored servers can effectively mitigate connection timeout issues and ensure successful file downloads using wget.

How to Fix - Wget: Failed: Connection Timed Out

Below are the solutions to resolve the "Wget: Failed: Connection Timed Out" problem in the Linux Operating System.

Solution 1: Increase Timeout

Increasing the timeout with wget --timeout=seconds URL extends the duration wget waits for a response from the server before timing out. This solution is effective when slow or unstable network connections cause connection timeouts during downloads. Adjusting the timeout value allows wget to wait longer for the server to respond, reducing the likelihood of the "Connection Timed Out" error.

Syntax:

wget --timeout=seconds URL

Example:

wget --timeout=10 https://media.geeksforgeeks.org/wp-content/uploads/20240406144401/2-min.png

Output:

Increase Timeout
Increase Timeout

Solution 2: Retry Option

Using the retry option with wget --tries=num URL specifies the number of times wget should retry the connection if it times out initially. This approach is helpful in dealing with intermittent network issues or temporary server unavailability, increasing the chances of a successful download by making multiple connection attempts.

Syntax:

wget --tries=num URL

Example:

wget --tries=3 https://media.geeksforgeeks.org/wp-content/uploads/20240406144401/2-min.png

Output:

Retry Option
Retry Option

Solution 3: Use a Mirror

Utilizing a mirror with wget --tries=num --mirror URL allows wget to download from a mirrored server if the primary server experiences connectivity issues. Mirrors can provide alternative routes to access the content, reducing the likelihood of connection timeouts and improving download reliability.

Syntax:

wget --tries=num --mirror URL

Example:

wget --tries=3 --mirror https://media.geeksforgeeks.org/wp-content/uploads/20240406144401/2-min.png

Output:

Use a Mirror
Use a Mirror

Conclusion

In conclusion, addressing "Wget: Failed: Connection Timed Out" errors in Linux involves adjusting timeout settings, retrying connections, or utilizing mirrored servers with wget commands. These solutions help mitigate network instability, server unavailability, and firewall restrictions, ensuring successful file downloads despite connection timeout issues.


Next Article
Article Tags :

Similar Reads