Apt dietpi-update error



Details:

  • Date | 2025-02-27 10:21:47
  • Program name | DietPi-Update
  • Command | apt-get -y --with-new-pkgs upgrade
  • Exit code | 100
  • DietPi version | v9.10.0 (MichaIng/master)
  • Distro version | bookworm (ID=7,RASPBIAN=0)
  • Kernel version | Linux Pi4NAS 6.6.74+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.74-1+rpt1 (2025-01-27) aarch64 GNU/Linux
  • Architecture | arm64
  • Hardware model | RPi 4 Model B (aarch64) (ID=4)

Steps to reproduce:

  1. …I get this when I run APT update/upgrade or dietpi-update

Expected behaviour:

This first occurred with the last dietpi-update

Actual behaviour:

Everything else seems to work

Extra details:

Running apt purge linux-image-6.1.0-rpi4-rpi-v6 just returns the same error

ls -la /boot
drwxr-xr-x  4 root root     4096 Feb 27 10:20 .
drwxr-xr-x 19 root root     4096 Feb 24 11:55 ..
lrwxrwxrwx  1 root root       20 Feb 24 11:54 cmdline.txt -> firmware/cmdline.txt
-rw-r--r--  1 root root   199654 Oct  5  2023 config-6.1.0-rpi4-rpi-v6
-rw-r--r--  1 root root   204942 Oct  5  2023 config-6.1.0-rpi4-rpi-v7
-rw-r--r--  1 root root   223049 Oct  5  2023 config-6.1.0-rpi4-rpi-v7l
-rw-r--r--  1 root root   230343 Oct  5  2023 config-6.1.0-rpi4-rpi-v8
-rw-r--r--  1 root root   239262 Jan 27 17:19 config-6.6.74+rpt-rpi-v8
lrwxrwxrwx  1 root root       19 Feb 24 11:54 config.txt -> firmware/config.txt
drwxr-xr-x  4 root root     4096 Feb 23 22:55 dietpi
-rwxr-xr-x  1 root root    18092 Sep 23  2023 dietpi-LICENSE.txt
-rwxr-xr-x  1 root root    16059 Sep 23  2023 dietpi-README.md
-rw-r--r--  1 root root    17481 Jan 22  2024 dietpi.txt
-rwxr-xr-x  1 root root     3950 Sep 24  2023 dietpi-wifi.txt
drwxr-xr-x  5 root root     6144 Jan  1  1970 firmware
-rw-r--r--  1 root root 10360913 Oct 10  2023 initrd.img-6.1.0-rpi4-rpi-v6
-rw-r--r--  1 root root 10475428 Oct 10  2023 initrd.img-6.1.0-rpi4-rpi-v7
-rw-r--r--  1 root root 10677629 Oct 10  2023 initrd.img-6.1.0-rpi4-rpi-v7l
-rw-r--r--  1 root root 10587679 Oct 10  2023 initrd.img-6.1.0-rpi4-rpi-v8
-rw-r--r--  1 root root 10193787 Feb 27 10:20 initrd.img-6.6.74+rpt-rpi-v8
lrwxrwxrwx  1 root root       17 Oct 10  2023 overlays -> firmware/overlays
-rw-r--r--  1 root root       83 Oct  5  2023 System.map-6.1.0-rpi4-rpi-v6
-rw-r--r--  1 root root       83 Oct  5  2023 System.map-6.1.0-rpi4-rpi-v7
-rw-r--r--  1 root root       83 Oct  5  2023 System.map-6.1.0-rpi4-rpi-v7l
-rw-r--r--  1 root root       83 Oct  5  2023 System.map-6.1.0-rpi4-rpi-v8
-rw-r--r--  1 root root       83 Jan 27 17:19 System.map-6.6.74+rpt-rpi-v8
-rw-r--r--  1 root root  6664272 Oct  5  2023 vmlinuz-6.1.0-rpi4-rpi-v6
-rw-r--r--  1 root root  6990632 Oct  5  2023 vmlinuz-6.1.0-rpi4-rpi-v7
-rw-r--r--  1 root root  7429200 Oct  5  2023 vmlinuz-6.1.0-rpi4-rpi-v7l
-rw-r--r--  1 root root  8726865 Oct  5  2023 vmlinuz-6.1.0-rpi4-rpi-v8
-rw-r--r--  1 root root  9362120 Jan 27 17:19 vmlinuz-6.6.74+rpt-rpi-v8

