some more context probably helps: ... Setting up linux-image-5.15.0-3-amd64 (5.15.15-2) ... /etc/kernel/postinst.d/dkms: dkms: running auto installation service for kernel 5.15.0-3-amd64:. /etc/kernel/postinst.d/initramfs-tools: update-initramfs: Generating /boot/initrd.img-5.15.0-3-amd64 ... /etc/kernel/postinst.d/zz-update-grub: Generating grub configuration file ... Found linux image: /boot/vmlinuz-5.15.0-3-amd64 Found initrd image: /boot/initrd.img-5.15.0-3-amd64 ... Setting up virtualbox-dkms (6.1.32-dfsg-1+b1) ... Loading new virtualbox-6.1.32 DKMS files... Building for 5.15.0-3-amd64 Building initial module for 5.15.0-3-amd64 ... Processing triggers for initramfs-tools (0.140) ... update-initramfs: Generating /boot/initrd.img-5.15.0-3-amd64 ...
so it would appear that the mistake is that the kernel postinst does an instantaneous initramfs update, rather than letting the trigger take care of it, after DKMS has built the modules of other upgraded packages.
it may also make sense to sequence the grub setup after the initrd setup, so it doesn't register kernels for which building the initrd failed.