Cannot install updates - OOM

Hello,

I have a headless server running fedora34 (arm64) with 512M of ram and the same amount of zram but every time I launch a dnf update I get killed by the oom killer :

free -m
total used free shared buff/cache available
Mem: 428 92 283 0 52 325
Swap: 427 39 388

Out of memory: Killed process 13778 (dnf) total-vm:487472kB, anon-rss:27676kB, file-rss:816kB, shmem-rss:0kB, UID:0 pgtables:988kB oom_score_adj:0

Is there any workaround to this ? I have a debian that runs on 256Mb without issue so I wonder if this is a bug on dnf ?

I haven’t run into this in a long time (probably a lot because I am no longer a professional sysadmin!), but when I ran into this in the past, what I did was split the transaction: something like:

for l in {a..z}; do sudo dnf -y upgrade "$l*"; done

Followed by a final sudo dnf -y upgrade to catch anything which starts with a number or something.

Unfortunately I get killed multiple times :grinning:

for l in {a…z}; do sudo dnf -y upgrade “$l*”; done
Killed
Killed
Killed

Which image are you running? The Fedora Server Edition includes a number of services like Cockpit that you may not need.

Using the Fedora 34 Minimal (AArch64) image on the Raspberry Pi 3B+ and limiting the memory to 432M of RAM, dnf runs without hitting the oom killer.

If you would like to remain on the edition you have now, dnf should be able to complete when using a swap file:

fallocate -l 1G /swapfile
mkswap /swapfile
chmod 0600 /swapfile
swapon /swapfile

I would recommend disabling the swapfile after use to reduce writing to the SD card.

2 Likes

Thanks a lot, I love how you learn every day on linux :smiley:

One neat thing is that zram swap will combine with the fileswap created so I managed to get away with 400M swapfile since I was also a bit short on disk space

I’m running the cloud edition and basically stopped everything (auditd, policykit, resolved …)

1 Like