apt-get install -f -- 错误:磁盘上没有剩余空间

apt-get install -f -- 错误:磁盘上没有剩余空间

我在使用 GPG 密钥时遇到了缓存限制问题。这里有一篇文章解决了这个问题,现在sudo apt-get update运行时没有任何错误。现在sudo apt-get upgrade不起作用。它告诉我尝试一下sudo apt-get -f install,当我运行它时,我得到了如下所示的错误:

:~$ sudo apt-get -f install

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating dependencies... Done
The packages listed below were installed automatically and are no longer needed.
  linux-headers-3.13.0-35 linux-headers-3.13.0-35-generic
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  linux-headers-3.13.0-46
The following new packages will be installed:
  linux-headers-3.13.0-46
0 updated, 1 will be installed, 0 to remove 455 not updated.
2 not fully installed or removed.
You need to download 0 B/8.877 kB of packages.
This operation will require 63.3 MB of additional disk space.
Do you want to continue? [Y/n] y
(Reading the database ... 1181689 files or directories are now installed.)
Preparing to unpack .../linux-headers-3.13.0-46_3.13.0-46.79_all.deb ...
Unpacking linux-headers-3.13.0-46 (3.13.0-46.79) ...
dpkg: error processing the archive /var/cache/apt/archives/linux-headers-3.13.0-46_3.13.0-46.79_all.deb (--unpack):
 Could not create `/usr/src/linux-headers-3.13.0-46/arch/ia64/include/asm/cache.h.dpkg-new' (while processing `./usr/src/linux-headers-3.13.0-46/arch/ia64/include/asm/cache.h'):   
No space left on device.  
No apport report written because MaxReports is reached already.  
dpkg-deb: error: error: subprocess paste was killed by signal (Broken pipe).  
The following errors were encountered during processing:  
 /var/cache/apt/archives/linux-headers-3.13.0-46_3.13.0-46.79_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
}

答案1

测试一下:

打开一个终端。

Ctrl++AltT

运行:

sudo -i
apt-get clean
apt-get autoremove
UNUSCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
apt-get remove --purge $UNUSCONF
NEWKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
ADDKERNEL="linux-(image|headers|ubuntu-modules|restricted-modules)"
METAKERNEL="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
UNUSKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $ADDKERNEL |grep -vE $METAKERNEL|grep -v $NEWKERNEL)
apt-get remove --purge $UNUSKERNELS
apt-get install --reinstall deborphan
deborphan
apt-get --purge remove $(deborphan)
deborphan --libdevel
apt-get --purge remove $(deborphan --libdevel)
deborphan --find-config
dpkg --purge $(deborphan --find-config)
apt-get update
apt-get dist-upgrade
dpkg --configure -a
apt-get -f install
apt-get clean
reboot

相关内容