安装包时“设备上没有剩余空间”,但我还有空间
无论是通过更新管理器,还是通过终端,我都会出错。
当我尝试sudo apt-get update && sudo apt-get upgrade
:
Fetched 1,024 kB in 20s (51.0 kB/s) Reading package lists... Done 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-generic : Depends: linux-headers-3.13.0-29-generic but it is not installed E: Unmet dependencies. Try using -f.
当我尝试sudo apt-get -f install
:
Unpacking linux-headers-3.13.0-29-generic (3.13.0-29.53) ... dpkg: error processing archive /var/cache/apt/archives/linux-headers-3.13.0-29-generic_3.13.0-29.53_amd64.deb (--unpack): unable to create /usr/src/linux-headers-3.13.0-29-generic/include/config/inotify/user.h.dpkg-new' (while processing./usr/src/linux-headers-3.13.0-29-generic/include/config/inotify/user.h'): 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) Errors were encountered while processing: /var/cache/apt/archives/linux-headers-3.13.0-29-generic_3.13.0-29.53_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1)
当我打开Ubuntu软件中心时,我得到以下文字:
无法安装新软件,因为当前安装的软件存在问题。 你想现在修复这个问题吗?
我可以选择“修复”或“取消”。 如果我点击’修复’,我会收到以下错误:
Package operation failed the installation or removal of a software package failed. (Reading database ... 417598 files and directories currently installed.) Preparing to unpack .../linux-headers-3.13.0-29-generic_3.13.0-29.53_amd64.deb ... Unpacking linux-headers-3.13.0-29-generic (3.13.0-29.53) ... dpkg: error processing archive /var/cache/apt/archives/linux-headers-3.13.0-29-generic_3.13.0-29.53_amd64.deb (--unpack): unable to create /usr/src/linux-headers-3.13.0-29-generic/include/config/bug.h.dpkg-new' (while processing./usr/src/linux-headers-3.13.0-29-generic/include/config/bug.h'): 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) Errors were encountered while processing: /var/cache/apt/archives/linux-headers-3.13.0-29-generic_3.13.0-29.53_amd64.deb Error in function: dpkg: dependency problems prevent configuration of linux-headers-generic: linux-headers-generic depends on linux-headers-3.13.0-29-generic; however: Package linux-headers-3.13.0-29-generic is not installed. dpkg: error processing package linux-headers-generic (--configure): dependency problems - leaving unconfigured dpkg: dependency problems prevent configuration of linux-generic: linux-generic depends on linux-headers-generic (= 3.13.0.29.35); however: Package linux-headers-generic is not configured yet. dpkg: error processing package linux-generic (--configure): dependency problems - leaving unconfigured
磁盘已满错误是奇怪的,因为我的磁盘都没有满。 我知道这个,因为当我运行df
,我得到以下内容:
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda6 36178648 13162504 21155332 39% / none 4 0 4 0% /sys/fs/cgroup udev 3873544 12 3873532 1% /dev tmpfs 776860 1384 775476 1% /run none 5120 0 5120 0% /run/lock none 3884300 25276 3859024 1% /run/shm none 102400 68 102332 1% /run/user /dev/sda2 124327968 42583252 81744716 35% /media/sudoer/48AEC994AEC97B48 /dev/sda3 807468724 121812996 685655728 16% /media/sudoer/New Volume
我现在该怎么办? 提前致谢。
在unix文件系统上,文件和目录有两部分: inode和data。
在inode中存储有关文件的信息,例如许可,所有者,更改时间,访问时间等。
索引节点的总数是有限的 ,因此即使磁盘不是很满,如果达到此限制 ,也可以No space left on device
。
使用:
df -i
要查看inode,如果你得到100%的IUse
和0 IFree
,这意味着你有很多小文件。
例如,如果您有2亿个文件,其大小为1个字节,则可以达到inode限制,但您的磁盘可能未完全填满。
如果是这种情况,请尝试删除更多文件,然后重做apt-get update
。
我也遇到过这个问题。 根据提示,
无法创建/usr/src/linux-headers-3.13.0-29-generic/include / …
正如Lety所解释的那样,“inode的总数是有限的”。 所以我使用包管理器删除了一些旧的linux-headers包,所以/usr
会有足够的inode,例如sudo apt-get remove linux-headers-3.13.0-3*
,然后我可以运行sudo apt-get install -f
继续安装
你可以用/ boot(删除旧的linux头文件等)清理空间,用:
sudo apt-get autoremove
正如@Lety所说,问题是如何查找包含许多浪费所有inode的小文件的文件夹(如df -i
show)。
查找旧内核或重包:
-
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}'|tail -n 10
- 安装
wajig sizes | tail
更容易:wajig sizes | tail
wajig sizes | tail
使用uname -r
查找当前内核。
然后尝试:
- 重新启动或尝试或者如果进程(要杀死)已经打开了一个大文件,该文件已被删除
sudo lsof +L1
- 删除未使用的包
sudo apt-get autoremove
- 在
/var/cache/apt/archives
上清理缓存sudo apt-get clean
或手动sudo apt-get clean
- 使用
apt-get remove
或sudo dpkg --purge
删除一些旧内核或重包。 也许你仍然unable to create /usr/src/linux-headers
… - 如果你到了这里,你将使用那些缓慢的技术来找到有罪的文件夹,但首先
for i in /usr/src/*; do echo $i; find $i |wc -l; done
使用像for i in /usr/src/*; do echo $i; find $i |wc -l; done
这样for i in /usr/src/*; do echo $i; find $i |wc -l; done
东西去常见的嫌疑人for i in /usr/src/*; do echo $i; find $i |wc -l; done
for i in /usr/src/*; do echo $i; find $i |wc -l; done
for i in /usr/src/*; do echo $i; find $i |wc -l; done
:- Linux头文件夹:
/usr/src/linux-headers-*
- 日志:
/var/log
- 日志:
/var/
- Linux头文件夹:
特定文件夹柜台:
-
du --inodes -d 1 /usr/src/ | sort -n
-
sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
-
sudo find . -maxdepth 1 -type d | grep -v '^\.$' | xargs -n 1 -i{} find {} -xdev -type f | cut -d "/" -f 2 | uniq -c | sort -n
你的tmpfs
可能已满。 /tmp
存在于RAM或交换中。 您可以通过运行来检查正在使用的空间:
$ df -h | grep tmpfs Filesystem Size Used Avail Use% Mounted on tmpfs 3.9G 33M 3.9G 1% /dev/shm tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup tmpfs 3.9G 3.9G 0 100% /tmp
要暂时增加其大小,请尝试以下命令:
sudo mount -o remount,size=16G,noatime /tmp
您还可以通过/etc/fstab
永久增加大小。