问候和致意
问题:我是 Linux 新手,想清理我的第一个 ubuntu 服务器,该服务器目前托管一个 wordpress 网站,但是遇到了错误,因为我没有及时清理,因为我不知道,所以有没有什么办法可以清理这个服务器以释放启动磁盘空间,然后再次升级等。提前谢谢你
服务器访问: Putty、Webmin、直接虚拟服务器连接、通过 Powershell 的 Bash
尝试过的解决方案: 我尝试了 autoremove - f 命令,下面的输出是我想要得到的
命令输出:
kg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-130- sudo apt autoremove -f
[sudo] password for (sudo admin account name, which I entered pw)
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-130-generic
Suggested packages:
dutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
linux-image-4.4.0-130-generic
0 upgraded, 1 newly installed, 0 to remove and 71 not upgraded.
10 not fully installed or removed.
Need to get 0 B/22.1 MB of archives.
After this operation, 68.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 202908 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-130-generic_4.4.0-130.156_amd64.deb ...
Examining /etc/kernel/preinst.d/
run-parts: executing /etc/kernel/preinst.d/intel-microcode 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic
Done.
Unpacking linux-image-4.4.0-130-generic (4.4.0-130.156) ...
dpgeneric_4.4.0-130.156_amd64.deb (--unpack):
cannot copy extracted data for './boot/vmlinuz-4.4.0-130-generic' to '/boot/vmlinuz-4.4.0-130-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-130-generic /boot/vmlinuz-4.4.0-130-generic
run-parts: executing /etc/kernel/postrm.d/x-grub-legacy-ec2 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-4.4.0-130-generic_4.4.0-130.156_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
这次尝试了 apt-get(第一个是 apt 专用)
(admin account name @server name):~$ sudo apt-get autoremove -f
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-130-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-130-generic
0 upgraded, 1 newly installed, 0 to remove and 71 not upgraded.
10 not fully installed or removed.
Need to get 0 B/22.1 MB of archives.
After this operation, 68.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 202908 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-130-generic_4.4.0-130.156_amd64.deb ...
Examining /etc/kernel/preinst.d/
run-parts: executing /etc/kernel/preinst.d/intel-microcode 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic
Done.
Unpacking linux-image-4.4.0-130-generic (4.4.0-130.156) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-130-generic_4.4.0-130.156_amd64.deb (--unpack):
cannot copy extracted data for './boot/vmlinuz-4.4.0-130-generic' to '/boot/vmlinuz-4.4.0-130-generic.dpkg-new': failed to write (No space left on device)
**No apport report written because the error message indicates a disk full error**
d**pkg-deb: error: subprocess paste was killed by signal (Brokn pipe)**
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic
run-parts: executing /etc/kernel/postrm.d/x-grub-legacy-ec2 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-130-generic /boot/vmlinuz-4.4.0-130-generic
Errors were encountered while processing:
/var/cache/apt/archives/linux-image-4.4.0-130-generic_4.4.0-130.156_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
以上是运行 autoremove 命令的输出,对于进一步尝试有什么建议吗
ls -l /boot 的输出
非常感谢
从评论中移出,以便可以格式化:
uname -r
4.4.0-127-generic
total 465226
-rw-r--r-- 1 root root 1249685 Jan 19 2018 abi-4.4.0-112-generic
-rw-r--r-- 1 root root 1250569 Feb 13 2018 abi-4.4.0-116-generic
-rw-r--r-- 1 root root 1251075 Apr 2 19:05 abi-4.4.0-119-generic
-rw-r--r-- 1 root root 1251054 Apr 13 17:21 abi-4.4.0-121-generic
# small sample – CorpCaleCeo 8 hours ago
更新:尝试使用多个命令删除后,他的输出最能解释这一点,正如你所见,我无法删除其中任何一个
答案1
您必须释放一些磁盘空间。我的方法会导致旧内核无法启动,但它是旧内核。
执行uname -r
此操作以获取当前内核的发布版本。请勿删除名称中包含此字符串的任何内容。
然后用/boot
来看ls -l /boot
。
选择一个较大的文件,并且其名称中不包含内核版本。
删除它(您必须使用sudo rm
)。
再试sudo apt autoremove
一次。
答案2
好的,终于解决了这个问题,现在我使用 webmin 和文件管理器进入启动位置,例如 /boot,然后我使用 ls -l /boot 来定位我可以毫无问题地删除的文件,或者如果我有问题那么我确实关心我备份了 VM 的检查点和备份,所以一切都很好。选择除文件名中带有 4.4.0-127 的任何文件之外的所有文件后,删除它们,之后我重新启动系统并使用“sudo apt-get remove -f”来强制,尽管有人说其他人说这意味着强制,果然它强制清理。
我现在正在更新 81 个缺失更新,包括 31 个安全更新,到目前为止一切顺利。答案来自收集协作,但是我无法使用任何建议的 Linux 命令删除任何文件,因此不得不使用老式的 Windows 知识,并且它工作得很好。
所以我建议每个人都安装并使用 webmin,这是一款非常棒的软件,可以完全访问所有 Linux 系统,它很漂亮,我喜欢它