What does auto mode in update-alternatives --config java? mean update-alternatives --config java?
That's what I found in man, but this situation is not particularly clarified.

automatic mode
When choosing a link to a group of users, it’s appropriate for the group.

manual mode
It’s not a problem.

    2 answers 2

    https://help.ubuntu.com/community/Java

    In short, this is the mechanism for selecting packages according to priorities (for updates, for example). Well, for example, for java there are at least 4 possible default installations for the implementation:

    • Openjdk
    • Oracle java
    • IBM Java
    • GNU Compiler

    automatic mode will choose the implementation that is considered the "most correct" system

    manual - leave the one you specified initially.

    I would advise you to use automatic, and select manual mode only if you know for sure that your software does not work, for example, with OpenJDK, but only with Oracle Java

    • What are the manual and automatic modes? - jisecayeyo
    • askubuntu.com/questions/613016/... in short, you simply choose, the system decides for you what you want to install, or you decide. What do you need it for? what problem do you solve? - strangeqargo pm
    • There is no problem, it was just curious what these modes are for. - jisecayeyo 9:01 pm
    • earlier for example phpstorm did not work in ubunt without oracle jdk, then they began to deliver their Java, it seems. therefore he asked. - strangeqargo
    • This is the mechanism for selecting packages for priors (for updates, for example) - in general, the “alternatives” are the mechanism for choosing files , not packages. and, accordingly, to “updates” (apparently, packages?) has no (direct) relationship. - aleksandr barakin

    What is a system of alternatives, briefly but not bad, is set out in a wikipedia article , which I recommend to read before reading further.


    What is the meaning of auto mode and manual mode , I will try to explain with the example of the vim program.

    • You put a fresh system, and in it there is no this program at all.
    • You installed the vim package. it includes (including) the file /usr/bin/vim.basic , and in the /usr/bin/vim.basic script (using the update-alternatives program) this file is registered as an alternative for the file /usr/bin/vim with priority 30 (why exactly 30 ? well, so the accompanying package decided). Also such chain of links turns out:

       /usr/bin/vim → /etc/alternatives/vim → /usr/bin/vim.basic 
    • After that you installed the vim-gtk package, which includes (including) the file /usr/bin/vim.gtk , and in the /usr/bin/vim.gtk script this file is registered as an alternative to the same file /usr/bin/vim , but with priority 50.
    • and since the set of alternatives for the /usr/bin/vim file was currently in "auto mode", the update-alternatives program (which was called in the post-installation script of the vim-gtk package) selects the current alternative which has higher priority, i.e. /usr/bin/vim.gtk . and it turns out a slightly different chain of links:

       /usr/bin/vim → /etc/alternatives/vim → /usr/bin/vim.gtk 
    • but if you ran sudo update-alternatives --config vim before installing the vim-gtk package and manually chose the /usr/bin/vim.basic option (and it doesn't matter that it was the only one at that time), then alternatives would switch to “manual mode” ( manual mode ), and after installing the vim-gtk package, switching alternatives wouldn’t happen, the old link chain remains relevant:

       /usr/bin/vim → /etc/alternatives/vim → /usr/bin/vim.basic 

    where are all these priorities fixed, possible alternatives, the current mode ( auto / manual ) for, for example, the vim program? in the /var/lib/dpkg/alternatives/vim file:

     manual /usr/bin/vim /usr/bin/vim.basic 30 /usr/bin/vim.gtk 50 

    The first line is the mode ( auto or manual ), the second line is the file itself, for which further alternatives are listed with their priorities.


    and how to get back the "auto-mode"?

     $ sudo update-alternatives --auto vim 

    It is worth noting that “auto-mode” is “turned on” by default when registering the very first alternative for a file. and “manual mode” is “turned on” after using the option of --config имя the update-alternatives program you manually specified to use one of the alternatives. (in general, of course, it is possible without update-alternatives , change the first line in the file /var/lib/dpkg/alternatives/имя ).