RPi-Distro / repo

Issue tracking for the archive.raspberrypi.org repo
37 stars 1 forks source link

apt update hangs on 512MB models running desktop #353

Closed trejan closed 3 weeks ago

trejan commented 7 months ago

There have been a few people complaining that apt update fails on Pi Zero 2 running desktop edition. The symptom is that it hangs during the reading changelogs step. The cause appears to be insufficient RAM as increasing CONF_SWAPSIZE in /etc/dphys-swapfile from 100 to 512 fixes it.

Running desktop on a 512MB model isn't optimal but updates should still work even if its slow. 64-bit Bookworm Lite does update without any problems but that has much more free RAM without the GUI running.

The dphys-swapfile package is already modified by Raspberry Pi to set 100MB so maybe time to increase the default?

XECDesign commented 6 months ago

This seems to be happening because bookworm's version of dpkg has introduced multi-threaded decompression for xz by default. On the original, it would work fine, but then on a zero 2, using additional cores makes it eat more RAM.

The next image will have a version of sys-mods which limits dpkg to a single thread if the device does not have enough RAM. Don't know enough to say whether we should also increase swap.

Murray2015 commented 1 month ago

Hello! Dropping in to say a few people on this thread (inc. myself) are still finding this issue in the prod image. However, I don't have enough experience to be able to offer any help; sorry! 🙂

XECDesign commented 1 month ago

Thanks for the heads up. Looks like the dpkg fix wasn't enough in some cases and bumping swap is necessary.

I'll try defaulting to 200 instead and monitor if that's enough.

https://github.com/RPi-Distro/raspberrypi-sys-mods/commit/1f88fa7abe59d878920cd02582a5f1c1ec69f531 https://github.com/RPi-Distro/pi-gen/commit/75fe47c7571c533ad52c43e03b440b0116a157ea

znmeb commented 1 month ago

I've run into this issue and related ones in dpkg with every Bookworm variant I've tried on my Zero 2 Ws. The "lock up at 33%" is just one of the symptoms; I've also seen dpkg spin for minutes at 100 percent CPU unpacking a large file like Firefox. There just isn't enough RAM in a Pi Zero 2 W to run Bookworm or Ubuntu 24.04 - case closed.

Making a bigger swapfile is hardly a fix; swapping to an SD card every time you upgrade is nonsensical. Realistically, I'd recommend that the Raspberry Pi Imager limit the recommended options for the Pi Zero 2 W to just Bullseye and Ubuntu 22.04. Nothing else runs out of the box with no hassles.