OPKG Update Fail: wget returned 4

I've been having problems on this topic since updated to 21.02 last Aug'2021 (never during last 4 years before that). Read many posts alike, tried different solutions, apparently worked for some time (probably until next reboot) but at the end the problem still there.

Seems something on Network configuration related with DNS and how wget uses it. If IPV6 is disabled, it works properly, but I do want to use both as it should work.

I use an ATT Gateway (IPv6 Enabled and seeming working), with a Cisco EA4500 router running OpenWRT and then my home LAN behind. If using Netgear R7800 (also from scratch with similar config) same problem.

Basically:

~# opkg update
Downloading https://downloads.openwrt.org/releases/21.02.1/targets/kirkwood/generic/packages/Packages.gz
*** Failed to download the package list from https://downloads.openwrt.org/releases/21.02.1/targets/kirkwood/generic/packages/Packages.gz
.
Collected errors:
 * opkg_download: Failed to download https://downloads.openwrt.org/releases/21.02.1/targets/kirkwood/generic/packages/Packages.gz, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

With pretty basic Network config:

~# cat /etc/config/network

config interface 'loopback'
        option device 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix '<auto generated IPv6 prefix>'

config device
        option name 'br-lan'
        option type 'bridge'
        list ports 'ethernet1'
        list ports 'ethernet2'
        list ports 'ethernet3'
        list ports 'ethernet4'

config interface 'lan'
        option device 'br-lan'
        option proto 'static'
        option ip6assign '60'
        option ipaddr '<Router IPv4>'
        option netmask '255.255.255.0'
        option defaultroute '0'
        list dns '<Gateway IPv4>'
        list dns '208.67.222.222'
        list dns '8.8.8.8'

config device
        option name 'internet'
        option macaddr '<mac address>'

config interface 'wan'
        option device 'internet'
        option proto 'dhcp'

config interface 'wan6'
        option device 'internet'
        option proto 'dhcpv6'
        option reqaddress 'try'
        option reqprefix 'auto'

config interface 'vpn'
        option device 'tun0'
        option proto 'none'

And DNS seeming to resolve both protocols...

~# ping -4 downloads.openwrt.org
PING downloads.openwrt.org (168.119.138.211): 56 data bytes
64 bytes from 168.119.138.211: seq=0 ttl=46 time=138.660 ms
64 bytes from 168.119.138.211: seq=1 ttl=46 time=138.148 ms
64 bytes from 168.119.138.211: seq=2 ttl=46 time=137.723 ms
--- downloads.openwrt.org ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 137.538/138.097/138.660 ms

~# ping -6 downloads.openwrt.org
PING downloads.openwrt.org (2a01:4f8:251:321::2): 56 data bytes
64 bytes from 2a01:4f8:251:321::2: seq=0 ttl=49 time=142.430 ms
64 bytes from 2a01:4f8:251:321::2: seq=1 ttl=49 time=141.387 ms
64 bytes from 2a01:4f8:251:321::2: seq=2 ttl=49 time=140.765 ms
--- downloads.openwrt.org ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 140.765/141.222/142.430 ms

But Wget still doesn't connect:

~# wget https://downloads.openwrt.org/releases/21.02.1/targets/ipq806x/generic/packages/Packages.gz
Downloading 'https://downloads.openwrt.org/releases/21.02.1/targets/ipq806x/generic/packages/Packages.gz'
Connecting to 2a01:4f8:251:321::2:443
Connection error: Connection failed

In LAN interface tried cleaning "Use default gateway", tried the "Use custom DNS server" with Gateway, OpenDNS and GoogleDNS, got it working once, but then back to problem next day after rebooting.
In WAN and WAN6 interface tried unchecking "Use DNS servers advertised by peer" in WAN Interface with the same "Use custom DNS server" as in LAN, nothing.

Any other ideas?
Thanks in advance.

Do you have the full GNU wget? Or just the uclient-fetch serving as wget?
You might opkg install wget-ssl

The fact that ping works, but wget fails, points toward some problem with the download tool, or something like misconfigured HTTPS proxy

1 Like

Standard Wget coming with BusyBox v1.33.1 in last sysupgrade to 21.02.1, r16325-88151b8303, without "keeping config" to ensure I was starting from scratch.

Will disable IPv6 and download wget-ssl to try it... be back in some mins...

Stopped WAN6 interface, opkg updated properly, installed wget-ssl, restarted WAN6 interface and opkg update still worked properly!!!... Rebooted and still worked fine!!!...

Tried also on the second router in which I was having the same problem, knowing the solution I tried all possible combinations, but the only that worked was installing wget-ssl... maybe that package or some of it's dependencies was always included in the standard installation package and that was the reason I didn't have this problem until now!

Thanks hnyman!

I leave the topic open for a week, I'll be back if it returns :slight_smile:

The "standard wget" in OpenWrt does not come from busybox, but is a small OpenWrt specific small tool uclient-fetch. It seems to fail under some IPv6 configurations.

Great that the full GNU wget-ssl worked for you.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.