Apt Update/Upgrade Problem

I’m trying to update my Pi using the normal apt update / upgrade route, but it’s giving errors.

From what I can see it’s trying to do a kernel update, but there seems to be some issues with the files it is downloading and some segmentation faults. The full transcript of the sequence is pasted on pastebin:


The first error I can see in it is on line 459, which seems to be some sort of corrupt data when it’s decompressing the new kernel file.

Can anyone shed any light on what’s going wrong? Is it an SD card that’s dying, or is there something else here that can be fixed?

After it fails, anything tried using sudo just gives a segmentation fault, but generally the device is working fine otherwise and if I just pull the power on it and restart it then it also seems to run fine.

It’s running dietpi 6.33.3, with installs of WireGuard, PiHole and RPi-Monitor. it used to also host Home Assistant, but that was removed and migrated onto its own Pi4 under Hass.io (or whatever it’s now called).


this is the normal Debain apt update process and not DietPi specific. Some downloaded files seems to be corrupted. Can you verify you have enough free space? As well you could try to clean apt cache

/boot/dietpi/func/dietpi-set_software apt-cache clean
apt update
apt upgrade

Thanks - tried that and after initially looking hopeful it’s still giving a similar error when it tried to update the kernel (looks very similar to the stuff I pastebin’d before overall, the main error is below):

Unpacking raspberrypi-kernel (1.20201201-1) over (1.20201022-1) ...
dpkg-deb (subprocess): decompressing archive member: lzma error: compressed data is corrupt
dpkg-deb: error: <decompress> subprocess returned error exit status 2
dpkg: error processing archive /tmp/apt-dpkg-install-KDaQRK/10-raspberrypi-kernel_1.20201201-1_armhf.deb (--unpack):
 cannot copy extracted data for './lib/modules/5.4.79-v7l+/kernel/drivers/net/usb/cdc_ncm.ko' to '/lib/modules/5.4.79-v7l+/kernel/drivers/net/usb/cdc_ncm.ko.dpkg-new': unexpected end of file or stream

Plenty of space available according to df - about 25.5GB free on /dev/root and 197MB on /boot.

Any thoughts, or would it be one to just go to a back-up and restore to the card?

I’ve restored the backup onto a new card and that’s updating fine, so it’s either something corrupted on the previous set-up somewhere or that original SD card is dying.

Anyway I’ll check the card out later for issues, but for now I’m back up and running again without further issues so this one can be closed off.

it’s always good to have a backup available. probably there are physical issues on the original SD card preventing files to be download correctly. Good that you are back online now