How do I remove last, the originally installed kernel?
Goal: I am trying to configure smallest possible linux server install (Debian 9) machine which will be running application server (PHP7) in a Nginx-PHP7-Database chain. My PHP7 app server(s) will run on blade server(s) living inside enclosure. Machines are 32cores+8GB ram, but diskless, with os booted from 2GB (ONLY 2GB!) pendrive.
What I have done so far:
- Minimal install of
Debian 9
(took 700MB), cmdline + sshd. - Compiled and tested custom kernel 4.9.65 for this machine, profiled to existing hardware and requirements.
- Deployed custom kernel to the machine (as
linux-image.*.deb
package) - Successfully booted from pen-drive using custom kernel
Now I would like to remove original bloated kernel 4.9.0.4 which came with initial Debian 9 installation, which is now polluting my tiny pen-drive. I od not need to keep last-good kernel.
When I try to remove original, now unused kernel, it wants to upgrade it (to keep dependencies happy, I presume)
sudo apt-get purge linux-image-4.9.0-4-amd64
I get
The following packages will be REMOVED:
linux-image-4.9.0-4-amd64*
The following NEW packages will be installed:
linux-image-4.9.0-6-amd64
But I want to delete it, not upgrade.
Question: How do I remove original, LAST standard kernel? Is there any way to re-link package dependencies to my new custom kernel and free the original for deletion?
FYI: I cannot simply buy big pen-drives, as these are awfully slow under ext2 file system. The small ones I have are special 'enterprise' grade.
I could try some magic with generic image on iSCSI drive and overlayfs the pendrive to get personality. Not there yet, maybe in few months.
ANSWER:
I let apt-get purge [...]
install next version of kernel, which I was able to remove without further problems.
Clean, useful minimal server on Debian9 is 465MB, all packages kept.