APT 报告磁盘已满但磁盘并未满!

APT 报告磁盘已满但磁盘并未满!

通常我能够通过 apt 谷歌搜索解决这些问题,但这个问题让我很为难。它显然抱怨磁盘空间不足,但它却报告说它甚至无法在 sda1 上创建目录?

任何建议将不胜感激!

这是我尝试后的输出。

duncan@BEDROOM:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            1.6G  4.0K  1.6G   1% /dev
tmpfs           328M  1.4M  326M   1% /run
/dev/sda1        14G  9.8G  3.1G  76% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
none            5.0M     0  5.0M   0% /run/lock
none            1.6G   13M  1.6G   1% /run/shm
none            100M  8.0K  100M   1% /run/user



duncan@BEDROOM:~$ sudo apt-get clean


duncan@BEDROOM:~$ sudo apt-get install
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-100-generic but it is not installed
E: Unmet dependencies. Try using -f.

duncan@BEDROOM:~$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-headers-3.13.0-100-generic
The following NEW packages will be installed
linux-headers-3.13.0-100-generic
0 to upgrade, 1 to newly install, 0 to remove and 5 not to upgrade.
1 not fully installed or removed.
Need to get 688 kB of archives.
After this operation, 13.2 MB of additional disk space will be used.
Do you want to continue? [Y/n] y

Get:1 http://gb.archive.ubuntu.com/ubuntu/ trusty-updates/main linux-headers-3.13.0-100-generic i386 3.13.0-100.147 [688 kB]
Fetched 688 kB in 1s (433 kB/s)                           
(Reading database ... 422618 files and directories currently installed.)
Preparing to unpack .../linux-headers-3.13.0-100-generic_3.13.0-100.147_i386.deb ...
Unpacking linux-headers-3.13.0-100-generic (3.13.0-100.147) ...
No apport report written because the error message indicates a disk full error
dpkg: error processing archive /var/cache/apt/archives/linux-headers-3.13.0-100-generic_3.13.0-100.147_i386.deb (--unpack):
unable to create `/usr/src/linux-headers-3.13.0-100-generic/include/config/sensors/g762.h.dpkg-new' (while processing `./usr/src/linux-headers-3.13.0-100-generic/include/config/sensors/g762.h'): No space left on device
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-100-generic_3.13.0-100.147_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

如果有关系的话:

duncan@BEDROOM:~$ uname -a
Linux BEDROOM 3.13.0-100-generic #147-Ubuntu SMP Tue Oct 18 16:49:53 UTC 2016 i686 athlon i686 GNU/Linux

答案1

结果是磁盘有点满了。我的 inode 快用完了。

root@BEDROOM:~# df -i

Filesystem     Inodes  IUsed  IFree IUse% Mounted on
udev           207347    498 206849    1% /dev
tmpfs          214299    525 213774    1% /run
/dev/sda1      909312 906196   3116  100% /
none           214299      2 214297    1% /sys/fs/cgroup
none           214299      3 214296    1% /run/lock
none           214299    133 214166    1% /run/shm
none           214299     10 214289    1% /run/user

现在必须弄清楚是什么耗费了这么多。

编辑:讽刺的是,旧的 Linux 头文件占用了大量的 inode。因此,我从 /usr/src 中手动删除了最旧的 2 个版本,从而释放了足够的空间来执行您的脚本,从而释放了更多的空间。

从 kyodake 脚本运行 apt-get purge $OLDCONF 后:

Filesystem     Inodes  IUsed  IFree IUse% Mounted on
/dev/sda1      909312 889004  20308   98% /

运行 apt-get purge $OLDKERNELS 后

Filesystem     Inodes  IUsed  IFree IUse% Mounted on
/dev/sda1      909312 644406 264906   71% /

现在我又有 4GB 可用

谢谢 Kyodake!

答案2

尝试这个:

打开终端,

Ctrl++AltT

运行:

exec sudo -i
OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"
METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
apt-get clean
apt-get purge $OLDCONF
apt-get purge $OLDKERNELS
rm -rf /home/*/.local/share/Trash/*/** &> /dev/null
rm -rf /root/.local/share/Trash/*/** &> /dev/null
apt-get update
apt-get -f install
apt-get dist-upgrade
dpkg --configure -a
apt-get clean

相关内容