内核和其他软件包的“未满足的依赖关系”

内核和其他软件包的“未满足的依赖关系”

当我尝试安装某些包时,我得到以下输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-image-extra-4.13.0-45-generic : Depends: linux-image-4.13.0-45-generic but it is not going to be installed
 linux-image-generic-hwe-16.04 : Depends: linux-image-4.15.0-43-generic but it is not going to be installed
 linux-modules-extra-4.15.0-38-generic : Depends: linux-image-4.15.0-38-generic but it is not going to be installed or
                                                  linux-image-unsigned-4.15.0-38-generic but it is not going to be installed
 linux-modules-extra-4.15.0-39-generic : Depends: linux-image-4.15.0-39-generic but it is not going to be installed or
                                                  linux-image-unsigned-4.15.0-39-generic but it is not going to be installed
 linux-modules-extra-4.15.0-43-generic : Depends: linux-image-4.15.0-43-generic but it is not going to be installed or
                                                  linux-image-unsigned-4.15.0-43-generic but it is not going to be installed
 ubuntu-cleaner : Depends: python-defer but it is not installable
                  Depends: python-lxml but it is not going to be installed
                  Depends: python-dbus but it is not going to be installed
                  Depends: python-aptdaemon but it is not installable
                  Depends: python-aptdaemon.gtk3widgets but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

更新:的结果 -sudo apt-get -f install

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  dbconfig-common gyp javascript-common libaio1 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libevent-core-2.0-5 libjs-inherits libjs-jquery libjs-node-uuid libjs-sphinxdoc
  libjs-underscore liblua5.1-0 libmcrypt4 libssl-dev libssl-doc libuv1 libuv1-dev linux-headers-4.13.0-36 linux-headers-4.13.0-36-generic linux-headers-4.13.0-38 linux-headers-4.13.0-38-generic
  linux-headers-4.13.0-45 linux-headers-4.13.0-45-generic linux-headers-4.15.0-38 linux-headers-4.15.0-38-generic linux-headers-4.15.0-39 linux-headers-4.15.0-39-generic linux-image-4.13.0-36-generic
  linux-image-4.13.0-38-generic linux-image-4.13.0-45-generic linux-image-4.15.0-38-generic linux-image-4.15.0-39-generic linux-image-extra-4.13.0-36-generic linux-image-extra-4.13.0-38-generic
  linux-image-extra-4.13.0-45-generic linux-modules-4.15.0-38-generic linux-modules-4.15.0-39-generic linux-modules-extra-4.15.0-38-generic linux-modules-extra-4.15.0-39-generic python-pkg-resources
  zlib1g-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-4.13.0-45-generic linux-image-4.15.0-38-generic linux-image-4.15.0-39-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-39-generic linux-modules-4.15.0-43-generic
Suggested packages:
  fdutils linux-tools linux-hwe-tools
The following NEW packages will be installed:
  linux-image-4.13.0-45-generic linux-image-4.15.0-38-generic linux-image-4.15.0-39-generic linux-image-4.15.0-43-generic linux-modules-4.15.0-39-generic linux-modules-4.15.0-43-generic
