无法将 /boot/initrd.img-3.2.0-24-generic 符号链接到 initrd.img:文件存在

无法将 /boot/initrd.img-3.2.0-24-generic 符号链接到 initrd.img:文件存在

自从今天运行升级以来,我不再能够使用 apt-get。

例如:

sudo apt-get install curl
Reading package lists... Done
Building dependency tree       
Reading state information... Done
curl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? Y
Setting up linux-image-3.2.0-24-generic (3.2.0-24.38) ...
Running depmod.
Failed to symbolic-link /boot/initrd.img-3.2.0-24-generic to initrd.img: File exists
dpkg: error processing linux-image-3.2.0-24-generic (--configure):
 subprocess installed post-installation script returned error exit status 17
Errors were encountered while processing:
 linux-image-3.2.0-24-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

据我所知,这就是它失败的原因:

sudo dpkg --configure linux-image-3.2.0-24-generic
Setting up linux-image-3.2.0-24-generic (3.2.0-24.38) ...
Running depmod.
Failed to symbolic-link /boot/initrd.img-3.2.0-24-generic to initrd.img: File exists
dpkg: error processing linux-image-3.2.0-24-generic (--configure):
 subprocess installed post-installation script returned error exit status 17
Errors were encountered while processing:
 linux-image-3.2.0-24-generic

然而,当我运行它时一切似乎都正常......

/var/lib/dpkg/info/linux-image-3.2.0-24-generic.postinst
echo $?
0

到底发生了什么事?我有点害怕乱搞,因为我认为这是至关重要的事情......

答案1

initrd通过运行从根目录中删除了符号链接

sudo rm /initrd.img

但是如果您想采取安全措施,您当然可以initrd.img在删除之前备份现有的。

然后运行

sudo apt-get -f install [package] 

并且应该能够成功运行。

答案2

尝试

sudo apt-get -f install [package]

这将强制升级。至少值得一试。执行

sudo apt-get update

也不会造成伤害。

相关内容