After upgrading from a Linux Debian 11 to Debian 12, there remained two older Kernel 5.x which was said to be Debian 11 kernel and that Debian 12 has 6.x kernel.
Later, maybe as a result of cleaning orphan packages by the command
Code:
sudo apt purge '~o'
where it wanted to remove old kernel 5.x (and so had to rebuild the GRUB?), I have seen following error:

/etc/grub.d/bin/grubcfg_proxy: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.10.0-32-amd64 (--remove):
installed linux-image-5.10.0-32-amd64 package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
linux-image-5.10.0-32-amd64
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
After looking up for the error on search engine, i read that the issue may be caused by the grub-customizer application and since i have it, I have launched it and it immediately suggested that there are unsaved changes, so I have saved them (seeing the menu entries looks fine).

After doing that and running:
Code:
sudo apt update && sudo apt upgrade && sudo apt purge '~o'
I have no longer seen that error.