Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This is a weird problem and I can't find a direct solution.

I ran sudo apt-get update && sudo apt-get upgrade -y (I haven't ever run it on this machine but it is Ubuntu server 12.04 like all the others).

It goes through the updates and get part way through upgrade then I get this error

(Reading database ... 80%dpkg: unrecoverable fatal error, aborting:
 files list file for package 'mysql-common' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

Now I am getting this same error when I try to run any apt-get command.

I have tried:

apt-get clean
apt-get autoremove
apt-get install -f mysql-common
apt-get install --reinstall mysql-common

And maybe some others that I can't think of now.

Most of the time, not always, and I can recollect exactly what commands it happens on (I have been hacking at this for a while now) it ends with that error. I am still unable to update.

Any ideas?


Rehatcc's answer lead me to check out the mysql-common.files per the error files list file for package 'mysql-common' is missing final newline

The file is just garbage text.

Is this like a template file that is generic across all systems? Can I just paste in the text from another system?

share|improve this question
tried to remove/purge mysql, and then update/upgrade and install it again? Just might work.. – Alvar Sep 26 '13 at 20:28
up vote 5 down vote accepted

Go to:

cd /var/lib/dpkg/info


ls -l mysql*

If a file comes up such as "mysql-common.list" or "mysql-common.md5sums" or anything, do the following:

sudo mv ./mysql-common.list ~/mysql-common.list

and if this exist

sudo mv ./mysql-common.md5sum ~/mysql-common.md5sum

Reboot the system. Then let us know what is your status afterwards (not working... working... semi working...)

Note: If they are there in that directory, cat them open and see if there is a blank line at the end or hidden characters etc. (cat ./mysql-common.md5sum). If you are unable to tell if there are hidden characters in those files messing them up run do this (it removes all letters and numbers and slashes which would be in those files):

cat ./mysql-common.list | egrep -v [[:alpha:]]

Anything showing after that except /. or /.. is your problem line.

share|improve this answer
My dude. Maybe your way is better than mine but this is what I did. I copied and pasted the contents from another machines mysql-common.list file and it worked like a charm. Thanks for pointing me in the right direction. – dan08 Sep 26 '13 at 20:51
Anytime brother. Glad I could help (which isn't that often haha!) Also don't forget if I were use, i would repair the mysql installation just to make sure there are no lingering bugs still lying around that might cause this again! – RedHatcc Sep 26 '13 at 20:56

I recently had the same issue with a different package (linux-libc-dev).

Here is the solution that worked for me (partly building on RedHatcc's answer):

  • Verify the list file is invalid

    cd /var/lib/dpkg/info
    cat linux-libc-dev\:armhf.list` (insert your package name here!)

    An invalid file will appear empty or contain non-alphanumeric characters.

    A valid package list will include plain-text paths like this:

  • Delete the invalid package list

    sudo rm linux-libc-dev\:armhf.list (insert your package name here!)

  • Force APT to reinstall the package, recreating the deleted package list

    sudo apt-get install linux-libc-dev --reinstall (insert your package name here!)

  • Verify the list file is valid

    A valid package list will include plain-text paths like this:


    An invalid file will appear empty or contain non-alphanumeric characters.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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