Additional logs:

Reading package lists...
Building dependency tree...
Reading state information...
Calculating upgrade...
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up raspi-firmware (1:1.20241126-1) ...
rsync: [sender] change_dir "/usr/lib/linux-image-6.1.0-rpi4-rpi-v6" failed: No such file or directory (2)
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1338) [sender=3.2.7]
dpkg: error processing package raspi-firmware (--configure):
 installed raspi-firmware package post-installation script subprocess returned error exit status 23
Processing triggers for initramfs-tools (0.142+rpt3+deb12u1) ...
update-initramfs: Generating /boot/initrd.img-6.6.74+rpt-rpi-v8
W: No zstd in /usr/bin:/sbin:/bin, using gzip
'/boot/initrd.img-6.6.74+rpt-rpi-v8' -> '/boot/firmware/initramfs8'
Errors were encountered while processing:
 raspi-firmware
E: Sub-process /usr/bin/dpkg returned an error code (1)

---------------------------------------------------------------------

issue is with the package raspi-firmware

@MichaIng can you have a look pls

Hmm, looks like there are very old kernel packages installed (but new kernel stack already), which are incompatible with the recent raspi-firmware package. Can you check this please:

dpkg -l | grep linux
dpkg -S /lib/modules/6.1.0-rpi4-rpi-v8
dpkg -l | grep linux
ii  binutils-aarch64-linux-gnu    2.40-2                              arm64        GNU binary utilities, for aarch64-linux-gnu target
ii  console-setup-linux           1.221rpt1                           all          Linux specific part of console-setup
ii  firmware-linux-free           20200122-1                          all          Binary firmware for various drivers in the Linux kernel
ii  libselinux1:arm64             3.4-1+b6                            arm64        SELinux runtime shared libraries
ii  linux-base                    4.9                                 all          Linux image base package
ii  linux-image-6.6.74+rpt-rpi-v8 1:6.6.74-1+rpt1                     arm64        Linux 6.6 for Raspberry Pi v8, Raspberry Pi
ii  linux-image-rpi-v8            1:6.6.74-1+rpt1                     arm64        Linux for Raspberry Pi v8 (meta-package)
ii  linux-libc-dev                1:6.6.74-1+rpt1                     all          Linux support headers for userspace development
ii  util-linux                    2.38.1-5+deb12u3                    arm64        miscellaneous system utilities
ii  util-linux-extra              2.38.1-5+deb12u3                    arm64        interactive login tools
dpkg -S /lib/modules/6.1.0-rpi4-rpi-v8
dpkg-query: no path found matching pattern /lib/modules/6.1.0-rpi4-rpi-v8

Did you use rpi-update in October 2023?

However, seems like you need to remove them all manually:

