sudo dpkg --configure -a 错误

sudo dpkg --configure -a 错误

我似乎无法修复这种错误

当我安装一个包时一切都失败了

    Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libllvm4.0 linux-headers-4.4.0-157 linux-headers-4.4.0-157-generic linux-image-4.4.0-103-generic linux-image-4.4.0-109-generic linux-image-4.4.0-127-generic linux-image-4.4.0-137-generic linux-image-4.4.0-138-generic linux-image-4.4.0-157-generic linux-image-4.4.0-71-generic linux-image-4.4.0-96-generic
  linux-modules-4.4.0-157-generic linux-modules-extra-4.4.0-157-generic
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  linux-image-extra-4.4.0-103-generic linux-image-extra-4.4.0-109-generic linux-image-extra-4.4.0-127-generic linux-image-extra-4.4.0-137-generic linux-image-extra-4.4.0-138-generic linux-image-extra-4.4.0-66-generic linux-image-extra-4.4.0-71-generic linux-image-extra-4.4.0-79-generic
  linux-image-extra-4.4.0-87-generic linux-image-extra-4.4.0-96-generic linux-image-extra-4.4.0-98-generic
The following NEW packages will be installed:
  curl
0 to upgrade, 1 to newly install, 11 to remove and 0 not to upgrade.
24 not fully installed or removed.
Need to get 0 B/139 kB of archives.
After this operation, 1,688 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 1385987 files and directories currently installed.)
Removing linux-image-extra-4.4.0-103-generic (4.4.0-103.126) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-103-generic /boot/vmlinuz-4.4.0-103-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-103-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-103-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-103-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-109-generic (4.4.0-109.132) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-109-generic /boot/vmlinuz-4.4.0-109-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-109-generic /boot/vmlinuz-4.4.0-109-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-109-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-109-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-109-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-127-generic (4.4.0-127.153) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-127-generic /boot/vmlinuz-4.4.0-127-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-127-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-127-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-127-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
Removing linux-image-extra-4.4.0-137-generic (4.4.0-137.163) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-137-generic /boot/vmlinuz-4.4.0-137-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-137-generic /boot/vmlinuz-4.4.0-137-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-137-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-137-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-137-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-138-generic (4.4.0-138.164) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-138-generic /boot/vmlinuz-4.4.0-138-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-138-generic /boot/vmlinuz-4.4.0-138-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-138-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-138-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-138-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-66-generic (4.4.0-66.87) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-66-generic /boot/vmlinuz-4.4.0-66-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-66-generic /boot/vmlinuz-4.4.0-66-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-66-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-66-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-66-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-71-generic (4.4.0-71.92) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-71-generic /boot/vmlinuz-4.4.0-71-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-71-generic /boot/vmlinuz-4.4.0-71-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-71-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-71-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-71-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-79-generic (4.4.0-79.100) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-79-generic /boot/vmlinuz-4.4.0-79-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-79-generic /boot/vmlinuz-4.4.0-79-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-79-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-79-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-79-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-87-generic (4.4.0-87.110) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-87-generic /boot/vmlinuz-4.4.0-87-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-87-generic /boot/vmlinuz-4.4.0-87-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-87-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-87-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-87-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-96-generic (4.4.0-96.119) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-96-generic /boot/vmlinuz-4.4.0-96-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-96-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-96-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-96-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Removing linux-image-extra-4.4.0-98-generic (4.4.0-98.121) ...
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-98-generic /boot/vmlinuz-4.4.0-98-generic
update-initramfs: Generating /boot/initrd.img-4.4.0-98-generic
E: /usr/share/initramfs-tools/hooks/btrfs failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.4.0-98-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-extra-4.4.0-98-generic (--remove):
 subprocess installed post-removal script returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 linux-image-extra-4.4.0-103-generic
 linux-image-extra-4.4.0-109-generic
 linux-image-extra-4.4.0-127-generic
 linux-image-extra-4.4.0-137-generic
 linux-image-extra-4.4.0-138-generic
 linux-image-extra-4.4.0-66-generic
 linux-image-extra-4.4.0-71-generic
 linux-image-extra-4.4.0-79-generic
 linux-image-extra-4.4.0-87-generic
 linux-image-extra-4.4.0-96-generic
 linux-image-extra-4.4.0-98-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)


Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
+++-=====================================-==========================================-============-===============================================================================
iF  initramfs-tools                       0.122ubuntu8.14                            all          generic modular initramfs generator (automation)
iF  linux-firmware                        1.157.22                                   all          Firmware for Linux kernel drivers
iU  linux-generic                         4.4.0.164.172                              amd64        Complete Generic Linux kernel and headers
iF  linux-image-4.4.0-103-generic         4.4.0-103.126                              amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-109-generic         4.4.0-109.132                              amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-127-generic         4.4.0-127.153                              amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-137-generic         4.4.0-137.163                              amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-138-generic         4.4.0-138.164                              amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-159-generic         4.4.0-159.187                              amd64        Signed kernel image generic
iF  linux-image-4.4.0-164-generic         4.4.0-164.192                              amd64        Signed kernel image generic
iF  linux-image-4.4.0-71-generic          4.4.0-71.92                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-96-generic          4.4.0-96.119                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-103-generic   4.4.0-103.126                              amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-109-generic   4.4.0-109.132                              amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-127-generic   4.4.0-127.153                              amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-137-generic   4.4.0-137.163                              amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-138-generic   4.4.0-138.164                              amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-66-generic    4.4.0-66.87                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-71-generic    4.4.0-71.92                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-79-generic    4.4.0-79.100                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-87-generic    4.4.0-87.110                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-96-generic    4.4.0-96.119                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
rH  linux-image-extra-4.4.0-98-generic    4.4.0-98.121                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-generic                   4.4.0.164.172                              amd64        Generic Linux kernel image

