Detect and fix grub install location issue
From https://discuss.freedombox.org/t/cannot-install-apps-or-update-endless-loop/2319, where the user copied the amd64 image to an internal disk. The error appears during automatic updates:
Setting up grub-pc (2.06-3~deb11u1) ...
You must correct your GRUB install devices before proceeding:
DEBIAN_FRONTEND=dialog dpkg --configure grub-pc
dpkg --configure -a
dpkg: error processing package grub-pc (--configure):
installed grub-pc package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
grub-pc
Currently, only for dist upgrade, we have a workaround to ignore this error. I think we need a more general fix for regular updates. We will need to detect the device where FreedomBox is installed, and set the debconf configuration for grub-pc.