当我尝试安装任何软件时,遇到此错误,因此无法更新。
Preconfiguring packages ...
dpkg: error: parsing file '/var/lib/dpkg/status' near line 51245 package 'oracle-xe':
mixed non-coinstallable and coinstallable package instances present
N: Ignoring file 'gcl' in directory '/etc/apt/sources.list.d/' as it has no filename extension
N: Ignoring file 'gcl' in directory '/etc/apt/sources.list.d/' as it has no filename extension
E: Sub-process /usr/bin/dpkg returned an error code (2)
答案1
你真幸运!你有备份!而且,它们每天都会在你不知情的情况下进行备份!因此,要恢复文件,只需运行:
sudo rm /var/lib/dpkg/status
sudo cp /var/backups/dpkg.status.0 /var/lib/dpkg/status
sudo apt-get update
完毕!
如果您需要更旧的文件,还有更多选择:
ls /var/backups/dpkg.status*
/var/backups/dpkg.status.0 /var/backups/dpkg.status.4.gz
/var/backups/dpkg.status.1.gz /var/backups/dpkg.status.5.gz
/var/backups/dpkg.status.2.gz /var/backups/dpkg.status.6.gz
/var/backups/dpkg.status.3.gz
只需使用以下命令解压缩它们gunzip
:
gunzip -c /var/backups/dpkg.status.6.gz > /var/lib/dpkg/status
如果备份不好,另一种方法是列出doc
目录内容:
sudo -i
ls /usr/share/doc | \
grep -v [A-Z] | \
grep -v '^texmf$' | \
grep -v '^debian$' | \
awk '{print $1 " install"}' | \
dpkg --set-selections