@Bartosz Suchorowski
Ubuntu does not make it easy to select the number of kernels to have installed. Here is a thread where users were able to remove the older kernels. This thread has users changing the number of kernels to keep automatically and is something you can try.
Unfortunately resizing of an ADE OS/boot partition is not something that is currently supported. My suggestion would be to migrate to new disks with a larger partition or without this separate partition.
Since you mention that the partition is not encrypted you can try these instructions. These instructions are given on a best effort basis, please take backups and do not complete this on production machines. If these instructions fail, I recommend migrating to new disks.
Deallocate the VM -> Snapshot the OS disk -> Increase the size of the disk as desired -> Start the VM
NOTE: This step is optional in case you need to expand the size of the OS disk size.
2- Backup /boot (tar -cvzf /boot.tar.gz /boot/)
3- Collect the disk names, UUIDs (only in case needed later), and partition information and save them to a text file.
- lsblk
- blkid
- fdisk -l /dev/<DISK NAME>
4- Recreate the boot partition:
- gdisk /dev/<DISK NAME>
- x -> e -> m
- d (choose partition 2)
- n (choose partition 2) -> start: should be the same of partition 2 per collected output (fdisk -l /dev/<DISK NAME>)
-> end: should be the last sector of the disk
-> GUID Partition ID: 8300
-> w (to write changes) -> Y to confirm
5- Verify the partition size with "gdisk -l /dev/<DISK NAME>"
6- umount /boot/efi
7- partprobe
8- resize2fs /boot (If you see issues while executing this step, please skip to step to Step 10)
9- mount /boot/efi
10- Verify the contents of /boot, and verify the new size with "df -h" and "lsblk"
NOTE: Only do the below if you have issues resizing in step 8.
11- run "mount /boot" and "mount /boot/efi"
12 - resize2fs /dev/<PARTITION NAME>
13- If step 11 asks you to run "e2fsck -f /dev/<PARTITION NAME>", then please run it, then execute step 11 again.
14- Verify the contents of /boot, and verify the new size with "df -h" and "lsblk"
-------------------------------
Please don’t forget to "Accept the answer" and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.