处理 linux-image-3.2.0-54-virtual 时遇到错误

处理 linux-image-3.2.0-54-virtual 时遇到错误

我正在尝试安装 python-dev,但一直出现此错误。发生了什么?

ubuntu@ip-XX-XXX-XXX-XX:~$ sudo apt-get install python-dev Reading
package lists... Done Building dependency tree... Done python-dev is
already the newest version. The following packages will be REMOVED:  
linux-image-3.2.0-54-virtual 0 upgraded, 0 newly installed, 1 to
remove and 147 not upgraded. 2 not fully installed or removed. After
this operation, 36.2 MB disk space will be freed. Do you want to
continue [Y/n]? Y

(Reading database ...  dpkg: warning: files list file for package
`vim-tiny' missing, assuming package has no files currently installed.

dpkg: warning: files list file for package `libc6' missing, assuming
package has no files currently installed.

dpkg: warning: files list file for package `grub-legacy-ec2' missing,
assuming package has no files currently installed. (Reading database
... 182424 files and directories currently installed.) Removing
linux-image-3.2.0-54-virtual ... Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools
3.2.0-54-virtual /boot/vmlinuz-3.2.0-54-virtual update-initramfs: Deleting /boot/initrd.img-3.2.0-54-virtual run-parts: executing
/etc/kernel/postrm.d/x-grub-legacy-ec2 3.2.0-54-virtual
/boot/vmlinuz-3.2.0-54-virtual Searching for GRUB installation
directory ... found: /boot/grub Searching for default file ... found:
/boot/grub/default Testing for an existing GRUB menu.lst file ...
found: /boot/grub/menu.lst Searching for splash image ... none found,
skipping ... Found kernel: /boot/vmlinuz-3.2.0-54-virtual Found
kernel: /boot/memtest86+.bin run-parts:
/etc/kernel/postrm.d/x-grub-legacy-ec2 exited with return code 10
Failed to process /etc/kernel/postrm.d at
/var/lib/dpkg/info/linux-image-3.2.0-54-virtual.postrm line 328. dpkg:
error processing linux-image-3.2.0-54-virtual (--remove):  subprocess
installed post-removal script returned error exit status 1 Errors were
encountered while processing:  linux-image-3.2.0-54-virtual E:
Sub-process /usr/bin/dpkg returned an error code (1)

知道发生了什么事以及我该如何解决吗?

答案1

对于遇到此问题的任何人,请使用此资源http://www.khattam.info/solved-subprocess-pre-removal-script-returned-error-exit-status-2-error-2009-08-04.html#more-303

它帮我解决了这个问题。软件包:linux-image-2.3.0-54-virtual 和 linux-image 多次出现在 /var/lib/dpkg/status 中,有重复。只需使用 vim 或 nano(无论哪种您喜欢的编辑器)并删除软件包。保存它,然后执行 sudo apt-get update。然后执行 sudo apt-get -f install。

现在一切都正常了。

答案2

就我的情况而言,同样的问题是由于我编写的 bash 脚本以相同名称“sync”命名而发生的。我花了一段时间才弄清楚发生了什么。

apt由于我的脚本正在被使用,因此无法安装更新,但不是/bin/sync

相关内容