apt-get updates broken? problem with MergeList?

本文详细记录了在Debian系统中遇到的包管理器更新失败问题,并提供了两种有效的解决方案。问题表现为无法解析或打开包列表文件,通过配置dpkg及修复状态文件等方式成功解决了这一难题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Thesd days I've add some sources to the /ect/apt/sources.list, and found I cannot update anymore... this is what i get...

E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened.

I've tryed to substitute status with status.old but nothing changes...

my /var/lib/dpkg/status file is as follows...

 

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:christian
tty:x:5:
disk:x:6:
lp:x:7:cupsys
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:cupsys,christian
fax:x:21:
voice:x:22:
cdrom:x:24:haldaemon,christian
floppy:x:25:haldaemon,christian
tape:x:26:
sudo:x:27:
audio:x:29:christian
dip:x:30:christian
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:christian
sasl:x:45:
plugdev:x:46:haldaemon,christian
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
dhcp:x:101:
syslog:x:102:
klog:x:103:
ssl-cert:x:104:cupsys
crontab:x:105:
ssh:x:106:
messagebus:x:107:
avahi:x:108:
lpadmin:x:109:christian
haldaemon:x:110:
scanner:x:111:cupsys,hplip,christian
slocate:x:112:
gdm:x:113:
christian:x:1000:
admin:x:114:christian
fuse:x:115:christian

 

and finally found some soluation on Internet:

 

Solution 1:

 

Code:
dpkg --configure -a
Code:
apt-get -f install

if that does not work look in

Code:
/var/lib/dpkg/info

The above location stores what are called post-installation (.postinst) and post-removal (.postrm) scripts from deb packages which include them. Sometimes, packagers do not do a good job of packaging software and these scripts (which are NOT present in all debs) error out (during installation or uninstallation) and prevent apt from doing anything further (in terms of installing or uninstalling other packages).
What you need to do then is delete the faulty scripts from the above location and then apt-get remove the package.
That will fix apt.

and then manually go and repir anything else that shows up

 

Solution 2:

 

cd /var/lib/dpkg
mv status status-bad
cp status-old status
apt-get update

 

Problem continue:

 

I needed to remove the lock before I could run the update.

Code:
sudo rm -f /var/lib/dpkg/lock
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值