Usually you get this error when /boot partition is full or near to full.
You can usually remove old, unused kernels on /boot by running following command –
sudo apt autoremove
There is also an utility purge-old-kernels which also recommends to use sudo apt autoremove command.
After running this command, you can run following command to check the space on /boot.
df -h /boot/