If you want to prevent certain packages being accidentaly or purposely being removed, do this.
Example packages: nano and vim
Create a file: /etc/apt/apt.conf.d/protectedPackages
Place this into the file:
pkgCacheGen::ForceEssential {
"nano";
"vim";
};
Now apt will stop you from removing it, for example:
apt remove nano
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages will be REMOVED:
nano
WARNING: The following essential packages will be removed.
This should NOT be done unless you know exactly what you are doing!
nano
0 upgraded, 0 newly installed, 1 to remove and 11 not upgraded.
After this operation, 881 kB disk space will be freed.
E: Removing essential system-critical packages is not permitted. This might break the system.