Thursday, November 10, 2011

Install / Troubleshoot "ttf-mscorefonts-installer" in Ubuntu

The package "ttf-mscorefonts-installer" provides an installer for Microsoft TrueType core fonts in Ubuntu. This package is installed automatically if you install the meta-package "ubuntu-restricted-extras". Many users face an issue when they are presented with End User License Agreement (EULA) in the Terminal and they don't know how to accept it, since clicks don't work in that dialog.


This package might also cause issues if it isn't installed properly, mainly because it downloads the fonts from SourceForge and as we've experienced, SourceForge servers are almost always overloaded. As the result, the download of the fonts doesn't complete successfully and the package is left in an inconsistent state by the system.

So this guide covers:
  1. Installing the Package
  2. Accepting the EULA
  3. Troubleshooting Related Issues
Installing the Package

If you want to install Microsoft TrueType core fonts in Ubuntu, you can either install the meta-package "ubuntu-restricted-extras", which gives you all the goods of fonts, audio and video codecs, flash, java, etc., or you can just install the package "ttf-mscorefonts'installer" individually:

sudo apt-get install ubuntu-restricted-extras

OR

sudo apt-get install ttf-mscorefonts-installer

Reinstalling the Package

If you have already declined the EULA, or it's marked as such for whatever else reason, you would first need to 'purge' the package "ttf-mscorefonts'installer" and then reinstall it (just using "dpkg-reconfigure" doesn't help in this case, unfortunately):

sudo apt-get purge ttf-mscorefonts-installer
sudo apt-get install ttf-mscorefonts-installer

Accepting the EULA

During the installation of this package, you are presented with a dialog like in the screenshot at the top (notice there, "<Ok>" is not selected by default).

Unfortunately, you can't handle those dialogs with your mouse. So what you need to do now is: Make sure your Terminal window is focused by clicking anywhere in it, then press the <Tab> key to select the "<Ok>" button, then press <Enter>.


Now you are presented with a new dialog box:


Here you need to use the left arrow key to select "<Yes>", then again press <Enter>.

Done! Now the installation of the package should finish, and if successful (fingers crossed!), you don't need to do anything else.

Troubleshooting

If the installation of "ttf-mscorefonts-installer" was not successful due to any reason, you might not be able to use your package manager, Ubuntu Software Center, Update Manager or Synaptic, etc.; in short you won't be able to install, remove, or upgrade any packages until the issue is fixed! Hrrnnh!!

Error Messages

There are number of different error messages you can get if you are in trouble with the "ttf-mscorefont-installer" package, including but not limited to these:
  • Main error message:
    There seems to be a programming error in aptdaemon, the software that allows you to install/remove software and to perform other package management related tasks.
  • Details from the one above:
    Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 961, in simulate
    trans.unauthenticated = self._simulate_helper(trans)
    File "/usr/lib/python2.7/dist-packages/aptdaemon/worker.py", line 1085, in _simulate_helper
    return depends, self._cache.required_download, \
    File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 226, in required_download
    pm.get_archives(fetcher, self._list, self._records)
    SystemError: E:I wasn't able to locate file for the ttf-mscorefonts-installer package. This might mean you need to manually fix this package.
  • When trying to remove it (reinstall would work though, and would also bring up the EULA dialog again):
    dpkg: error processing ttf-mscorefonts-installer (--remove):
     Package is in a very bad inconsistent state - you should
     reinstall it before attempting a removal.
    Errors were encountered while processing:
     ttf-mscorefonts-installer
    E: Sub-process /usr/bin/dpkg returned an error code (1)
  • "dpkg" is locked from a previous improper exiting of the EULA dialog - by simply closing the Terminal window or its GUI-equivalent - , if not from another currently running package manager:
    E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
    E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?
Fixing the Issue

To fix the issue, just follow these steps one after another:
  1. First, reboot your system to make sure "dpkg" is not locked (low-level package manager tool; see error above).
  2. Then run this command in the Terminal, it would initiate the configuration of all not already configured packages, including but not limited to "ttf-mscorefonts-installer":
    sudo dpkg --configure -a
  3. Now you should get the EULA dialog again, just follow the instructions in the section above to finish the installation.

Related Posts:

Package Manager , Troubleshooting