The update-alternatives command is a common way to specify which of various alternative programs should be the default in each of several categories of programs (web browsers, editors, etc). I think that the normal way for a user to change defaults is to run something like sudo update-alternatives --config gnome-www-browser
though various apps rely on other ways of specifying default browser (see e.g. 'xdg-open').
But my question here focuses on meaning and policy around the priority
configuration setting. The man page explains:
Each alternative has a priority associated with it. When a link group is in automatic mode, the alternatives pointed to by members of the group will be those which have the highest priority.
It also notes that Different packages providing the same file need to do so cooperatively.
I'd like to understand how these priorities are designed to work:
- Who determines the priorities?
- Are users ever expected to modify them?
- When packaging a program, how should these priorities be set?
- Is there an easy way to see the priorities that all the Ubuntu packages use for each alternative, as a guideline for current practice? I imagine that's easier for official packages than for those in add-on repos, but given a repo, I imagine that it could also be queried.
- What expectations should we have for organizations who package applications outside of the official repositories?
- Should packages ask whether the user wants to change the default upon install?
The question comes up for me after reading Microsoft Edge is Now Taking Over as Your Default Browser… on Linux, which documents how Edge, as packaged by Microsoft for Debian-based systems, is given a priority of 200 as a browser (with the comment # Good enough to be the default.
). On my Ubuntu 20.04 system, the other priorities for both x-www-browser
and gnome-www-browser
are:
$ update-alternatives --display x-www-browser
x-www-browser - auto mode
link best version is /usr/bin/microsoft-edge-stable
link currently points to /usr/bin/microsoft-edge-stable
link x-www-browser is /usr/bin/x-www-browser
/usr/bin/firefox - priority 40
/usr/bin/google-chrome-beta - priority 150
/usr/bin/microsoft-edge-stable - priority 200
I installed the official Ubuntu chromium-based browser chromium
, which is now using snap
. But it doesn't show up in the alternatives.
I haven't installed google-chrome-stable. Do they also use a priority of 200?
What happens when there is a tie in priority values among alternatives?
Many thanks.