我有一台机器被忽视了一段时间,最终得到了一个完整的磁盘和完整的启动分区。那时任何apt
命令都不起作用,因为没有空间。
在我们开始之前,该服务器运行一个最小的 MySQL 数据库——并且/var/log/
当时的位置为14MB
,并且/var/mail/
曾经的位置为18kb
。我也尝试运行apt clean
-apt autoclean
磁盘仍然满了.. 在谷歌搜索和谷歌搜索之后.. 每一篇文章都说只需运行apt clean
(当然)我决定尝试将事情掌握在自己手中,我FAFO。
所以我跑了uname -r
,结果出来了
4.4.0-119-generic
所以我进入启动驱动器并删除了所有不存在的东西4.4.0-119-generic
。这一直是我过去会尝试的方法,它通常足够清晰,让我可以运行 a apt install -f
,apt autoremove
然后update-grub
- 通常之后都是 gtg。
我的问题是硬盘上没有足够的空间来运行任何apt install
或- 所以我在和 中apt autoremove
做了同样的事情/usr/src/
lib/modules/
回顾一下我清除了“未使用”内核的usr/src
和。lib/modules
我相信这就是我搞砸的地方。现在当我尝试跑步时apt install -f
我得到
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 158 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.4.0-208-generic (4.4.0-208.240) ...
depmod: ERROR: could not open directory /lib/modules/4.4.0-208-generic: No such file or directory
depmod: FATAL: could not search modules: No such file or directory
dpkg: error processing package linux-image-4.4.0-208-generic (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
linux-image-4.4.0-208-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
我看到了错误的根源(这提醒我注意我的错误)
depmod: ERROR: could not open directory /lib/modules/4.4.0-208-generic: No such file or directory
我也尝试运行sudo apt --fix-broken install
- 同样的错误 - 无济于事。
我能做些什么来解决这个我陷入困境的看似可怕的难题呢?