"apt upgrade" hangs fetching packages to apply maintenance

cn flag

I've been having a lot of trouble using apt to apply software updates to my Raspberry Pi systems. Most of them are running the ARM version of Ubuntu 22.04.1 LTS and the Pi-Zero system is using the latest "bullseye" flavor of "Pi OS".

Often when I try to do an "apt upgrade", it will lock up downloading the package files. My network and local wi-fi is super reliable with high download speeds and my ssh session within my local network is rock solid even when apt becomes hung. Most of the Pi systems are wi-fi connected, but one is directly hardwired with CAT-5. (I also know that the Internet connection is working perfectly too, by the video streams and other applications running on every other device in the house). In those cases, apt's downloads will be flying along and then suddenly stop downloading, sometimes in the middle of an individual package download. The download will never recover themselves at all - ever. The more updated packages apt is trying to process, the more likely it is to lock up like this.

I had to totally re-build the two Pi-4 Ubuntu systems (4GB and 8GB models with 64GB SD cards for the file system) a few months ago, because one of the standard apt updates removed my physical display monitors from the system configuration back in December 2022. (I use them for security camera displays, so no longer having a display was a big problem). Since then, I've had to totally stop trying to install any apt upgrades at all on those systems because I had no idea which update broke the displays or what to do about it. Snap still works for upgrading Firefox. Even if I was to take a gamble and try to run a full "apt upgrade" again, given this hanging behavior would certinally occur with the over 200 missing updates - there is no way it would actually work.

I've tried upgrading individual packages on the Pi-Zero (only 1GB memory but still with a 64GB SD card for the file system) by manually running "apt install" on each upgraded package, but even this hangs and goes off into the weeds much of the time.

I've seen this same problem occur with the GUI software update utility too, so it is not just limited to the command line apt command either.

I'm puzzled that apt doesn't seem to notice that its I/O is totally hung and does nothing to recover from it. Indeed, it'll sit there for hours in a hung state until I usually have to do a hard power reset to reboot the system to recover from this.

I've used rpm and yum on other systems over the years and have never seen these types of "run like a rabbit into a brick wall" problems. I've no idea how to diagnose these problems further, especially given that it's clearly not any problem with my local network or its connection to the Internet. Usually the mirror repositories that apt is downloading from are homed by a big school that is fairly local to me, with pretty fast 5 to 15MB/sec downloads right up until the I/O hangs.

Any thoughts, suggestions, or alternate maintenance tools that I could try would be welcome! Thanks!

Artur Meinild avatar
vn flag
I've been running Ubuntu Server 20.04 (now 22.04) on a Raspberry Pi 4 for over 3 years, and I've never encountered any problems with `apt` package upgrades - just saying.
guiverc avatar
cn flag
This is a Ubuntu Q&A support site; so why mention off-topic Debian/Pi OS. Your Ubuntu 22.04 is outdated showing its well behind on security upgrades ( will show the release of 22.04.2 but installed systems upgraded before that ISO/image release date). You didn't provide specifics, so we'd mostly be guessing, on a rather *unclear* & somewhat *verbose* question. FYI: Your details would have me checking your storage/SD cards.. they do die out with usage..
Artur Meinild avatar
vn flag
It sounds like your Raspberry Pi's have other issues than with `apt` upgrades. It would be good if you could clarify: Is it only `apt` that's locking up, or is it the entire Ubuntu OS? This is important troubleshooting info.
Artur Meinild avatar
vn flag
Please provide more troubleshooting info: `apt` version (output from `apt policy apt`), which mirrors are included (output from `sudo apt update`).
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.