apt-get install -f 报错,求助!?

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
bf6688
帖子: 5
注册时间: 2015-03-29 7:44
系统: ubuntu14.10

apt-get install -f 报错,求助!?

#1

帖子 bf6688 » 2017-09-30 11:48

今天在在安装新软件时,要求先执行命令

代码: 全选

 apt-get install -f -y 
就出现如下错误,

代码: 全选

root@Linux-01:/var/lib/dpkg# apt-get install -f -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  linux-image-4.4.0-89-generic
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
  linux-image-4.4.0-89-generic
0 upgraded, 1 newly installed, 0 to remove and 80 not upgraded.
36 not fully installed or removed.
Need to get 0 B/21.9 MB of archives.
After this operation, 67.0 MB of additional disk space will be used.
(Reading database ... 440279 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-89-generic_4.4.0-89.112_amd64.deb ...
Done.
Unpacking linux-image-4.4.0-89-generic (4.4.0-89.112) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-89-generic_4.4.0-89.112_amd64.deb (--unpack):
 cannot copy extracted data for './boot/System.map-4.4.0-89-generic' to '/boot/System.map-4.4.0-89-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.4.0-89-generic /boot/vmlinuz-4.4.0-89-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-89-generic /boot/vmlinuz-4.4.0-89-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-89-generic_4.4.0-89.112_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
root@Linux-01:/var/lib/dpkg# 

uname 信息

代码: 全选

root@Linux-01:/var/lib/dpkg# uname -a
Linux Linux-01 4.4.0-79-generic #100-Ubuntu SMP Wed May 17 19:58:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: apt-get install -f 报错,求助!?

#2

帖子 vickycq » 2017-09-30 12:10

可能原因 /boot 空间已满,无法写入
执行以下指令将结果全部复制贴上来

代码: 全选

du -sh /boot/*
df -h
sudo fdisk -l
dpkg -l | grep linux-i
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: apt-get install -f 报错,求助!?

#3

帖子 poloshiao » 2017-09-30 12:13

apt-get install -f -y
1. http://manpages.ubuntu.com/manpages/xen ... get.8.html
apt-get - APT package handling utility -- command-line interface
-f, --fix-broken
Fix; attempt to correct a system with broken dependencies in place.
This option, when used with install/remove, can omit any packages
to permit APT to deduce a likely solution.
The option is sometimes necessary when running APT for the first time; APT
itself does not allow broken package dependencies to exist on a
system. It is possible that a system's dependency structure can be
so corrupt as to require manual intervention (which usually means
using dpkg --remove to eliminate some of the offending packages).
1-1. 意思是
不能完全依賴
apt-get install -f
1-2. 有時 手動涉入補救 還是必須的
root@Linux-01:/var/lib/dpkg# apt-get install -f -y
2. 在 Ubuntu 不建議使用 root 登入
2-1. 試試
以安裝 Ubuntu 時 創建的 使用者 登入
2-2. 需要 root 權限時
sudo + 文字指令
gksudo + gnome-圖形指令
kdesudo + kde-圖形指令
bf6688
帖子: 5
注册时间: 2015-03-29 7:44
系统: ubuntu14.10

Re: apt-get install -f 报错,求助!?

#4

帖子 bf6688 » 2017-09-30 13:22

vickycq 写了:可能原因 /boot 空间已满,无法写入
执行以下指令将结果全部复制贴上来

代码: 全选

du -sh /boot/*
df -h
sudo fdisk -l
dpkg -l | grep linux-i

代码: 全选

root@Linux-01:/var/lib/dpkg# du -sh /boot/*
1.2M	/boot/abi-4.4.0-21-generic
1.2M	/boot/abi-4.4.0-64-generic
1.2M	/boot/abi-4.4.0-66-generic
1.2M	/boot/abi-4.4.0-70-generic
1.2M	/boot/abi-4.4.0-71-generic
1.2M	/boot/abi-4.4.0-72-generic
1.2M	/boot/abi-4.4.0-75-generic
1.2M	/boot/abi-4.4.0-78-generic
1.2M	/boot/abi-4.4.0-79-generic
1.2M	/boot/abi-4.4.0-81-generic
1.2M	/boot/abi-4.4.0-83-generic
1.2M	/boot/abi-4.4.0-87-generic
186K	/boot/config-4.4.0-21-generic
187K	/boot/config-4.4.0-64-generic
187K	/boot/config-4.4.0-66-generic
187K	/boot/config-4.4.0-70-generic
187K	/boot/config-4.4.0-71-generic
187K	/boot/config-4.4.0-72-generic
187K	/boot/config-4.4.0-75-generic
187K	/boot/config-4.4.0-78-generic
187K	/boot/config-4.4.0-79-generic
187K	/boot/config-4.4.0-81-generic
187K	/boot/config-4.4.0-83-generic
187K	/boot/config-4.4.0-87-generic
6.7M	/boot/grub
35M	/boot/initrd.img-4.4.0-21-generic
35M	/boot/initrd.img-4.4.0-64-generic
35M	/boot/initrd.img-4.4.0-66-generic
35M	/boot/initrd.img-4.4.0-70-generic
35M	/boot/initrd.img-4.4.0-71-generic
35M	/boot/initrd.img-4.4.0-72-generic
35M	/boot/initrd.img-4.4.0-75-generic
35M	/boot/initrd.img-4.4.0-78-generic
35M	/boot/initrd.img-4.4.0-79-generic
12K	/boot/lost+found
3.7M	/boot/System.map-4.4.0-21-generic
3.8M	/boot/System.map-4.4.0-64-generic
3.8M	/boot/System.map-4.4.0-66-generic
3.8M	/boot/System.map-4.4.0-70-generic
3.8M	/boot/System.map-4.4.0-71-generic
3.8M	/boot/System.map-4.4.0-72-generic
3.8M	/boot/System.map-4.4.0-75-generic
3.8M	/boot/System.map-4.4.0-78-generic
3.8M	/boot/System.map-4.4.0-79-generic
3.8M	/boot/System.map-4.4.0-81-generic
3.8M	/boot/System.map-4.4.0-83-generic
3.8M	/boot/System.map-4.4.0-87-generic
6.8M	/boot/vmlinuz-4.4.0-21-generic
6.8M	/boot/vmlinuz-4.4.0-64-generic
6.8M	/boot/vmlinuz-4.4.0-66-generic
6.8M	/boot/vmlinuz-4.4.0-70-generic
6.8M	/boot/vmlinuz-4.4.0-71-generic
6.8M	/boot/vmlinuz-4.4.0-72-generic
6.8M	/boot/vmlinuz-4.4.0-75-generic
6.8M	/boot/vmlinuz-4.4.0-78-generic
6.8M	/boot/vmlinuz-4.4.0-79-generic
6.8M	/boot/vmlinuz-4.4.0-81-generic
6.8M	/boot/vmlinuz-4.4.0-83-generic
6.8M	/boot/vmlinuz-4.4.0-87-generic
root@Linux-01:/var/lib/dpkg# df -h
Filesystem                      Size  Used Avail Use% Mounted on
udev                            982M     0  982M   0% /dev
tmpfs                           201M   21M  180M  11% /run
/dev/mapper/Linux--01--vg-root   29G  8.2G   20G  30% /
tmpfs                          1001M  4.0K 1001M   1% /dev/shm
tmpfs                           5.0M     0  5.0M   0% /run/lock
tmpfs                          1001M     0 1001M   0% /sys/fs/cgroup
/dev/sda1                       472M  464M     0 100% /boot
tmpfs                           100K     0  100K   0% /run/lxcfs/controllers
tmpfs                           201M     0  201M   0% /run/user/1000
/home/esr/.Private               29G  8.2G   20G  30% /home/esr
root@Linux-01:/var/lib/dpkg# sudo fdisk -l
Disk /dev/sda: 32 GiB, 34359738368 bytes, 67108864 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x628ba4a0

Device     Boot   Start      End  Sectors  Size Id Type
/dev/sda1  *       2048   999423   997376  487M 83 Linux
/dev/sda2       1001470 67106815 66105346 31.5G  5 Extended
/dev/sda5       1001472 67106815 66105344 31.5G 8e Linux LVM


Disk /dev/mapper/Linux--01--vg-root: 29.5 GiB, 31650217984 bytes, 61816832 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/Linux--01--vg-swap_1: 2 GiB, 2143289344 bytes, 4186112 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/cryptswap1: 2 GiB, 2142765056 bytes, 4185088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
root@Linux-01:/var/lib/dpkg# dpkg -l | grep linux-i
ii  linux-image-4.4.0-21-generic       4.4.0-21.37                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-64-generic       4.4.0-64.85                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-66-generic       4.4.0-66.87                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-70-generic       4.4.0-70.91                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  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
ii  linux-image-4.4.0-72-generic       4.4.0-72.93                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-75-generic       4.4.0-75.96                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
pi  linux-image-4.4.0-78-generic       4.4.0-78.99                                amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-4.4.0-79-generic       4.4.0-79.100                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-83-generic       4.4.0-83.106                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-87-generic       4.4.0-87.110                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-21-generic 4.4.0-21.37                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-64-generic 4.4.0-64.85                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  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
ii  linux-image-extra-4.4.0-70-generic 4.4.0-70.91                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  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
ii  linux-image-extra-4.4.0-72-generic 4.4.0-72.93                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-75-generic 4.4.0-75.96                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  linux-image-extra-4.4.0-78-generic 4.4.0-78.99                                amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
ii  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
iU  linux-image-extra-4.4.0-83-generic 4.4.0-83.106                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  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
iU  linux-image-extra-4.4.0-89-generic 4.4.0-89.112                               amd64        Linux kernel extra modules for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-generic                4.4.0.89.95                                amd64        Generic Linux kernel image

boot 真的是满了。但删除旧内核还是会报错怎么破?

代码: 全选

root@Linux-01:/boot# apt-get purge linux-image-4.4.0-21-generic 
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.4.0-21-generic : Depends: linux-image-4.4.0-21-generic but it is not going to be installed
 linux-image-extra-4.4.0-89-generic : Depends: linux-image-4.4.0-89-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-89-generic but it is not going to be installed
                       Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

头像
vickycq
帖子: 4507
注册时间: 2011-03-20 13:12
系统: Debian
来自: 山东省寿光县
联系:

Re: apt-get install -f 报错,求助!?

#5

帖子 vickycq » 2017-09-30 16:49

先手工删除旧内核的 initrd。注意!您目前使用 -79 内核,不要删除当前内核的 initrd
删除后,运行 sudo apt-get update; sudo apt-get install -f
然后可以尝试移除旧内核。
Debian 中文论坛 - forums.debiancn.org
欢迎所有 Debian GNU/Linux 用户
回复