As far as I understand, /etc/alternatives stores only currently selected alternatives. Where are all the variants and all the metadata stored? I have accidentally removed an alternative with galternatives and want to add it back as it was manually (as galternatives functionality is very limited).


This data seems to be in /var/lib/dpkg/alternatives, also check man update-alternatives for more information.


The command-line update-alternatives tool should help you here.

This command should take you through all alternatives one at a time:

update-alternatives --all

There are some more examples at this wiki page which can show you all manually-set alternatives and even (use with caution!) reset all those to their defaults.

A more detailed description of how the alternatives system works, including where it stores all its configuration, is available in the update-alternatives manpage (note that this version for Debian and Ubuntu contains more functionality than the update-alternatives from redhat).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.