Somehow two packages (that I don't want anymore) got corrupted after a file system check and are now missing files.
I installed and initialized debsums and when I run it it gives a load of missing files (and only missing files).
I tried these commands (found all over the place):
sudo apt upgradesudo apt autoremovesudo apt install brscan4sudo apt remove brscan4sudo dpkg --configure -asudo apt install --reinstall brscan4sudo apt install -f --reinstall brscan4sudo apt-get -f install(without package name)sudo dpkg --remove --force-remove-reinstreq brscan4sudo apt-get purge --remove brscan4- [added]
dpkg -P brscan4
Notably, dpkg --configure -a seems to be recommended everywhere as if it's the final last-resort solution that's supposed to fix it.
They all give the exact same error:
Removing brscan4 (0.4.4-3) ...
/var/lib/dpkg/info/brscan4.prerm: 3: /var/lib/dpkg/info/brscan4.prerm: /opt/brother/scanner/brscan4/setupSaneScan4: not found
dpkg: error processing package brscan4 (--remove): installed brscan4 package pre-removal script subprocess returned error exit status 127
These commands do nothing to the corrupted packages:
sudo apt updatesudo apt update --fix-missing
How can I fix this short of reinstalling Ubuntu from scratch? (his final solution, see chat)