I searched around and found this post that had a similar problem and solved it. Basically, these are the steps:
- Boot into the recovery ISO
- Mount and chroot into the existing filesystem
- Reinstall the kernel
apt-get install --reinstall linux-image-generic linux-image
However, when I entered the command during Step 3, I got an error from /usr/sbin/grub-probe that it "failed to get canonical path of overlay".
I used the 'df' command to list mounted filesystems and realised that, the live CD ISO mounts overlay at the root i.e. '/', but it was not mounted when I chroot into the broken system.
After a few more searches, I found some usefule info in here and here that says I need to bind mount '/dev', '/proc' and '/sys' before chroot, so that they can be found by applications. I did that and it all worked out! This time, the reinstall was completed successfully without any error (though there were a few warnings and fallbacks).
In summary, the following steps were performed:
- Power off the droplet and boot from the recovery ISO
- Choose 6 for interactive shell (don't mount or chroot)
- In the interactive shell,
- Mount the filesystem: "mount /dev/vda1 /mnt"
- Bind mount /dev: "mount --bind /dev /mnt/dev
- Bind mount /proc: "mount --bind /proc /mnt/proc"
- Bind mount /sys: "mount --bind /sys /mnt/sys"
- Chroot: "chroot /mnt"
- Update and upgrade: "apt update" and "apt upgrade"
- Exit the interactive shell and restart the droplet to boot from main harddisk