我有一个生产 vm U16.04 LTS,它破坏了 apt-get 和/boot
带有各种内核的完整目录。
apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
linux-headers-4.4.0-138 linux-headers-4.4.0-138-generic linux-headers-4.4.0-139 linux-headers-4.4.0-139-generic
linux-headers-4.4.0-141 linux-headers-4.4.0-141-generic linux-headers-4.4.0-142 linux-headers-4.4.0-142-generic
linux-headers-4.4.0-145 linux-headers-4.4.0-145-generic linux-headers-4.4.0-148 linux-headers-4.4.0-148-generic
linux-headers-4.4.0-150 linux-headers-4.4.0-150-generic linux-headers-4.4.0-157 linux-headers-4.4.0-157-generic
linux-image-4.4.0-138-generic linux-image-4.4.0-139-generic linux-image-4.4.0-141-generic linux-image-4.4.0-142-generic
linux-image-4.4.0-145-generic linux-image-4.4.0-148-generic linux-image-4.4.0-150-generic linux-image-4.4.0-157-generic
linux-image-extra-4.4.0-138-generic linux-image-extra-4.4.0-139-generic linux-image-extra-4.4.0-141-generic
linux-image-extra-4.4.0-142-generic linux-modules-4.4.0-145-generic linux-modules-4.4.0-148-generic
linux-modules-4.4.0-150-generic linux-modules-4.4.0-157-generic linux-modules-extra-4.4.0-145-generic
linux-modules-extra-4.4.0-148-generic linux-modules-extra-4.4.0-150-generic linux-modules-extra-4.4.0-157-generic
Use 'apt autoremove' to remove them.
The following additional packages will be installed:
linux-generic linux-headers-4.4.0-171 linux-headers-4.4.0-171-generic linux-headers-generic linux-image-4.4.0-157-generic
linux-image-4.4.0-171-generic linux-image-generic linux-modules-4.4.0-157-generic linux-modules-4.4.0-171-generic
linux-modules-extra-4.4.0-171-generic
Suggested packages:
fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
Recommended packages:
thermald
The following NEW packages will be installed:
linux-headers-4.4.0-171 linux-headers-4.4.0-171-generic linux-image-4.4.0-157-generic linux-image-4.4.0-171-generic
linux-modules-4.4.0-157-generic linux-modules-4.4.0-171-generic linux-modules-extra-4.4.0-171-generic
The following packages will be upgraded:
linux-generic linux-headers-generic linux-image-generic
3 upgraded, 7 newly installed, 0 to remove and 199 not upgraded.
7 not fully installed or removed.
Need to get 66.3 MB/85.2 MB of archives.
After this operation, 369 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-modules-4.4.0-171-generic amd64 4.4.0-171.200 [12.0 MB]
Get:2 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-image-4.4.0-171-generic amd64 4.4.0-171.200 [6,938 kB]
Get:3 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-modules-extra-4.4.0-171-generic amd64 4.4.0-171.200 [36.6 MB]
Get:4 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-generic amd64 4.4.0.171.179 [1,790 B]
Get:5 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-image-generic amd64 4.4.0.171.179 [2,442 B]
Get:6 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-headers-4.4.0-171 all 4.4.0-171.200 [10.0 MB]
Get:7 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-headers-4.4.0-171-generic amd64 4.4.0-171.200 [798 kB]
Get:8 http://mirror.hetzner.de/ubuntu/packages xenial-updates/main amd64 linux-headers-generic amd64 4.4.0.171.179 [2,282 B]
Fetched 66.3 MB in 1s (36.3 MB/s)
Selecting previously unselected package linux-modules-4.4.0-171-generic.
(Reading database ... 415318 files and directories currently installed.)
Preparing to unpack .../linux-modules-4.4.0-171-generic_4.4.0-171.200_amd64.deb ...
Unpacking linux-modules-4.4.0-171-generic (4.4.0-171.200) ...
dpkg: error processing archive /var/cache/apt/archives/linux-modules-4.4.0-171-generic_4.4.0-171.200_amd64.deb (--unpack):
cannot copy extracted data for './boot/System.map-4.4.0-171-generic' to '/boot/System.map-4.4.0-171-generic.dpkg-new': failed to write (No space left on device)
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package linux-image-4.4.0-171-generic.
Preparing to unpack .../linux-image-4.4.0-171-generic_4.4.0-171.200_amd64.deb ...
Unpacking linux-image-4.4.0-171-generic (4.4.0-171.200) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-171-generic_4.4.0-171.200_amd64.deb (--unpack):
cannot copy extracted data for './boot/vmlinuz-4.4.0-171-generic' to '/boot/vmlinuz-4.4.0-171-generic.dpkg-new': failed to write (No space left on device)
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
cd /boot && ls
abi-4.4.0-138-generic config-4.4.0-154-generic retpoline-4.4.0-138-generic System.map-4.4.0-154-generic
abi-4.4.0-139-generic grub retpoline-4.4.0-139-generic vmlinuz-4.4.0-138-generic
abi-4.4.0-141-generic initrd.img-4.4.0-138-generic retpoline-4.4.0-141-generic vmlinuz-4.4.0-139-generic
abi-4.4.0-142-generic initrd.img-4.4.0-139-generic retpoline-4.4.0-142-generic vmlinuz-4.4.0-141-generic
config-4.4.0-138-generic initrd.img-4.4.0-141-generic System.map-4.4.0-138-generic vmlinuz-4.4.0-142-generic
config-4.4.0-139-generic initrd.img-4.4.0-142-generic System.map-4.4.0-139-generic vmlinuz-4.4.0-143-generic
config-4.4.0-141-generic initrd.img-4.4.0-143-generic System.map-4.4.0-141-generic vmlinuz-4.4.0-145-generic
config-4.4.0-142-generic initrd.img-4.4.0-145-generic System.map-4.4.0-142-generic vmlinuz-4.4.0-148-generic
config-4.4.0-143-generic initrd.img-4.4.0-148-generic System.map-4.4.0-143-generic vmlinuz-4.4.0-150-generic
config-4.4.0-145-generic initrd.img-4.4.0-150-generic System.map-4.4.0-145-generic vmlinuz-4.4.0-151-generic
config-4.4.0-148-generic initrd.img-4.4.0-151-generic System.map-4.4.0-148-generic vmlinuz-4.4.0-154-generic
config-4.4.0-150-generic initrd.img-4.4.0-154-generic System.map-4.4.0-150-generic
config-4.4.0-151-generic lost+found System.map-4.4.0-151-generic
uname -r
4.4.0-143-generic
df -h
Filesystem Size Used Avail Use% Mounted on
udev 63G 0 63G 0% /dev
tmpfs 13G 1.3G 12G 11% /run
/dev/md2 1.8T 714G 953G 43% /
tmpfs 63G 0 63G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 63G 0 63G 0% /sys/fs/cgroup
/dev/md1 488M 486M 0 100% /boot
/dev/sdc1 1.8T 68M 1.7T 1% /var/lib/mysql-extra-disk
tmpfs 13G 0 13G 0% /run/user/0
tmpfs 13G 0 13G 0% /run/user/111
rm
如果不安全,我不想使用任何命令。任何帮助表示赞赏。
编辑:
删除:
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm abi-4.4.0-138-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm abi-4.4.0-139-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm initrd.img-4.4.0-138-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm initrd.img-4.4.0-139-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm retpoline-4.4.0-138-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm retpoline-4.4.0-139-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm System.map-4.4.0-138-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm System.map-4.4.0-139-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm vmlinuz-4.4.0-138-generic
root@Ubuntu-1604-xenial-64-minimal-no-hwe /boot # rm vmlinuz-4.4.0-139-generic
并apt-get install -f
工作。谢谢!
检查您使用的是哪个内核版本
uname -a
,然后从您不使用的内核中删除所有 config- 、 initrd-、 System.map-* 和 config-* 文件,以确保留下一个版本(即. 如果uname -a
返回类似:4.4.0-169-generic
,则保留文件4.4.0-166
和较新版本)。然后,只需运行你可以走了。如果您不想删除任何文件,也可以将
/boot
文件移动到其他位置。我在我所有的 350 台服务器上都使用了这个程序,它非常安全。