I have been reinstalling Ubuntu 12.04. The install from USB works fine, and I could update everything OK, but when I got to re-installing my application software I hit a snag.

One of the packages I tried to re-install was ttf-mscorefonts-installer. dpkg stalled during this setup, downloading a font file (it had tried to download it all night). I stopped dpkg, and attempted to re-start downloading something else, but it would not let me.

The commands I typed are as follows:

bob@bobStudio:~$ sudo rm /var/lib/dpkg/lock

This unlocks dpkg, but if I try to do something I get the following message (eg):

bob@bobStudio:~$ sudo apt-get install synaptic
E: dpgk was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem

So, I did just that:

bob@bobStudio:~$ sudo dpkg --configure -a

whereupon it started the previously failed download all over again. I went round the loop here a few times and each time after the configure command it re-started the failing download, but then I got this:

bob@bobStudio:~$ sudo dpkg --configure -a
Setting up update-notifier-common (0.119ubuntu8.4) ...
ttf-mscorefonts-installer: downloading http://downloads.sourceforge.net/corefonts/andale32.exe
Traceback (most recent call last):
  File "/usr/lib/update-notifier/package-data-downloader", line 234, in process_download_requests
    dest_file = urllib.urlretrieve(files[i])[0]
  File "/usr/lib/python2.7/urllib.py", line 93, in urlretrieve
return _urlopener.retrieve(url, filename, reporthook, data)
  File "/usr/lib/python2.7/urllib.py", line 239, in retrieve
fp = self.open(url, data)
  File "/usr/lib/python2.7/urllib.py", line 207, in open
return getattr(self, name)(url)
  File "/usr/lib/python2.7/urllib.py", line 344, in open_http
  File "/usr/lib/python2.7/httplib.py", line 954, in endheaders
  File "/usr/lib/python2.7/httplib.py", line 814, in _send_output
  File "/usr/lib/python2.7/httplib.py", line 776, in send
  File "/usr/lib/python2.7/httplib.py", line 757, in connect
self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
IOError: [Errno socket error] [Errno -2] Name or service not known
Setting up ttf-mscorefonts-installer (3.4ubuntu3) ...
bob@bobStudio:~$ sudo apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
bob@bobStudio:~$ sudo rm /var/lib/dpkg/lock
bob@bobStudio:~$ sudo apt-get update
E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/

The good news is that, once I sorted out the file locks, this seems to have permanently aborted the setup of the font package, so at least I can do something else with dpkg.

That leaves two questions:

1) How could I have broken the loop without actually crashing out of dpkg?

2) How can I set up the ttf-mscorefonts-installer package in the future? Is this download really broken, or is it 'just' a bad Internet connection?

  • Somethign else has dpkg open. Did you try killing all dpkg instances, and then also check to see if synaptic or aptitude or the software center are running? – Thomas Ward Jul 6 '12 at 17:16
  • When you abort dpkg it often leaves the lock file there. There do not need to be other instances. In fact, the whole point of the lock file is there can't be more than one instance. Manually cleaning out the locks is a chore but I would rather that than the consequences of getting two instances running at once. – Bobble Jul 8 '12 at 1:55

You should be able to remove the broken package like this:

dpkg -r ttf-mscorefonts-installer

As for question #2, I can't know for sure. You will definitely need an internet connection while installing that package.

  • Thx @Sepero, the problem is dpkg won't let you do anything else after an abort until you type the configure command. For me, I found doing this dumped me back into the failed download, so I could not break out to do anything else. The crash referred to above accidentally broke the loop for me, or I would still be stuck there... – Bobble Jul 8 '12 at 2:02
  • I think you mean to say, "the problem is apt-get won't let you do anything else". The command I put is for dpkg and should work. – Sepero Jul 8 '12 at 10:26
  • apt-get and dpkg use the same locks. – Bobble Jul 9 '12 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.