Recovering after crash during apt upgrade

I just had a completely frozen system while running an apt upgrade, leaving it in a somewhat broken state. I already ran apt --fix-broken install but stil when I now try to run an apt upgrade, this happens:

$ sudo apt upgrade
Summary:                        
  Upgrading: 0, Installing: 0, Removing: 0, Not Upgrading: 0
  1 not fully installed or removed.
  Space needed: 0 B / 886 GB available

Continue? [Y/n] y
Setting up flash-kernel (3.109+reform20250506T203207Z1) ...
Using DTB: freescale/imx8mp-mnt-pocket-reform.dtb
flash-kernel: deferring update (trigger activated)
Processing triggers for initramfs-tools (0.147) ...
update-initramfs: Generating /boot/initrd.img-6.14.5-mnt-reform-arm64
Using DTB: freescale/imx8mp-mnt-pocket-reform.dtb
Installing /usr/lib/linux-image-6.14.5-mnt-reform-arm64/freescale/imx8mp-mnt-pocket-reform.dtb into /boot/dtbs/6.14.5-mnt-reform-arm64/freescale/imx8mp-mnt-pocket-reform.dtb
Taking backup of imx8mp-mnt-pocket-reform.dtb.
Installing new imx8mp-mnt-pocket-reform.dtb.
Ignoring old or unknown version 6.14.5-mnt-reform-arm64 (latest is 6.14.5-mnt-reform-arm64.dpkg-tmp)
Processing triggers for flash-kernel (3.109+reform20250506T203207Z1) ...
Using DTB: freescale/imx8mp-mnt-pocket-reform.dtb
Couldn't find DTB imx8mp-mnt-pocket-reform.dtb in /usr/lib/linux-image-6.14.5-mnt-reform-arm64.dpkg-tmp or /etc/flash-kernel/dtbs
Installing  into /boot/dtbs/6.14.5-mnt-reform-arm64.dpkg-tmp/freescale/imx8mp-mnt-pocket-reform.dtb
cp: cannot stat '': No such file or directory
dpkg: error processing package flash-kernel (--configure):
 installed flash-kernel package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 flash-kernel
Error: Sub-process /usr/bin/dpkg returned an error code (1)

Any advice on how to proceed?

edit: Bad advice. I’ll not delete my post to keep the comment of @josch valid.

was:

Possibly:

$ find /usr/ -type f -name imx8mp-mnt-pocket-reform.dtb -exec ls -l '{}' ';'
$ sudo cp </path/to/plausible/looking/imx8mp-mnt-pocket-reform.dtb> /etc/flash-kernel/dtbs/
$ sudo dpkg --configure -a

Hi, sorry that this happened. Lets use this as a chance to make the scripts more robust against upgrades being suddenly interrupted in the middle. I have to take care of family stuff right now but will be back in ~6 hours.

Until then: could you take a snapshot of your current system somehow? I think the situation you are currently in is extremely interesting and it would be nice to be able to reconstruct completely what is happening after having repaired it. You can still boot, right?

Also, what @sander writes is not how to make device trees available to flash-kernel. The interesting bit about your log is the dpkg-tmp version and the empty string. I would like to exactly find out how this can happen and then fix it.

Sorry, I already found a fix before I saw your comment.

Reinstalling the kernel package (apt-get --reinstall install apt-get --reinstall install linux-image-6.14.5-mnt-reform-arm64) did the trick to restore the missing directory (/usr/lib/linux-image-6.14.5-mnt-reform-arm64.dpkg-tmp)

1 Like