0 upgraded, 6 newly installed, 0 to remove and 400 not upgraded.
18 not fully installed or removed.
Need to get 0 B/70,4 MB of archives.
After this operation, 228 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 465767 files and directories currently installed.)
Preparing to unpack .../linux-modules-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb ...
Unpacking linux-modules-4.15.0-43-generic (4.15.0-43.46~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-modules-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/System.map-4.15.0-43-generic' to '/boot/System.map-4.15.0-43-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../linux-image-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb ...
Unpacking linux-image-4.15.0-43-generic (4.15.0-43.46~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.15.0-43-generic' to '/boot/vmlinuz-4.15.0-43-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../linux-image-4.13.0-45-generic_4.13.0-45.50~16.04.1_amd64.deb ...
Examining /etc/kernel/preinst.d/
run-parts: executing /etc/kernel/preinst.d/intel-microcode 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
Done.
Unpacking linux-image-4.13.0-45-generic (4.13.0-45.50~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.13.0-45-generic_4.13.0-45.50~16.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.13.0-45-generic' to '/boot/vmlinuz-4.13.0-45-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.13.0-45-generic /boot/vmlinuz-4.13.0-45-generic
Preparing to unpack .../linux-image-4.15.0-38-generic_4.15.0-38.41~16.04.1_amd64.deb ...
Unpacking linux-image-4.15.0-38-generic (4.15.0-38.41~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.15.0-38-generic_4.15.0-38.41~16.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.15.0-38-generic' to '/boot/vmlinuz-4.15.0-38-generic.dpkg-new': failed to write (No space left on device)
No apport report written because MaxReports is reached already
                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../linux-modules-4.15.0-39-generic_4.15.0-39.42~16.04.1_amd64.deb ...
Unpacking linux-modules-4.15.0-39-generic (4.15.0-39.42~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-modules-4.15.0-39-generic_4.15.0-39.42~16.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/System.map-4.15.0-39-generic' to '/boot/System.map-4.15.0-39-generic.dpkg-new': failed to write (No space left on device)
No apport report written because MaxReports is reached already
                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Preparing to unpack .../linux-image-4.15.0-39-generic_4.15.0-39.42~16.04.1_amd64.deb ...
Unpacking linux-image-4.15.0-39-generic (4.15.0-39.42~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.15.0-39-generic_4.15.0-39.42~16.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.15.0-39-generic' to '/boot/vmlinuz-4.15.0-39-generic.dpkg-new': failed to write (No space left on device)
No apport report written because MaxReports is reached already
                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-modules-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb
 /var/cache/apt/archives/linux-image-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb
 /var/cache/apt/archives/linux-image-4.13.0-45-generic_4.13.0-45.50~16.04.1_amd64.deb
 /var/cache/apt/archives/linux-image-4.15.0-38-generic_4.15.0-38.41~16.04.1_amd64.deb
 /var/cache/apt/archives/linux-modules-4.15.0-39-generic_4.15.0-39.42~16.04.1_amd64.deb
 /var/cache/apt/archives/linux-image-4.15.0-39-generic_4.15.0-39.42~16.04.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

更新2: 的结果 -df -h

226M  220M     0 100% /boot

的结果 -du -h --max-depth=1 /boot

120M    /boot/.Trash-0
6,8M    /boot/grub
12K     /boot/lost+found
218M    /boot

但如果我在 Nautilus 中打开文件夹属性,我会看到不同的大小

307 个项目,总计 102.2 MB(部分内容无法读取)

的结果ls-total 93009

更新3:所有带有aptapt-getdpkg) 的命令都会出现以下错误:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 linux-headers-4.15.0-38-generic : Depends: linux-headers-4.15.0-38 but it is not going to be installed
 linux-image-extra-4.13.0-36-generic : Depends: linux-image-4.13.0-36-generic but it is not going to be installed
 linux-image-extra-4.13.0-38-generic : Depends: linux-image-4.13.0-38-generic but it is not going to be installed
 linux-image-extra-4.13.0-41-generic : Depends: linux-image-4.13.0-41-generic but it is not going to be installed
 linux-image-extra-4.13.0-43-generic : Depends: linux-image-4.13.0-43-generic but it is not going to be installed
 linux-image-generic-hwe-16.04 : Depends: linux-image-4.15.0-43-generic but it is not going to be installed
 linux-modules-extra-4.15.0-43-generic : Depends: linux-image-4.15.0-43-generic but it is not going to be installed or
                                                  linux-image-unsigned-4.15.0-43-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

答案1

似乎没有空间。

  • 因此首先确认这一点。

  • 为所有人而跑Ubuntu 分区例如“/” “/boot”等等。

    df -h /
    df -h /boot
    df -h /<other-partions-if-any>
    
  • 在“/boot”分区中腾出空间。

  • 检查额外的内核。在终端中运行。

    apt --dry-run purge $(dpkg -l|egrep 'linux-image-[0-9]|linux-headers-[0-9]'|awk '{print $3,$2}'|grep -v `uname -r|cut -f1,2 -d"-"`|sort -nr|tail -n +4|awk '{ print $2}')
    
  • 如果可以,则删除除最新两个内核之外的所有内核。在终端中运行。

    sudo apt purge $(dpkg -l|egrep 'linux-image-[0-9]|linux-headers-[0-9]'|awk '{print $3,$2}'|grep -v `uname -r|cut -f1,2 -d"-"`|sort -nr|tail -n +4|awk '{ print $2}')
    
  • 如果这不可能并且 /boot 已满,请通过以下方式删除一些 config* 文件

  • 注意:不要删除与最新两个内核相关的任何文件。

    sudo rm /boot/<file-name>旧内核或者甚至一些 vimlinuz* 文件。

  • 解决问题后,在终端中运行。

    sudo apt autoremove
    
  • 在“/”分区中腾出空间。

  • 要删除不需要的包。在终端中运行。

    sudo apt autoremove
    
  • 要删除 apt 缓存中的所有 .deb 文件。在终端中运行。

    sudo apt clean
    
  • 要删除旧的配置文件。在终端中运行。

    dpkg -l | grep '^rc' | awk '{print $2}' | xargs sudo apt purge -y
    
  • 清空所有垃圾。在终端中运行。

    rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
    sudo rm -rf /root/.local/share/Trash/*/** &> /dev/null
    
  • 要删除多余的内核。在终端中运行。

     sudo apt purge $(dpkg -l|egrep 'linux-image-[0-9]|linux-headers-[0-9]'|awk '{print $3,$2}'|grep -v `uname -r|cut -f1,2 -d"-"`|sort -nr|tail -n +4|awk '{ print $2}')
    
  • 要删除孤立的包。在终端中运行。

    sudo apt install deborphan
    sudo deborphan | xargs sudo apt -y remove --purge
    
  • 将一些已保存的视频音频或其他个人数据文件从 /home 移动到其他分区。

答案2

你的空间已经用完了。根据日志显示,你的磁盘似乎已满。

dpkg:处理档案 /var/cache/apt/archives/linux-modules-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb (--unpack) 时出错:无法将“./boot/System.map-4.15.0-43-generic”的提取数据复制到“/boot/System.map-4.15.0-43-generic.dpkg-new”:写入失败(设备上没有剩余空间)没有写入批准报告,因为错误消息表明磁盘已满错误 dpkg-deb: 错误:子进程 paste 被信号 (管道断裂) 终止,准备解压 .../linux-image-4.15.0-43-generic_4.15.0-43.46~16.04.1_amd64.deb ...

您可以尝试删除不再需要的文件和/或将云服务上的任何媒体内容备份到可用空间。

编辑 建议编辑。我使用了以下方法清理多余的软件包并释放空间,如@所述https://askubuntu.com/a/205776/599385

答案3

您需要释放一些空间。您应该检查您的 /boot 分区/文件夹,是否可以将其扩大?您可以发布输出sudo df -hsudo du -h --max-depth=1 /boot

查看 .du 命令的输出后,你会发现 /boot 中有一个 .Trash 文件夹(你是不是用 nautilus 删除了什么东西?)。尝试删除它,然后执行 apt 和 dpkg 命令

相关内容