28

I tried installing imagemagick package by sudo apt-get install imagemagick

I'm getting the following error now, how to fix it.

$ sudo apt-get install imagemagick
Reading package lists... Done
Building dependency tree       
Reading state information... Done
imagemagick is already the newest version (8:6.9.7.4+dfsg-16ubuntu2.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up install-info (6.4.90.dfsg.1-1build1) ...
/usr/sbin/update-info-dir: 2: /etc/environment: TESSDATA_PREFIX: not found
dpkg: error processing package install-info (--configure):
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)
abu_bua
  • 11,313
Shan Khan
  • 1,351

2 Answers2

97
sudo mv /var/lib/dpkg/info/install-info.postinst /var/lib/dpkg/info/install-info.postinst.bad

Alternatively a shorter command:

sudo mv /var/lib/dpkg/info/install-info.postinst{,.bad}

Fixes the problem.

Artur Meinild
  • 31,035
Shan Khan
  • 1,351
0

I had this problem when updating mongodb-org. As error message says, the problem is with some env variables in /etc/environment and you can solve it by temporarily commenting those variables.

In your case, the problem is TESSDATA_PREFIX.

/usr/sbin/update-info-dir: 2: /etc/environment: TESSDATA_PREFIX: not found
dpkg: error processing package install-info (--configure):
 subprocess installed post-installation script returned error exit status 127

Comment it out in /etc/environment and installation will pass the problem. after the installation you can uncomment your env variable.

PATH=....
# TESSDATA_PREFIX= ....

This solution also works for error code 126 (which I had encountered).

/usr/sbin/update-info-dir: 4: /etc/environment: /opt/app: Permission denied
dpkg: error processing package install-info (--configure):
 installed install-info package post-installation script subprocess returned error exit status 126
smrachi
  • 111