26

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
  • 10,783
Shan Khan
  • 1,241

1 Answers1

88
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
  • 26,018
Shan Khan
  • 1,241
  • Thanks this helps solved my problem when i tried to install mdadm – chrizonline Jun 04 '19 at 07:34
  • Yep. This solve the problem. Thanks. – Luís Assunção Jun 05 '19 at 10:49
  • Currently trying to install 19 from 17 and couldn't upgrade, this has allowed me to proceed with (at least, so far) apt-get update. Thanks! +1 – Dadou Dec 10 '19 at 02:16
  • 9
    Thank you. It solved my problem but can you explain the problem and solution. – Shaleen Jain Jan 20 '20 at 06:57
  • Thanks a bunch; this worked perfectly for me. What's puzzling is that the date stamp on the /var/lib/dpkg/info/install-info.postinst file is 10/10/2019. Why is this causing a problem only now? What just occurred to me is that I upgraded to Mint 20.2 (Uma) from 20.1 (Ulyssa) a couple of days ago, and this MIGHT be the first update I'm applying since that. Coincidence? Thanks for your thoughts. – Laurens Dehaan Aug 12 '21 at 03:52
  • when I was upgrade ubuntu 18.04 to 20. run sudo apt full-upgrade error. – 杨贤文 Jan 02 '23 at 16:37