Remember the experience of deleting / boot directory once and repairing it manually

Keywords: Linux Ubuntu

2018 / 09 / 19 server room

The story is as follows: one of the disgusting things that my colleagues found was that the original person in charge gave 500M space to the / boot partition of the server. I would think it's not small. However, after many kernel upgrades since 16 years, GG has not been uninstalled.
As a result, a lot of compilation and installation cannot be carried out, so delete it - delete the kernel version that is currently in use - GG

Trouble Shooting

First of all, 90% of the problems are caused by the deletion of the boot file. However, the reason why I haven't contacted this question for a long time is that the space is too full.
Restart the U disk and enter ubuntu live, fdisk -l to view the partition information

root@ubuntu-wsn:~# fdisk -l
Disk /dev/sda: 5.5 TiB, 5995505909760 bytes, 11709972480 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 9FE55D29-48D0-4168-9ED6-A8DE5FAB4B9C

Device       Start         End     Sectors  Size Type
/dev/sda1     2048        4095        2048    1M BIOS boot
/dev/sda2     4096     1003519      999424  488M Linux filesystem
/dev/sda3  1003520 11709970431 11708966912  5.5T Linux LVM

Mount Linux filesystem to / mnt and check (this is the result after deletion, so there are not many files)

127 The version of the file is missing. There is no doubt that it is in short supply
root@ubuntu-wsn:~# cd /boot/
root@ubuntu-wsn:/boot# ls 
abi-4.4.0-116-generic  config-4.4.0-116-generic  grub                          retpoline-4.4.0-116-generic  System.map-4.4.0-116-generic  vmlinuz-4.4.0-119-generic
abi-4.4.0-119-generic  config-4.4.0-119-generic  initrd.img-4.4.0-116-generic  retpoline-4.4.0-119-generic  System.map-4.4.0-119-generic  vmlinuz-4.4.0-121-generic
abi-4.4.0-121-generic  config-4.4.0-121-generic  initrd.img-4.4.0-119-generic  retpoline-4.4.0-121-generic  System.map-4.4.0-121-generic  vmlinuz-4.4.0-124-generic
abi-4.4.0-124-generic  config-4.4.0-124-generic  initrd.img-4.4.0-121-generic  retpoline-4.4.0-124-generic  System.map-4.4.0-124-generic  vmlinuz-4.4.0-127-generic
abi-4.4.0-127-generic  config-4.4.0-127-generic  lost+found                    retpoline-4.4.0-127-generic  System.map-4.4.0-127-generic
bin                    dev                       proc                          sys                          vmlinuz-4.4.0-116-generic
root@ubuntu-wsn:/boot# 

Solve

In this case, it's easy to delete the files without any more. Restart and press Shift to enter Ubuntu advanced option. Select an existing kernel version, such as 116

Other circumstances

What if all the hand owers are deleted?
No trouble,

  • First determine the machine system version, such as Ubuntu 16.04
  • Find a virtual machine of Ubuntu 16 and copy / boot
  • ubuntu live in, fix

Posted by zoreli on Fri, 06 Dec 2019 13:53:22 -0800