0

I'm trying to install/uninstall packages in Debian but getting errors.

image

I can't remove or add any package, always getting the error.

I tried:

apt-get --remove purge package
apg-get remove package
dpkg -r package
2
  • 5
    Please don't post pictures of text. Just copy and paste the text from the terminal into your question.
    – DopeGhoti
    Commented Aug 15, 2016 at 0:51
  • 1
    Thanks for letting me know. I'm new here. I'll fix next time Commented Aug 15, 2016 at 1:13

1 Answer 1

2

You may try fixing the problem with a Python script published by pokerbirch on Ubuntu Forums (under CC BY-SA 4.0 license):

#!/usr/bin/python

# 8th November, 2009
# update manager failed, giving me the error:
#       'files list file for package 'xxx' is missing final newline' for every package.
# some Googling revealed that this problem was due to corrupt files(s) in /var/lib/dpkg/info/
# looping though those files revealed that some did not have a final new line
# this script will resolve that problem by appending a newline to all files that are missing it
# NOTE: you will need to run this script as root, e.g. sudo python newline_fixer.py

import os

dpkg_path = '/var/lib/dpkg/info/'
paths = os.listdir(dpkg_path)
for path in paths:
    path = dpkg_path + path
    f = open(path, 'a+')
    data = f.read()
    if len(data) > 1 and data[-1:] != '\n':
        f.write('\n')
        print 'added newline character to:', path
    f.close()  

It scans the package definition files and adds a newline character if one is missing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .