Error updating/upgrading

Whenever I try to update/upgrade, either using apt-get or openhabian-config, I get the following error:

dpkg: error processing archive /var/cache/apt/archives/openhab2_2.2.0-1_all.deb (–unpack):
subprocess new pre-removal script returned error exit status 127

Any guidance? I’ve tried purging dpkg and getting a new package, to no avail

Hi @dpierron, Which version are you moving from and to?

What Linux system are you running on?

Hi @Benjy I’m running openhabian on a raspberry pi 2 and have openhab 2.1.0-1, wanting to update to 2.2.0-1

Status 127 usually indicates a command can’t be found. I’ve just tested an upgrade from 2.1.0-1 now and it was successful, let’s see if we can debug:

  1. Would you be confirm that /etc/apt/sources.list.d/openhab2.list contains:
deb https://dl.bintray.com/openhab/apt-repo2 stable main
  1. Could you post the contents of /var/lib/dpkg/info/openhab2.prerm (Remember to paste inside ```these marks```

  2. Could you post the full response of:

sudo dpkg --configure -a
sudo apt -f install
sudo apt install openhab2

@Benjy /etc/apt/sources.list.d does not contain openhab2.list. Seems problematic

Similarly, /var/lib/dpkg/info does not contain openhab2.prerm

Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
pi@raspberrypi:/var/lib/dpkg/info $ sudo apt install openhab2
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package openhab2

EDIT Please ignore, ran these in the wrong terminal window...

@Benjy:

openhab2.list contains the correct content

/var/lib/dpkg/info/openhab2.prerm contains:

  remove|deconfigure|0)
    # 0 Indicates removal on an RPM system
    stopOpenHAB
    exit 0
    ;;
  failed-upgrade)
    ;;
esac

exit 0

Full response as requested is:

[13:42:53] openhabian@openHABianPi:/etc/apt/sources.list.d$ sudo apt -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
[13:43:17] openhabian@openHABianPi:/etc/apt/sources.list.d$ sudo apt install openhab2
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
  openhab2
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/68.6 MB of archives.
After this operation, 16.4 MB of additional disk space will be used.
Reading changelogs... Done
(Reading database ... 55591 files and directories currently installed.)
Preparing to unpack .../openhab2_2.2.0-1_all.deb ...
/var/lib/dpkg/info/openhab2.prerm: 1: /etc/default/openhab2: -Dpython.home=/users/danpierron/jython2.7.0: 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/openhab2: -Dpython.home=/users/danpierron/jython2.7.0: not found
dpkg: error processing archive /var/cache/apt/archives/openhab2_2.2.0-1_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/openhab2_2.2.0-1_all.deb
Updating FireMotD available updates count ...
E: Sub-process /usr/bin/dpkg returned an error code (1)

Alright, it looks like the problem is in /etc/default/openhab2, the first line looks like it starts with -Dpython.home, which is invalid. Try commenting this line out for now.

If that doesn’t work, would you be able to show the contents of this file?

That fixed it, thank you very much!

1 Like