sudo apt-get upgrade 失败,原因是“处理时遇到错误:linux-image-5.13.0-27-generic”

sudo apt-get upgrade 失败,原因是“处理时遇到错误:linux-image-5.13.0-27-generic”

这是控制台结果

leno@leno-Lenovo-V3000:/var/lib/dpkg/info$ sudo apt-get upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be REMOVED:
  linux-image-5.13.0-27-generic
The following packages will be upgraded:
  code cpp-9 firefox firefox-locale-en g++-9 gcc-9 gcc-9-base language-pack-gnome-en language-pack-gnome-en-base libasan5 libegl1 libgcc-9-dev libgl1 libgl1:i386 libgles2 libglvnd0
  libglvnd0:i386 libglx0 libglx0:i386 libopengl0 libssl1.1 libssl1.1:i386 libstdc++-9-dev libx11-6 libx11-6:i386 libx11-data libx11-xcb1 libx11-xcb1:i386 libxfixes3 libxfixes3:i386
  linux-libc-dev openssl rsync
33 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
3 not fully installed or removed.
Need to get 173 MB/174 MB of archives.
After this operation, 2,041 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 rsync amd64 3.1.3-8ubuntu0.2 [318 kB]
Get:2 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 language-pack-gnome-en all 1:20.04+20220211 [1,928 B]
Get:3 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 language-pack-gnome-en-base all 1:20.04+20220211 [533 kB]               
Get:4 http://ir.archive.ubuntu.com/ubuntu focal-updates/main i386 libssl1.1 i386 1.1.1f-1ubuntu2.11 [1,318 kB]                                
Get:5 http://packages.microsoft.com/repos/code stable/main amd64 code amd64 1.65.1-1646706496 [78.5 MB]           
Get:6 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libssl1.1 amd64 1.1.1f-1ubuntu2.11 [1,321 kB]        
Get:7 http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu focal/main amd64 libx11-data all 2:1.7.2-3~ubuntu20.04 [124 kB]
Get:8 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 openssl amd64 1.1.1f-1ubuntu2.11 [621 kB]
Get:9 http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu focal/main amd64 libx11-xcb1 amd64 2:1.7.2-3~ubuntu20.04 [20.8 kB]
Get:10 http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu focal/main i386 libx11-xcb1 i386 2:1.7.2-3~ubuntu20.04 [20.8 kB]                                                       
Get:11 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libasan5 amd64 9.4.0-1ubuntu1~20.04 [2,752 kB]                                                                              
Get:12 http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu focal/main i386 libx11-6 i386 2:1.7.2-3~ubuntu20.04 [613 kB]                                                           
Get:13 http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu focal/main amd64 libx11-6 amd64 2:1.7.2-3~ubuntu20.04 [588 kB]                                                         
Get:14 http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu focal/main i386 libxfixes3 i386 1:6.0.0-4~ubuntu20.04 [13.6 kB]                                                        
Get:15 http://ppa.launchpad.net/pipewire-debian/pipewire-upstream/ubuntu focal/main amd64 libxfixes3 amd64 1:6.0.0-4~ubuntu20.04 [13.1 kB]                                                      
Get:16 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 g++-9 amd64 9.4.0-1ubuntu1~20.04 [8,421 kB]                                                                                 
Get:17 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9 amd64 9.4.0-1ubuntu1~20.04 [8,275 kB]                                                                                 
Get:18 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libstdc++-9-dev amd64 9.4.0-1ubuntu1~20.04 [1,722 kB]                                                                       
Get:19 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgcc-9-dev amd64 9.4.0-1ubuntu1~20.04 [2,360 kB]                                                                          
Get:20 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 cpp-9 amd64 9.4.0-1ubuntu1~20.04 [7,501 kB]                                                                                 
Get:21 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 gcc-9-base amd64 9.4.0-1ubuntu1~20.04 [19.4 kB]                                                                             
Get:22 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 firefox amd64 97.0.2+build1-0ubuntu0.20.04.1 [56.9 MB]                                                                      
54% [22 firefox 6,957 kB/56.9 MB 12%] [5 code 44.6 MB/78.5 MB 57%]                                                                                                                1,840 kB/s 46s Get:23 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 firefox-locale-en amd64 97.0.2+build1-0ubuntu0.20.04.1 [673 kB]                                                             
Get:24 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgl1 amd64 1.3.2-1~ubuntu0.20.04.2 [85.8 kB]                                                                              
Get:25 http://ir.archive.ubuntu.com/ubuntu focal-updates/main i386 libgl1 i386 1.3.2-1~ubuntu0.20.04.2 [80.4 kB]                                                                                
Get:26 http://ir.archive.ubuntu.com/ubuntu focal-updates/main i386 libglx0 i386 1.3.2-1~ubuntu0.20.04.2 [37.4 kB]                                                                               
Get:27 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libglx0 amd64 1.3.2-1~ubuntu0.20.04.2 [32.5 kB]                                                                             
Get:28 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libegl1 amd64 1.3.2-1~ubuntu0.20.04.2 [31.9 kB]                                                                             
Get:29 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libopengl0 amd64 1.3.2-1~ubuntu0.20.04.2 [29.2 kB]                                                                          
Get:30 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libgles2 amd64 1.3.2-1~ubuntu0.20.04.2 [15.6 kB]                                                                            
Get:31 http://ir.archive.ubuntu.com/ubuntu focal-updates/main i386 libglvnd0 i386 1.3.2-1~ubuntu0.20.04.2 [40.8 kB]                                                                             
Get:32 http://ir.archive.ubuntu.com/ubuntu focal-updates/main amd64 libglvnd0 amd64 1.3.2-1~ubuntu0.20.04.2 [48.1 kB]                                                                           
Fetched 173 MB in 1min 40s (1,738 kB/s)                                                                                                                                                         
Extracting templates from packages: 100%
Preconfiguring packages ...
dpkg: warning: files list file for package 'linux-firmware' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-generic-hwe-20.04' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'linux-image-generic-hwe-20.04' missing; assuming package has no files currently installed
(Reading database ... 317665 files and directories currently installed.)
Removing linux-image-5.13.0-27-generic (5.13.0-27.29~20.04.1) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.13.0-27-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 12: /etc/default/grub: nox2apic: not found
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.13.0-27-generic (--remove):
 installed linux-image-5.13.0-27-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-27-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

这是结果cat /etc/default/grub

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
intremap=no_x2apic_optout nox2apic

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

答案1

运行sudoedit /etc/default/grub,并更改以下两行:

GRUB_CMDLINE_LINUX=""
intremap=no_x2apic_optout nox2apic

如下所示,因为第二行是 Linux 内核参数列表:

GRUB_CMDLINE_LINUX="intremap=no_x2apic_optout nox2apic"

但是,由于这个错误,您的内核在没有的情况下运行intremap=no_x2apic_optout nox2apic,您确定您真的需要它吗?

相关内容