答案1

此错误不是昨天发生的。请备份重要数据。

wget -c http://security.ubuntu.com/ubuntu/pool/main/i/initramfs-tools/initramfs-tools_0.122ubuntu8.14_all.deb

直接使用 dpkg 安装包。

sudo dpkg -i initramfs-tools_0.122ubuntu8.14_all.deb

控制

dpkg -l | grep initramfs-tools

如果软件包安装正确,应该会看ii initramfs-tools 0.122ubuntu8.14。这很重要。许多内核状况不佳。

下一步

df -h;df -i

显示有多少空间和 inode 可用。如果您有单独的 /boot 分区,这尤其重要。

如果你有足够的空间

sudo dpkg --configure -a && sudo apt -f install

如果没有的话你必须删除一些包。

使用以下命令检查正在运行的内核

uname -a

现在摆脱状态不清洁的内核包。

 dpkg -l 'linux-[ihs]*' | sed '/^iF/!d;/'"$(uname -r | sed "s/\([-0-9]*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' > | tee removing-kernel

dpkg -l 'linux-[ihs]*' | sed '/^rH/!d;/'"$(uname -r | sed "s/\([-0-9]*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | tee -a  removing-kernel

cat removing-kernel应包含以下包。重要。

linux-image-4.4.0-103-generic         
linux-image-4.4.0-109-generic         
linux-image-4.4.0-127-generic         
linux-image-4.4.0-137-generic         
linux-image-4.4.0-138-generic         
linux-image-4.4.0-159-generic         
linux-image-4.4.0-164-generic         
linux-image-4.4.0-71-generic          
linux-image-4.4.0-96-generic         
linux-image-extra-4.4.0-103-generic   
linux-image-extra-4.4.0-109-generic   
linux-image-extra-4.4.0-127-generic   
linux-image-extra-4.4.0-137-generic   
linux-image-extra-4.4.0-138-generic  
linux-image-extra-4.4.0-66-generic   
linux-image-extra-4.4.0-71-generic    
linux-image-extra-4.4.0-79-generic    
linux-image-extra-4.4.0-87-generic    
linux-image-extra-4.4.0-96-generic    
linux-image-extra-4.4.0-98-generic  

现在用

cat removing-kernel | xargs sudo apt-get -y purge 

apt-get purge 这个不需要任何操作。

继续。现在让我们看看你的系统上有多少个内核。

dpkg -l 'linux-[ihs]*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\([-0-9]*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

列出除正在运行的内核之外的所有安装的内核。

如果是这样,

sudo apt purge $(dpkg -l 'linux-[ihs]*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\([-0-9]*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d') 

在那之后

sudo dpkg --configure -a && sudo apt -f install

如果出现问题请告知我们并停止。

相关内容