I am unable to use the apt-get command to install any packages on my pi.

I started trying to install python-pip using

sudo apt-get install python-pip

which results in the error

dpkg: unrecoverable fatal error, aborting:
files list file for package 'libc6:armhf' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)

I tried some other packages, but none worked. They all result in the same error.

After attempting several fixes from Google, I have been unable to resolve the issue.

  • I have a similar problem. when i install anything i get files list file for package `fcmp' contains empty filename And i tried to reinstall libc6 but get this message along with dpkg error code 2. Any one, help?
    – user10171
    Oct 22 '13 at 22:34

Delete the file /var/lib/dpkg/info/libc.list (or the closest to that name), and then run sudo apt-get install libc --reinstall

  • I renamed libc6:armhf.list and ran the reinstall. This was the result : pastebin.com/mr224BqB I don't recall ever trying to install C in a different location.
    – MrZander
    Dec 31 '12 at 4:40
  • I also have /lib/arm-linux-gnueabihf/libc-2.13.so in my setup. Don't delete it as this thread says that no commands will work after that. Dec 31 '12 at 16:37
  • Well, I guess this solution half worked. I get a warning-error thing but the packages install.
    – MrZander
    Jan 2 '13 at 18:07
  • A silent hero right there. @MrZander this should be the accepted answer. I just had the same problem with the package raspberrypi-bootloader, removed /var/lib/dpkg/info/raspberrypi-bootloader.list and reinstalled, error went away.
    – php_nub_qq
    Apr 13 '20 at 17:04

I got hit by that too on first install: dd'ed the firmware, 1st boot, apt-get update doesn't work. Conclusion: write errors on the SD card. In my case, my card was old, so I just bought another. Note that write errors can also occur with bad power supply / bad micro-usb cable.

  • I am going to flag this one as accepted. I had some issues while flashing my SD card.
    – MrZander
    Jan 2 '13 at 18:08

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