I'm struggling with installing OpenWrt and stuck at a problem which doesn't seem to happen very frequently. Any kind of help would be very much appreciated.
Router: FRITZ!Box 4040 CB (recently bought, used, but with original firmware on it, afaik) Computer OS used for flashing: Debian-based Linux distro OpenWrt version: 24.10.5 Connection: Ethernet-cable, while WiFi deactivated on computer
Following the installation instructions (via EVA FTP, according to https://openwrt.org/toh/avm/avm_fritz_box_4040) everything works fine and easy until starting the transfer. Initially, data is transferred at more than 200 kB/s. But every single time I tried, progress stopped between around 25% and 75%, the connection got reported as "stalled" and later ran into a timeout.
I did quite a lot of internet search on it, but couldn't even get something close to my problem.
Does anybody have a clue what I could do (apart from repeating the procedure a lot and hoping to reach 100% at some point)?
you can use a “Debian live” system reduces software-related variables, but it does not eliminate NIC auto-negotiation issues.
I would still recommend forcing the interface to 100Mbps full duplex using ethtool.
1. Install "tnftp" (tnftp is generally more reliable than the default ftp client for EVA transfers.) and “ethtool” (to force a 100Mb link in your case):
3. Connect the network cable from the Debian PC to the router (using a LAN port)
4. Remove the router's power cable
5. Start the script, THEN power on the router.
6. Then “Power” on the router
#!/bin/sh
set -e
dev="eth0" # insert correct device
# download correct file (in the same directory as the script):
# https://downloads.openwrt.org/releases/24.10.5/targets/ipq40xx/generic/openwrt-24.10.5-ipq40xx-generic-avm_fritzbox-4040-squashfs-eva.bin
image="openwrt-24.10.5-ipq40xx-generic-avm_fritzbox-4040-squashfs-eva.bin"
# Check image file
if [ ! -f "$image" ]; then
echo "Error: file '$image' does not exist."
exit 1
fi
# Check network interface
if ! ip link show dev "$dev" > /dev/null 2>&1; then
echo "Error: network interface '$dev' does not exist."
exit 1
fi
ip link set down "$dev"
ip addr flush dev "$dev"
# Disable offloading
ethtool -K "$dev" tso off gso off gro off 2>/dev/null || true
# Force 100Mbps full duplex
ethtool -s "$dev" speed 100 duplex full autoneg off 2>/dev/null || true
ip link set up "$dev"
ip addr add 192.168.178.2/24 dev "$dev"
echo "Interface ready. Waiting for router (EVA)..."
echo "Start this script, THEN power on the router."
while ! ping -c 1 -w 1 192.168.178.1 > /dev/null 2>&1; do
ip link set up "$dev"
echo "wait 1 second"
sleep 1
done
sleep 1
echo "EVA detected. Starting FTP transfer..."
# The user name is real adam2 and the password is adam2
# -q 150 quits if the transfer stalls for 150 seconds
if tnftp -n -v -q 150 -p "192.168.178.1" << EOF
quote USER adam2
quote PASS adam2
binary
quote MEDIA FLSH
put $image mtd1
EOF
then
echo "Transfer completed."
echo "If no errors appeared above, flashing should be successful."
else
echo "command exit $?"
fi
Thank you very much for your recommendations. In order to identify the issue, I tested your hints separately. In the end, I'd say it was a timing issue.
Solution: I did the ftp commands by script, not typing manually as before.
Like this, the transmission reached 100% and the connection failed only during the final "quote check mtd1" step.
Conclusion: I'd thought that everything about timing was to start the ftp connection within a short time frame after powering on the router, but once you'd be connected, you had all the time you needed. But judging from my experience now, it seems like I had a total of 2-3 min to finish all ftp operations. When typing manually, I was never quick enough to start the transmission early enough for it to be completed in time.
Remaining question: Is there any disadvantage in not having completed the "check" step? Can I do it afterwards?
Further info:
I think I used tnftp all along, my distro seems to use a "dummy" ftp package redirecting to tnftp or something
ethtool settings didn't change anything, they didn't affect transmission speed at all
I did not use the entire script, just the ftp part
Personally, I have never executed the quote check mtd1 command after the transfer. In all cases where the file was uploaded to 100% without errors during the put process, the system booted correctly and the OpenWrt installation was successful.
For that reason, from my point of view, the “check” step does not seem strictly necessary in practice. If the router boots normally and the firmware runs without issues, it’s a strong indication that the flash process completed successfully.
I’m not sure whether it is possible to run quote check mtd1 at a later stage, once the system has already booted, since that command belongs to the EVA bootloader environment rather than OpenWrt itself. Most likely, the check can only be performed during the FTP session while still in the bootloader.