Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Justinzobel/e359af5a14287f0d776c86c9be76a131 to your computer and use it in GitHub Desktop.
Save Justinzobel/e359af5a14287f0d776c86c9be76a131 to your computer and use it in GitHub Desktop.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment