我debsums -cs
在运行 Debian Jessie 的机器上运行。输出是许多丢失的文件。
其中很多(也许全部)都有某种区域设置两个字母代码(如 zh、fr、de 等)。
几天前我运行了 BleachBit 和一些 Debian 工具来释放可用空间,我想这导致了问题。
我该如何处理这个问题?可以抑制输出吗?我可以重新安装语言环境吗?
示例输出:
debsums: missing file /usr/share/man/fr/man8/adduser.8.gz (from adduser package)
debsums: missing file /usr/share/man/fr/man8/deluser.8.gz (from adduser package)
debsums: missing file /usr/share/man/fr/man5/deluser.conf.5.gz (from adduser package)
debsums: missing file /usr/share/man/fr/man5/adduser.conf.5.gz (from adduser package)
debsums: missing file /usr/share/locale/es/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/zh_CN/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/nl/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/cs/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/de/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/pl/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/pt/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/nb/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/ru/LC_MESSAGES/adduser.mo (from adduser package)
debsums: missing file /usr/share/locale/da/LC_MESSAGES/adduser.mo (from adduser package)
答案1
如果你想删除文件对于您不感兴趣的区域设置(或与此相关的其他任何事情),您应该告诉dpkg
它:这样不仅会debsums
停止抱怨它们,而且dpkg
甚至不会首先安装它们。
这是我所拥有的/etc/dpkg/dpkg.cfg.d/locales
:
# Drop locales except English and French
path-exclude=/usr/share/locale/*
path-include=/usr/share/locale/en/*
path-include=/usr/share/locale/fr/*
path-include=/usr/share/locale/locale.alias
# Drop translated manpages except English and French
path-exclude=/usr/share/man/*
path-include=/usr/share/man/man[1-9]/*
path-include=/usr/share/man/en*/*
path-include=/usr/share/man/fr*/*
如果您根据您的设置进行调整,您应该会发现debsums
会产生更有用的输出。
拉斐尔·赫尔佐格写了一篇博客文章关于这一点有更多的细节。
如果你想恢复丢失的文件,您需要重新安装受影响的软件包:
apt-get --reinstall install $(debsums -c 2>&1 | grep -E -o 'from [^ ]* package' | cut -d\ -f2 | sort -u)
答案2
您需要重新安装丢失文件的软件包。这样做的方法是使用 检索丢失文件的包名称dpkg -S
,然后使用 重新安装它们apt-get
:
debsums -cs | grep -E ^debsums | awk '{print $4}' | xargs -rd '\n' -- dpkg -S | cut -d: -f1 | sort -u | xargs -rd '\n' -- apt-get install --reinstall