apt 升级包 linux-image-5.13.0-41-generic 出错

apt 升级包 linux-image-5.13.0-41-generic 出错

运行后:

sudo apt update

&

sudo apt upgrade

我收到以下错误:

Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.13.0-41-generic linux-hwe-5.13-headers-5.13.0-41
  linux-image-5.13.0-41-generic linux-modules-5.13.0-41-generic
  linux-modules-extra-5.13.0-41-generic
Use 'sudo apt autoremove' to remove them.
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-5.13.0-48-generic (5.13.0-48.54~20.04.1) ...
Processing triggers for linux-image-5.13.0-48-generic (5.13.0-48.54~20.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.13.0-48-generic
/etc/kernel/postinst.d/zz-update-grub:
/usr/sbin/grub-mkconfig: 52: .: Can't open /usr/local/share/openocd/grub-mkconfig_lib
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.13.0-48-generic (--configure):
 installed linux-image-5.13.0-48-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-5.13.0-48-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

我也有run apt autoremove

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be REMOVED:
  linux-headers-5.13.0-41-generic linux-hwe-5.13-headers-5.13.0-41
  linux-image-5.13.0-41-generic linux-modules-5.13.0-41-generic
  linux-modules-extra-5.13.0-41-generic
0 upgraded, 0 newly installed, 5 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 508 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 295730 files and directories currently installed.)
Removing linux-headers-5.13.0-41-generic (5.13.0-41.46~20.04.1) ...
Removing linux-hwe-5.13-headers-5.13.0-41 (5.13.0-41.46~20.04.1) ...
Removing linux-modules-extra-5.13.0-41-generic (5.13.0-41.46~20.04.1) ...
Removing linux-image-5.13.0-41-generic (5.13.0-41.46~20.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.13.0-41-generic
/etc/kernel/postrm.d/zz-update-grub:
/usr/sbin/grub-mkconfig: 52: .: Can't open /usr/local/share/openocd/grub-mkconfi
g_lib
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.13.0-41-generic (--remove):
 installed linux-image-5.13.0-41-generic package post-removal script subprocess 
returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.13.0-41-generic
Processing was halted because there were too many errors.

我还尝试用以下方法修复sudo apt --fix-broken install

this the same results: 
eading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  linux-image-unsigned-5.13.0-41-generic
Suggested packages:
  fdutils linux-doc | linux-hwe-5.13-source-5.13.0 linux-hwe-5.13-tools
  linux-headers-5.13.0-41-generic linux-modules-extra-5.13.0-41-generic
The following packages will be REMOVED:
  linux-image-5.13.0-41-generic
The following NEW packages will be installed:
  linux-image-unsigned-5.13.0-41-generic
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 10.1 MB of archives.
After this operation, 283 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://es.archive.ubuntu.com/ubuntu focal-updates/main amd64 linux-image-unsigned-5.13.0-41-generic amd64 5.13.0-41.46~20.04.1 [10.1 MB]
Fetched 10.1 MB in 1s (8,361 kB/s)                              
dpkg: linux-image-5.13.0-41-generic: dependency problems, but removing anyway as
 you requested:
 linux-modules-5.13.0-41-generic depends on linux-image-5.13.0-41-generic | linu
x-image-unsigned-5.13.0-41-generic; however:
  Package linux-image-5.13.0-41-generic is to be removed.
  Package linux-image-unsigned-5.13.0-41-generic is not installed.

(Reading database ... 262041 files and directories currently installed.)
Removing linux-image-5.13.0-41-generic (5.13.0-41.46~20.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.13.0-41-generic
/etc/kernel/postrm.d/zz-update-grub:
/usr/sbin/grub-mkconfig: 52: .: Can't open /usr/local/share/openocd/grub-mkconfi
g_lib
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.13.0-41-generic (--remove):
 installed linux-image-5.13.0-41-generic package post-removal script subprocess 
returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.13.0-41-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

任何解决该问题的建议都将不胜感激。

答案1

在安装 Zsh 并自定义 shell 配置文件脚本后,我的环境变量出现了问题,pkgdatadir 中充满了错误,删除未知路径就可以解决问题。

相关内容