Opkg update command download fails…

I attempt to use this command to install ddns client, download always fails. Using Luci or command line. I set my lan DNS server to 1.1.1.1. I can ping, trace and traceroute OK. OpenWrt 19.07.4 r11208, Linksys wrt3200.

1 Like
cat <<'VVV' > /bin/opkgalt
#!/bin/sh
grep '^src' /etc/opkg/distfeeds.conf | sed 's!downloads!mirror-01.infra!g' > /tmp/distfeeds.conf
mount -o bind /tmp/distfeeds.conf /etc/opkg/distfeeds.conf
/bin/opkg ${*}
retval=$?
sleep 1
umount -l /etc/opkg/distfeeds.conf
exit $retval
VVV
chmod +x /bin/opkgalt
opkgalt update; opkgalt install PKG
4 Likes

Looks like a common problem.
Probably due to DDoS or some infrastructure issue.

1 Like

Before I do this; can someone please explain what is going on here and what those statements do?

A few days ago I was still perfectly able to use Luci to update the packages.

Running all statements results in nothing happening.
running only the first statement results in nothing happening and being stuck in a line that starts with >

Ok something did happen. am now able to update packages
EDIT: spoke to soon, only the list was updating

Executing package manager

Installing nano (5.3-1) to root...
Downloading http://downloads.openwrt.org/releases/19.07.4/packages/arm_cortex-a9_vfpv3-d16/packages/nano_5.3-1_arm_cortex-a9_vfpv3-d16.ipk

Errors

Failed to send request: Operation not permitted
Collected errors:
 * opkg_download: Failed to download http://downloads.openwrt.org/releases/19.07.4/packages/arm_cortex-a9_vfpv3-d16/packages/nano_5.3-1_arm_cortex-a9_vfpv3-d16.ipk, wget returned 4.
 * opkg_download: Check your network settings and connectivity.

 * opkg_install_pkg: Failed to download nano. Perhaps you need to run 'opkg update'?
 * opkg_install_cmd: Cannot install package nano.

I didn't test it, but basically the script is doing the following:

creating a new file (opkgalt), replacing download url with mirror url into a new file (tmp/distfeeds.conf), "hiding" old distfeeds.conf, handing over the packagename to opkg, "unhide" distfeeds.conf, making the new file executeable.

But I doubt that you will understand this if you do not have a bit of programming/scripting background knowledge. :smiley:

1 Like

O.K. I've tested it. It is not getting unmounted properly.
Modifying the script and inserting a sleep before unmounting helps to get it unmounted.

cat <<'VVV' > /bin/opkgalt
#!/bin/sh
grep '^src' /etc/opkg/distfeeds.conf | sed 's!downloads!mirror-01.infra!g' > /tmp/distfeeds.conf
mount -o bind /tmp/distfeeds.conf /etc/opkg/distfeeds.conf
/bin/opkg ${*}
sleep 5
umount /etc/opkg/distfeeds.conf
exit 0
VVV
chmod +x /bin/opkgalt

EDIT: Before exectuing again, execute:

mount

and lookout for (multiple) lines of:

tmpfs on /etc/opkg/distfeeds.conf type tmpfs (rw,nosuid,nodev,noatime)

and execute

umount /etc/opkg/distfeeds.conf

for each line you see.

2 Likes

Reason this is needed is that there is currently a server-side problem with one of the OpenWRT mirrors at the place that opkg downloads the lists and packages/target images from.

wulfy23's code simply changes to the working mirror to get you working during the outage.
There's been trouble for a few days, they are working on it though.

3 Likes

When the original server is back online, will this change need to be reverted back to original?

I ask cus many months/yrs could go by with me updating my router.

the original is apparently back...

the code was written to not be persistent... ( but you can reboot just to be sure )

1 Like

Yes, I confirmed server is back. Cool.

is this possibly my doing?

pls forgive me as I am a newcomer and have not yet fully understood the way (ip4) things work.

I am constantly banging 'time nslookup openwrt.org' to resolve;
[Solved] DNS freakishly slow on Guest network

DNS issues on my side.

Most likely not, as your issue seem to be related to L1-L2 rather than L3 or any upper layers:
https://en.wikipedia.org/wiki/OSI_model#Layer_architecture

I'm pretty sure you will see similar delays for other protocols.

1 Like

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