rm /boot/*6.1.0-rpi4-rpi*
rm /lib/modules/*6.1.0-rpi4-rpi*

And check whether there is anything related in /usr/lib:

ls -l /usr/lib

/etc/kernel/postinst.d/z50-raspi-firmware tries to copy device trees and overlays from /usr/lib/linux-image-$(uname -r) to the boot partition, but I guess rpi-update did install them there directly and did not use /usr/lib at all, at that time. The /etc/kernel/postinst.d/z50-raspi-firmware package from the raspi-firmware package could be probably enhanced to deal with this case more gracefully, like skipping this copy attempt it the directory does not exist and the kernel version is below 6.6. But also it is probably a rare case.

It’s entirely possible that I did run rpi-update as I switched this Pi from Raspbian to DietPi back then.

rm /boot/*6.1.0-rpi4-rpi*
rm /lib/modules/*6.1.0-rpi4-rpi*
rm: cannot remove '/lib/modules/*6.1.0-rpi4-rpi*': No such file or directory
ls -l /usr/lib
total 428
drwxr-xr-x 30 root root  20480 Feb 25 08:21 aarch64-linux-gnu
drwxr-xr-x  5 root root   4096 Sep 24  2023 apt
drwxr-xr-x  2 root root   4096 Jan 13 10:08 binfmt.d
drwxr-xr-x  2 root root   4096 Feb  6 12:18 compat-ld
drwxr-xr-x  2 root root   4096 Oct 22  2023 console-setup
drwxr-xr-x  3 root root   4096 Oct 17  2023 cups
drwxr-xr-x  3 root root   4096 May 25  2023 dpkg
drwxr-xr-x  2 root root   4096 Jan 13 10:08 environment.d
drwxr-xr-x 43 root root  20480 Feb 25 08:21 firmware
drwxr-xr-x  3 root root  24576 Jan 27 10:05 git-core
drwxr-xr-x  2 root root   4096 Sep 24  2023 gnupg
drwxr-xr-x  2 root root   4096 Sep 24  2023 gnupg2
drwxr-xr-x  2 root root   4096 Feb  6 12:18 gold-ld
drwxr-xr-x  2 root root   4096 Sep 24  2023 hdparm
drwxr-xr-x  2 root root   4096 Sep 24  2023 ifupdown
drwxr-xr-x  2 root root   4096 Sep 24  2023 init
drwxr-xr-x  3 root root   4096 Jan 13 10:08 kernel
drwxr-xr-x  3 root root   4096 Feb 24 11:55 klibc
-rwxr-xr-x  1 root root 132040 Feb 12  2023 klibc-1XeOf7KyqJT__7eY0aO_DLo2_0c.so
lrwxrwxrwx  1 root root     39 Nov  6 12:48 ld-linux-aarch64.so.1 -> aarch64-linux-gnu/ld-linux-aarch64.so.1
-rw-r--r--  1 root root  23704 Feb 25  2023 libsupp.a
drwxr-xr-x  3 root root   4096 Mar 18  2024 linux
drwxr-xr-x  4 root root   4096 Feb 24 11:55 linux-image-6.6.74+rpt-rpi-v8
drwxr-xr-x  3 root root   4096 Nov 11 10:07 locale
drwxr-xr-x  3 root root   4096 Sep 24  2023 lsb
drwxr-xr-x  5 root root   4096 Oct 17  2023 mc
drwxr-xr-x  3 root root   4096 Apr  6  2023 mime
drwxr-xr-x  2 root root   4096 Jan 13 10:08 modprobe.d
drwxr-xr-x  4 root root   4096 Feb 24 11:55 modules
drwxr-xr-x  2 root root   4096 Jul 10  2023 modules-load.d
drwxr-xr-x  2 root root   4096 Oct 18  2023 mutt
drwxr-xr-x  2 root root   4096 Feb 18 17:00 openssh
-rw-r--r--  1 root root    267 Dec 31 10:25 os-release
drwxr-xr-x  2 root root   4096 Sep 24  2023 p7zip
drwxr-xr-x  2 root root   4096 Jan 13 10:08 pam.d
drwxr-xr-x  4 root root   4096 Sep 24  2023 pm-utils
drwxr-xr-x  3 root root   4096 Oct 17  2023 python3
drwxr-xr-x 34 root root  20480 Jan 13 10:08 python3.11
drwxr-xr-x  2 root root   4096 Oct 22  2023 raspberrypi-sys-mods
drwxr-xr-x  2 root root   4096 Feb 24 11:55 raspi-firmware
drwxr-xr-x  2 root root   4096 Oct 22  2023 rsyslog
drwxr-xr-x  2 root root   4096 Oct 17  2023 runit-helper
drwxr-xr-x  2 root root   4096 Nov 22  2022 sasl2
lrwxrwxrwx  1 root root     19 Feb 14 13:06 sftp-server -> openssh/sftp-server
drwxr-xr-x  3 root root   4096 Nov 11 10:07 ssl
drwxr-xr-x  2 root root   4096 Jan 13 10:08 sysctl.d
drwxr-xr-x 14 root root  12288 Jan 13 10:08 systemd
drwxr-xr-x  2 root root   4096 Jan 13 10:08 sysusers.d
drwxr-xr-x 16 root root   4096 May  7  2023 terminfo
drwxr-xr-x  2 root root   4096 Jan 13 10:08 tmpfiles.d
drwxr-xr-x  4 root root   4096 Jan 13 10:08 udev
drwxr-xr-x  2 root root   4096 Oct 17  2023 valgrind
apt update && apt upgrade -y
Hit:1 https://download.docker.com/linux/debian bookworm InRelease
Hit:2 https://archive.raspberrypi.com/debian bookworm InRelease
Hit:3 https://deb.debian.org/debian bookworm InRelease
Hit:4 https://deb.debian.org/debian bookworm-updates InRelease
Hit:5 https://deb.debian.org/debian-security bookworm-security InRelease
Hit:6 https://deb.debian.org/debian bookworm-backports InRelease
Hit:7 https://dietpi.com/apt bookworm InRelease
Hit:8 https://dietpi.com/apt all InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up raspi-firmware (1:1.20241126-1) ...
'/boot/vmlinuz-6.6.74+rpt-rpi-v8' -> '/boot/firmware/kernel8.img'
Processing triggers for initramfs-tools (0.142+rpt3+deb12u1) ...
update-initramfs: Generating /boot/initrd.img-6.6.74+rpt-rpi-v8
W: No zstd in /usr/bin:/sbin:/bin, using gzip
'/boot/initrd.img-6.6.74+rpt-rpi-v8' -> '/boot/firmware/initramfs8'
apt update && apt upgrade -y
Hit:1 https://deb.debian.org/debian bookworm InRelease
Hit:2 https://deb.debian.org/debian bookworm-updates InRelease
Hit:3 https://deb.debian.org/debian-security bookworm-security InRelease
Hit:4 https://download.docker.com/linux/debian bookworm InRelease
Hit:5 https://deb.debian.org/debian bookworm-backports InRelease
Hit:6 https://archive.raspberrypi.com/debian bookworm InRelease
Hit:7 https://dietpi.com/apt bookworm InRelease
Hit:8 https://dietpi.com/apt all InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Seems to have cleared the error.

1 Like

Great. Two things as cleanup:

  1. There are no Linux 6.1 modules left?
    ls -l /lib/modules
    
  2. Since the RPi does not need an initramfs, you can disable it and safe some processing time during kernel upgrades and disk usage:
    G_CONFIG_INJECT 'SKIP_INITRAMFS_GEN=' 'SKIP_INITRAMFS_GEN=yes' /etc/default/raspi-firmware
    rm /boot/initrd.img-* /boot/firmware/initramfs*
    
 ls -l /lib/modules
total 8
drwxr-xr-x 3 root root 4096 Sep 24  2023 6.1.21-v8+
drwxr-xr-x 3 root root 4096 Feb 24 11:55 6.6.74+rpt-rpi-v8

There was one 6.1 module left, I apt purge that and then rm the folder

ls -l /lib/modules
total 4
drwxr-xr-x 3 root root 4096 Feb 24 11:55 6.6.74+rpt-rpi-v8

I then disabled the initramfs and rebooted, everything seems to be running ok.

Thanks for your help.

1 Like

Great. Be careful with rpi-update, i.e. do not use it as long as it is not explicitly for testing or pulling a particular fix you need. It has no uninstall function or any such, so the installed kernel and firmware just remain on the system, and as seen here can start to cause issues at some point.

I guess there is also an RPi firmware directory left below /opt? That could be removed as well.

There is an /opt directory on all three of my DietPi’s, the one which has Pihole, also has a Pihole folder with some files. The others are empty folders.

It is not uncommon that /opt contains directories. /opt/vc would be the one from the old RPi firmware stack, and old rpi-update.