Openhab using apt-get bad package

Hi,

An attempt to install openhab-addon-action-mqtt-1.8.1.deb caused a re-install of openhab-runtime (from 1.8.1 to 1.8.2) which failed and now is partially installed. Java is no longer available and apt-get will not allow anything to be installed. Complains about the partially installed openhab. I cannot remove, reinstall or install. Here is the message that occurs during install using dpkg (same occurs using apt-get -f install). file exists in /etc/default.
I have tried everything short of rebuilding the package. Any ideas?

dpkg -i openhab-runtime-1.8.2.deb
(Reading database … 50689 files and directories currently installed.)
Preparing to replace openhab-runtime 1.8.2 (using openhab-runtime-1.8.2.deb) …
/var/lib/dpkg/info/openhab-runtime.prerm: 1: /etc/default/openhab: #: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead …
/var/lib/dpkg/tmp.ci/prerm: 1: /etc/default/openhab: #: not found
dpkg: error processing openhab-runtime-1.8.2.deb (–install):
subprocess new pre-removal script returned error exit status 127
Errors were encountered while processing:
openhab-runtime-1.8.2.deb

  1. Backup your configs
  2. Try an apt-get install --force openhab-runtime
  3. If that doesn’t work see:
    http://askubuntu.com/questions/525088/how-to-delete-broken-packages-in-ubuntu

If that doesn’t work you can go full on nuclear. NOTE: You can seriously bork your system messing around with these files, proceed with caution.

sudo pico /var/lib/dpkg/info/openhab-runtime.prerm

# comment out everything

sudo pico /var/lib/dpkg/info/openhab-runtime.postrm

# comment out everything

sudo apt-get purge openhab-runtime
sudo apt-get install openhab-runtime

This will disable all of the uninstall scripts which is failing due to certain folders not being there.

Hi Rich,

Thanks… I have tried everything you suggested with no success. I will
look at how to delete broken packages. The error states there are broken
packages, however aptitude does not report broken packages. apt-get
install the …mqtt.action… which attempted to update openhab broke the
package system and reports the openhab package is bad. Java among other
stuff was uninstalled or corrupted. The scripts you mention, I
commented out lines, however during the apt-get install --force
openhab-runtime these files are replaced and generate errors. The file
the script states does not exist is on the file system. I used aptitude
to build-dep for java and successfully installed java. Openhab is
installed and now with java reinstalled will execute but cannot do
anything with openhab-runtime with aptitude or apt-get. It may be time
to completely rebuild the system.