Ubuntu 20.04 LTS 无法安装 linux-image-5.4.0-89-generic

Ubuntu 20.04 LTS 无法安装 linux-image-5.4.0-89-generic

我在 Ubuntu 服务器上更新 Linux 内核时遇到了问题。

当我跑步时:

sudo apt update && sudo apt dist-upgrade -y

它将失败:

Setting up linux-image-5.4.0-89-generic (5.4.0-89.100) ...
Bus error
dpkg: error processing package linux-image-5.4.0-89-generic (--configure):
 installed linux-image-5.4.0-89-generic package post-installation script subprocess returned error exit status 135
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-5.4.0-89-generic; however:
  Package linux-image-5.4.0-89-generic is not configured yet.

dpkg: error processing package linux-image-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 5.4.0.89.93); however:
  Package linux-image-generic is not configured yet.

dpkg: error processing package linux-generic (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-modules-extra-5.4.0-89-generic:
 linux-modules-extra-5.4.0-89-generic depends on linux-image-5.4.0-89-generic | linux-image-unsigned-5.4.0-89-generic; however:
  Package linux-image-5.4.0-89-generic is not configured yet.
  Package linux-image-unsigned-5.4.0-89-generic is not installed.

dpkg: error processing package linux-modules-extra-5.4.0-89-generic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-5.4.0-89-generic
 linux-image-generic
 linux-generic
 linux-modules-extra-5.4.0-89-generic
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 180 files, found 146
E: Sub-process /usr/bin/dpkg returned an error code (1)

我尝试运行以下命令

sudo apt autoremove -y
sudo apt install -f
sudo dpkg --configure -a

但它仍然会在 linux-image-5.4.0-89-generic 上失败。

我还跑了:

sudo update-initramfs -u -k all                                             

输出如下:

perl: warning: Setting locale failed.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_ALL = (unset),
    LC_TIME = "id_ID.UTF-8",
    LC_TIME = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LANG = "en_US.UTF-8"
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
update-initramfs: Generating /boot/initrd.img-5.4.0-88-generic
I: The initramfs will attempt to resume from /dev/sda4
I: (UUID=4a962a4e-7061-4272-9682-0d011eb67596)
I: Set the RESUME variable to override this.
update-initramfs: Generating /boot/initrd.img-5.4.0-86-generic
I: The initramfs will attempt to resume from /dev/sda4
I: (UUID=4a962a4e-7061-4272-9682-0d011eb67596)
I: Set the RESUME variable to override this.

目前我不敢重新启动我的服务器,因为我认为这会让我失去对服务器的访问权限。

有没有什么办法可以解决这个问题?

更新 1:

我尝试运行:

sudo apt install linux-image-unsigned-5.4.0-89-generic

我收到另一个错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool linux-modules-extra-5.4.0-89-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  dctrl-tools dkms wireguard-dkms
Suggested packages:
  debtags menu fdutils linux-doc | linux-source-5.4.0 linux-tools
The following packages will be REMOVED:
  linux-generic linux-image-5.4.0-89-generic linux-image-generic
The following NEW packages will be installed:
  dctrl-tools dkms linux-image-unsigned-5.4.0-89-generic wireguard-dkms
0 upgraded, 4 newly installed, 3 to remove and 0 not upgraded.
4 not fully installed or removed.
Need to get 9394 kB of archives.
After this operation, 2828 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ubuntu.mirrors.ovh.net/ubuntu focal/main amd64 dctrl-tools amd64 2.24-3 [61.5 kB]
Get:2 http://ubuntu.mirrors.ovh.net/ubuntu focal-updates/main amd64 dkms all 2.8.1-5ubuntu2 [66.8 kB]
Get:3 http://ubuntu.mirrors.ovh.net/ubuntu focal-updates/universe amd64 wireguard-dkms all 1.0.20201112-1~20.04.1 [254 kB]
Get:4 http://ubuntu.mirrors.ovh.net/ubuntu focal-updates/main amd64 linux-image-unsigned-5.4.0-89-generic amd64 5.4.0-89.100 [9011 kB]
Fetched 9394 kB in 2s (5967 kB/s)                                
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
(Reading database ... 176597 files and directories currently installed.)
Removing linux-generic (5.4.0.89.93) ...
Selecting previously unselected package dctrl-tools.
(Reading database ... 176595 files and directories currently installed.)
Preparing to unpack .../dctrl-tools_2.24-3_amd64.deb ...
Unpacking dctrl-tools (2.24-3) ...
Selecting previously unselected package dkms.
Preparing to unpack .../dkms_2.8.1-5ubuntu2_all.deb ...
Unpacking dkms (2.8.1-5ubuntu2) ...
Selecting previously unselected package wireguard-dkms.
Preparing to unpack .../wireguard-dkms_1.0.20201112-1~20.04.1_all.deb ...
Unpacking wireguard-dkms (1.0.20201112-1~20.04.1) ...
dpkg: linux-image-5.4.0-89-generic: dependency problems, but removing anyway as you requested:
 linux-modules-extra-5.4.0-89-generic depends on linux-image-5.4.0-89-generic | linux-image-unsigned-5.4.0-89-generic; however:
  Package linux-image-5.4.0-89-generic is to be removed.
  Package linux-image-unsigned-5.4.0-89-generic is not installed.
 linux-image-generic depends on linux-image-5.4.0-89-generic.

(Reading database ... 176821 files and directories currently installed.)
Removing linux-image-5.4.0-89-generic (5.4.0-89.100) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
/var/lib/dpkg/info/linux-image-5.4.0-89-generic.postrm ... removing pending trigger
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-89-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-88-generic
Found initrd image: /boot/initrd.img-5.4.0-88-generic
Found linux image: /boot/vmlinuz-5.4.0-86-generic
Found initrd image: /boot/initrd.img-5.4.0-86-generic
done
dpkg: linux-image-generic: dependency problems, but removing anyway as you requested:
 wireguard depends on wireguard-dkms (>= 0.0.20200121-2) | wireguard-modules (>= 0.0.20191219); however:
  Package wireguard-dkms is not configured yet.
  Package wireguard-modules is not installed.
  Package linux-image-generic which provides wireguard-modules is to be removed.

Removing linux-image-generic (5.4.0.89.93) ...
Selecting previously unselected package linux-image-unsigned-5.4.0-89-generic.
(Reading database ... 176815 files and directories currently installed.)
Preparing to unpack .../linux-image-unsigned-5.4.0-89-generic_5.4.0-89.100_amd64.deb ...
Unpacking linux-image-unsigned-5.4.0-89-generic (5.4.0-89.100) ...
Setting up linux-image-unsigned-5.4.0-89-generic (5.4.0-89.100) ...
Bus error
dpkg: error processing package linux-image-unsigned-5.4.0-89-generic (--configure):
 installed linux-image-unsigned-5.4.0-89-generic package post-installation script subprocess returned error exit status 135
Setting up dctrl-tools (2.24-3) ...
dpkg: dependency problems prevent configuration of linux-modules-extra-5.4.0-89-generic:
 linux-modules-extra-5.4.0-89-generic depends on linux-image-5.4.0-89-generic | linux-image-unsigned-5.4.0-89-generic; however:
  Package linux-image-5.4.0-89-generic is not installed.
  Package linux-image-unsigned-5.4.0-89-generic is not configured yet.

dpkg: error processing package linux-modules-extra-5.4.0-89-generic (--configure):
 dependency problems - leaving unconfigured
Setting up dkms (2.8.1-5ubuntu2) ...
Setting up wireguard-dkms (1.0.20201112-1~20.04.1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Loading new wireguard-1.0.20201112 DKMS files...
Building for 5.4.0-88-generic 5.4.0-89-generic
Building initial module for 5.4.0-88-generic
Done.

wireguard.ko:
Running module version sanity check.

Good news! Module version 1.0.20201112 for wireguard.ko
exactly matches what is already found in kernel 5.4.0-88-generic.
DKMS will not replace this module.
You may override by specifying --force.

depmod.......

DKMS: install completed.
Building initial module for 5.4.0-89-generic
Done.

wireguard.ko:
Running module version sanity check.

Good news! Module version 1.0.20201112 for wireguard.ko
exactly matches what is already found in kernel 5.4.0-89-generic.
DKMS will not replace this module.
You may override by specifying --force.

depmod.......(bad exit status: 135)

-------- Uninstall Beginning --------
Module:  wireguard
Version: 1.0.20201112
Kernel:  5.4.0-89-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

wireguard.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-89-generic/
rmdir: failed to remove '': No such file or directory
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod.....(bad exit status: 135)

DKMS: uninstall completed.
Error! Problems with depmod detected.  Automatically uninstalling this module.
DKMS: Install Failed (depmod problems).  Module rolled back to built state.
dpkg: error processing package wireguard-dkms (--configure):
 installed wireguard-dkms package post-installation script subprocess returned error exit status 6
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 linux-image-unsigned-5.4.0-89-generic
 linux-modules-extra-5.4.0-89-generic
 wireguard-dkms
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 180 files, found 146
E: Sub-process /usr/bin/dpkg returned an error code (1)

更新 2:

尝试再次安装通用内核:

sudo apt install linux-image-5.4.0-89-generic

但出现同样的错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool linux-modules-extra-5.4.0-89-generic
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  fdutils linux-doc | linux-source-5.4.0 linux-tools
The following packages will be REMOVED:
  linux-image-unsigned-5.4.0-89-generic
The following NEW packages will be installed:
  linux-image-5.4.0-89-generic
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 0 B/8990 kB of archives.
After this operation, 505 kB disk space will be freed.
Do you want to continue? [Y/n] 
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
dpkg: linux-image-unsigned-5.4.0-89-generic: dependency problems, but removing anyway as you requested:
 linux-modules-extra-5.4.0-89-generic depends on linux-image-5.4.0-89-generic | linux-image-unsigned-5.4.0-89-generic; however:
  Package linux-image-5.4.0-89-generic is not installed.
  Package linux-image-unsigned-5.4.0-89-generic is to be removed.

(Reading database ... 176817 files and directories currently installed.)
Removing linux-image-unsigned-5.4.0-89-generic (5.4.0-89.100) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.4.0-89-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/50-cloudimg-settings.cfg'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-88-generic
Found initrd image: /boot/initrd.img-5.4.0-88-generic
Found linux image: /boot/vmlinuz-5.4.0-86-generic
Found initrd image: /boot/initrd.img-5.4.0-86-generic
done
Selecting previously unselected package linux-image-5.4.0-89-generic.
(Reading database ... 176815 files and directories currently installed.)
Preparing to unpack .../linux-image-5.4.0-89-generic_5.4.0-89.100_amd64.deb ...
Unpacking linux-image-5.4.0-89-generic (5.4.0-89.100) ...
Setting up linux-image-5.4.0-89-generic (5.4.0-89.100) ...
Bus error
dpkg: error processing package linux-image-5.4.0-89-generic (--configure):
 installed linux-image-5.4.0-89-generic package post-installation script subprocess returned error exit status 135
Setting up wireguard-dkms (1.0.20201112-1~20.04.1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Removing old wireguard-1.0.20201112 DKMS files...

-------- Uninstall Beginning --------
Module:  wireguard
Version: 1.0.20201112
Kernel:  5.4.0-88-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

wireguard.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-88-generic/
rmdir: failed to remove '': No such file or directory
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod........

DKMS: uninstall completed.

-------- Uninstall Beginning --------
Module:  wireguard
Version: 1.0.20201112
Kernel:  5.4.0-89-generic (x86_64)
-------------------------------------

Status: This module version was INACTIVE for this kernel.
depmod.......(bad exit status: 135)

DKMS: uninstall completed.

------------------------------
Deleting module version: 1.0.20201112
completely from the DKMS tree.
------------------------------
Done.
Loading new wireguard-1.0.20201112 DKMS files...
Building for 5.4.0-88-generic 5.4.0-89-generic
Building initial module for 5.4.0-88-generic
Done.

wireguard.ko:
Running module version sanity check.

Good news! Module version 1.0.20201112 for wireguard.ko
exactly matches what is already found in kernel 5.4.0-88-generic.
DKMS will not replace this module.
You may override by specifying --force.

depmod......

DKMS: install completed.
Building initial module for 5.4.0-89-generic
Done.

wireguard.ko:
Running module version sanity check.

Good news! Module version 1.0.20201112 for wireguard.ko
exactly matches what is already found in kernel 5.4.0-89-generic.
DKMS will not replace this module.
You may override by specifying --force.

depmod.....(bad exit status: 135)

-------- Uninstall Beginning --------
Module:  wireguard
Version: 1.0.20201112
Kernel:  5.4.0-89-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

wireguard.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-89-generic/
rmdir: failed to remove '': No such file or directory
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod.....(bad exit status: 135)

DKMS: uninstall completed.
Error! Problems with depmod detected.  Automatically uninstalling this module.
DKMS: Install Failed (depmod problems).  Module rolled back to built state.
dpkg: error processing package wireguard-dkms (--configure):
 installed wireguard-dkms package post-installation script subprocess returned error exit status 6
dpkg: dependency problems prevent configuration of linux-modules-extra-5.4.0-89-generic:
 linux-modules-extra-5.4.0-89-generic depends on linux-image-5.4.0-89-generic | linux-image-unsigned-5.4.0-89-generic; however:
  Package linux-image-5.4.0-89-generic is not configured yet.
  Package linux-image-unsigned-5.4.0-89-generic is not installed.

dpkg: error processing package linux-modules-extra-5.4.0-89-generic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-5.4.0-89-generic
 wireguard-dkms
 linux-modules-extra-5.4.0-89-generic
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 180 files, found 146
E: Sub-process /usr/bin/dpkg returned an error code (1)

更新 3:

正如评论中提到的,我运行了以下命令:

sudo apt --fix-broken install

输出结果如下:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool linux-modules-extra-5.4.0-89-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
3 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = (unset),
    LC_ALL = (unset),
    LC_TIME = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Setting up linux-image-5.4.0-89-generic (5.4.0-89.100) ...
Bus error
dpkg: error processing package linux-image-5.4.0-89-generic (--configure):
 installed linux-image-5.4.0-89-generic package post-installation script subprocess returned error exit status 135
Setting up wireguard-dkms (1.0.20201112-1~20.04.1) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Removing old wireguard-1.0.20201112 DKMS files...

-------- Uninstall Beginning --------
Module:  wireguard
Version: 1.0.20201112
Kernel:  5.4.0-88-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

wireguard.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-88-generic/
rmdir: failed to remove '': No such file or directory
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod...

DKMS: uninstall completed.

-------- Uninstall Beginning --------
Module:  wireguard
Version: 1.0.20201112
Kernel:  5.4.0-89-generic (x86_64)
-------------------------------------

Status: This module version was INACTIVE for this kernel.
depmod.....(bad exit status: 135)

DKMS: uninstall completed.

------------------------------
Deleting module version: 1.0.20201112
completely from the DKMS tree.
------------------------------
Done.
Loading new wireguard-1.0.20201112 DKMS files...
Building for 5.4.0-88-generic 5.4.0-89-generic
Building initial module for 5.4.0-88-generic
Done.

wireguard.ko:
Running module version sanity check.

Good news! Module version 1.0.20201112 for wireguard.ko
exactly matches what is already found in kernel 5.4.0-88-generic.
DKMS will not replace this module.
You may override by specifying --force.

depmod...

DKMS: install completed.
Building initial module for 5.4.0-89-generic
Done.

wireguard.ko:
Running module version sanity check.

Good news! Module version 1.0.20201112 for wireguard.ko
exactly matches what is already found in kernel 5.4.0-89-generic.
DKMS will not replace this module.
You may override by specifying --force.

depmod.....(bad exit status: 135)

-------- Uninstall Beginning --------
Module:  wireguard
Version: 1.0.20201112
Kernel:  5.4.0-89-generic (x86_64)
-------------------------------------

Status: Before uninstall, this module version was ACTIVE on this kernel.

wireguard.ko:
 - Uninstallation
   - Deleting from: /lib/modules/5.4.0-89-generic/
rmdir: failed to remove '': No such file or directory
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod.....(bad exit status: 135)

DKMS: uninstall completed.
Error! Problems with depmod detected.  Automatically uninstalling this module.
DKMS: Install Failed (depmod problems).  Module rolled back to built state.
dpkg: error processing package wireguard-dkms (--configure):
 installed wireguard-dkms package post-installation script subprocess returned error exit status 6
dpkg: dependency problems prevent configuration of linux-modules-extra-5.4.0-89-generic:
 linux-modules-extra-5.4.0-89-generic depends on linux-image-5.4.0-89-generic | linux-image-unsigned-5.4.0-89-generic; however:
  Package linux-image-5.4.0-89-generic is not configured yet.
  Package linux-image-unsigned-5.4.0-89-generic is not installed.

dpkg: error processing package linux-modules-extra-5.4.0-89-generic (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 linux-image-5.4.0-89-generic
 wireguard-dkms
 linux-modules-extra-5.4.0-89-generic
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 180 files, found 146
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

错误日志apt -f install表明以下软件包的安装后脚本存在错误:

  • linux-image-5.4.0-89-generic
  • wireguard-dkms
  • linux-modules-extra-5.4.0-89-generic(依赖问题)

这通常意味着由于配置文件的问题,安装后(shell 脚本)的一个或另一个命令失败。


方法 1:首先,尝试强制覆盖文件:

sudo dpkg -i --force-overwrite var/cache/apt/archives/linux-image*
sudo dpkg -i --force-overwrite var/cache/apt/archives/wireguard-dkms*
sudo dpkg -i --force-overwrite var/cache/apt/archives/linux-module*
sudo apt --fix-broken install

意义:-

  • 此处,无论出现什么错误,该--force-overwrite参数都会强制dpkg放置文件。错误消息看起来正常且不具破坏性,因此您可以放心运行命令。

  • 在最后一个命令中,--fix-broken参数将重新配置/重新处理错误包。


如果这不起作用那么您需要删除软件包的安装后脚本:

sudo rm /var/lib/dpkg/info/linux-image-5.4.0-89-generic.postinst
sudo rm /var/lib/dpkg/info/wireguard-dkms.postinst
sudo rm /var/lib/dpkg/info/linux-modules-extra-5.4.0-89-generic.postinst

然后运行强制安装:

sudo apt --fix-broken install

然后运行自动删除:

sudo apt autoremove && sudo apt clean

意义:-

  • 软件包的安装后脚本由安装完成后要运行的命令组成,用于通知其他应用程序软件包的安装情况。删除该脚本不会造成任何损害,因为运行--fix-brokeninstall 已经运行了安装后脚本。

运行上述命令后,请确保运行以下命令:

sudo apt update && sudo apt upgrade && sudo apt autoremove && sudo apt clean && sudo apt autoclean && sudo apt --fix-broken install

相关内容