![无法在 Debian 中安装/卸载软件包](https://linux22.com/image/92396/%E6%97%A0%E6%B3%95%E5%9C%A8%20Debian%20%E4%B8%AD%E5%AE%89%E8%A3%85%2F%E5%8D%B8%E8%BD%BD%E8%BD%AF%E4%BB%B6%E5%8C%85.png)
答案1
您可以尝试使用Python解决该问题pokerbirch 发布的脚本在 Ubuntu 论坛上(根据 CC BY-SA 4.0 许可证):
#!/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()
它会扫描包定义文件,并在缺少换行符时添加换行符。