So I looked into the script a little bit and some minor changes was enough to get what you want.
First create a backup of: /etc/kernel/postinst.d/apt-auto-removal
:
sudo cp /etc/kernel/postinst.d/apt-auto-removal{,.bk}
Then find this line:
previous_version="$(echo "$debverlist" | sed -n 2p)"
and change it to:
previous_version="$(echo "$debverlist" | sed -n 2,4p)"
- Now it should keep 3 old kernel + Running + Newly installed one
- Of course you have to run it once manually or install a new kernel to make it take effect.