Why Are My Ubuntu Updates So Slow? Tracking Down Packet Loss on an Orange Pi 3 LTS
Troubleshooting slow apt downloads and a failed Pi-hole update on an Orange Pi 3 LTS, eventually narrowing the problem down to its gigabit Ethernet connection.
I went to update the Orange Pi that runs Pi-hole on my home network yesterday and ended up spending a good part of the morning troubleshooting its Ethernet connection.
I’ve had an Orange Pi 3 LTS running Ubuntu 22.04 (Jammy) for a while. It handles DNS and DHCP for my home network through Pi-hole, with Unbound as a local recursive DNS resolver. For the most part it’s one of those machines I don’t really think about until I need to update something.
The updates were painfully slow. I was also having trouble updating Pi-hole, which kept getting hung up downloading FTL, the part of Pi-hole that handles DNS queries and collects statistics. I figured there was probably something going on with DNS or with the Pi-hole updater. Neither turned out to be the problem.
Starting with Pi-hole
I tried repairing Pi-hole using its existing installer:
1
sudo /opt/pihole/update.sh -repair
The download of FTL was still giving me trouble. At one point I was getting a message suggesting the download URL didn’t exist, but looking more closely at what curl was doing, there was also an SSL EOF error. That means the encrypted connection ended unexpectedly, which is a somewhat different problem than a file not existing on the server.
I had also tried switching DNS from Quad9 to Cloudflare. Given that the machine itself runs a DNS service, it seemed like a reasonable place to start, but it didn’t explain why downloads were so slow even after a hostname had been resolved.
I used curl in verbose mode to get a better sense of where the connection was stalling:
1
curl -4 -vL https://github.com/ -o /dev/null
The IPv4 connection to GitHub could work, but there were these long pauses of four or five seconds as the connection was being established. It was odd enough that I figured it was worth backing up a bit and seeing what connectivity was like in general.
Pinging something other than a hostname
I started with Cloudflare’s public DNS IP address, but just to test network connectivity, not DNS.
1
ping -c 100 1.1.1.1
I was seeing 48% packet loss. Nearly half the packets weren’t making the round trip, which went a long way toward explaining why updating the machine had been such a miserable experience. TCP, the protocol used for these downloads, can recover from lost packets by retransmitting data, but at that rate it’s going to spend an awful lot of time doing so.
At this point there was no reason to keep fiddling with DNS. I wasn’t even using a hostname.
Next I pinged the router on my local network:
1
ping -c 100 10.0.0.1
40% packet loss on that one.
That was a much more useful result. The traffic wasn’t going out over my internet connection at all. The Orange Pi was having trouble communicating with a machine on the same network.
If you’re troubleshooting something similar, it’s worth doing both of these tests. If the router responds reliably but the public IP doesn’t, the problem may be further upstream. If both are losing packets, as they were here, start by looking at the local connection.
Looking at eth0
The Orange Pi is connected via Ethernet, so I started looking at the interface itself.
1
2
3
ip -s link show eth0
sudo ethtool eth0
sudo ethtool -S eth0
The first command shows the interface’s packet and error counters. The second shows the negotiated link settings, and the third shows additional driver-specific statistics if the driver supports them.
A couple of things stood out in the output:
| Item | What I found |
|---|---|
| RX dropped packets | 155,891 |
| RX errors | 0 |
| Negotiated speed | 1000 Mb/s |
| Duplex | Full |
| Auto-negotiation | On |
Interestingly, the hardware error counters I checked were also at zero. The connection appeared to be negotiating at gigabit speeds without reporting the sorts of errors I might have expected from a bad Ethernet link.
The RX drop counter was cumulative, so I couldn’t necessarily attribute all 155,891 drops to this particular incident. But between that and the ping results there was clearly something worth investigating.
Before changing the link speed, I replaced the Ethernet cable and tried a different port. Neither resolved the packet loss.
The Orange Pi 3 LTS has a gigabit Ethernet port. I really didn’t need gigabit speeds for the things this particular machine does, so I wanted to see what happened if I limited it to 100 Mb/s.
Dropping the link speed to 100 Mb/s
The machine uses NetworkManager to manage its wired connection. To see the connection profiles:
1
nmcli connection show
Mine was called Wired connection 1. I modified the profile as follows:
1
2
3
4
sudo nmcli connection modify "Wired connection 1" \
802-3-ethernet.auto-negotiate yes \
802-3-ethernet.speed 100 \
802-3-ethernet.duplex full
This keeps auto-negotiation enabled but restricts the advertised link mode to 100 Mb/s, full duplex. I wanted to retain auto-negotiation rather than disable it at one end of the connection and potentially introduce a duplex mismatch.
One advantage of doing this through NetworkManager rather than just changing the interface with ethtool is that the setting is stored in the connection profile and can persist through a reboot.
If you’re connected to the machine over SSH, bear in mind that applying a change to the active network connection or rebooting will interrupt your session. Make sure you have another way to access the machine if it doesn’t come back up.
After the change and reboot I checked the interface again:
1
sudo ethtool eth0 | grep -E 'Speed:|Duplex:|Auto-negotiation:'
The link was now running at 100 Mb/s, full duplex.
Testing it again
I went back to the same basic ping tests.
1
2
ping -c 100 10.0.0.1
ping -c 100 1.1.1.1
| Destination | Before | After |
|---|---|---|
| Local router | 40% loss | 0% loss |
| Cloudflare (1.1.1.1) | 48% loss | 0% loss |
Well, that made quite a difference.
I was able to update Pi-hole, including FTL, and the apt downloads that had been crawling along were now coming down quite quickly. There were 195 packages available to upgrade on Jammy, so it was nice to finally be able to get on with that.
I also checked that the services I rely on were still running after the reboot:
1
2
systemctl is-active unbound pihole-FTL docker
sudo docker ps
Apparently I’m not the only one
After getting the Pi-hole update out of the way, I got curious about whether other people had run into this on the Orange Pi 3 LTS. A Reddit thread from 2022 discusses slow Ethernet on this same board, and someone suggested dropping the connection to 100 Mb/s full duplex. That sounded awfully familiar.
I also came across a LibreELEC discussion about Ethernet timeouts and an Armbian discussion of a fix for Ethernet on some 3 LTS boards running 6.x kernels. There is also a DietPi issue involving Ethernet after a warm reboot.
One thing worth looking into if I revisit this is the board’s Motorcomm Ethernet PHY (the chip that handles the physical Ethernet connection) and the timing of the RGMII interface between it and the processor. A timing or driver configuration problem could potentially explain why the link negotiates at gigabit but doesn’t actually move traffic reliably.
These reports aren’t all describing the same failure, and I haven’t established that any of them has the same underlying cause as mine. Still, it’s good to know that other people have had trouble with Ethernet on this particular board, and that limiting the link to 100 Mb/s isn’t an entirely novel workaround.
So what was wrong?
I had already replaced the cable and tried a different port before dropping the link to 100 Mb/s, so I’m less inclined to think either of those was the problem. Given the other reports involving this particular board, I’m more suspicious of the Orange Pi’s Ethernet hardware or its driver, though I haven’t narrowed it down any further.
Gigabit Ethernet over copper uses all four wire pairs, while 100BASE-TX uses two. That’s why swapping the cable and trying another port were worth doing in the first place. Neither helped in my case, and the packet loss only went away after I changed the negotiated speed.
If I wanted to get gigabit speeds working again, I’d be more interested in investigating the Ethernet driver, PHY configuration and kernel version at this point.
For a Pi-hole server, though, 100 Mb/s is plenty for my purposes. My other devices don’t have to send their internet traffic through the Orange Pi just because they use it for DNS, so I’m not limiting the rest of my network to 100 Mb/s.
For now I’m leaving it at 100. I started out thinking I had a problem with a software update and ended up with a much better understanding of why a machine that reported a perfectly reasonable Ethernet link speed could be so frustratingly slow to use.