使用apt-get安装包的时候出错:
|
1 2 3 4 5 |
Fetched 12.2 MB in 1s (8,002 kB/s) Extracting templates from packages: 100% Selecting previously unselected package fonts-dejavu-core. dpkg: unrecoverable fatal error, aborting: files list file for package 'libapt-pkg5.0:amd64' is missing final newline |
解决:
新建一个py文件,然后输入:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#!/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() |
然后终端运行即可:python xxx.py
注意使用Python2.x

马春杰杰



最新评论
站长您好,亚马逊云咨询推广资源,望建立联系,可邮件,谢谢。
换友情链接吗?
看你的站做的挺不错的
恭喜!!太强了,硕博连读啊
雁过留毛,人过留名。
看不懂但大受震撼
每天都在战争,希望2026和平.
ZeroTier 看过多篇帖子,目前群辉、飞牛os、win11 、安卓、ubuntu ≥18.04 顺利通过,这篇相对于简单 实用、特来感谢 🙄