Is it possible to prevent usrmerge package installation on systems upgraded from 18.04 LTS?

I have Ubuntu 18.04.5 LTS system. I plan to upgrade it to 20.04.2 LTS and then to 21.04 for testing purposes.

I see that using system with usrmerge package installed will not be comfortable for me. Because of issues like failed dpkg -S $(which grep) and failed ldd.

How can I prevent installation of usrmerge package during upgrade?


Solution 1:

On modern Ubuntu 21.04 system ubuntu-minimal recommends the installation of usrmerge. We need to prevent this behavior.

So the order of actions will be the following:

  1. Boot existing Ubuntu 18.04.5 LTS system and install upgrades to it.

  2. Create special pin/lock file dedicated to usrmerge package by

    cat <<EOF | sudo tee /etc/apt/preferences.d/pin-usrmerge
    Package: usrmerge
    Pin: version *
    Pin-Priority: -1337
    EOF
    
  3. Upgrade Ubuntu to 20.04.2 LTS.

  4. Upgrade Ubuntu to 21.04 (and then to 21.10 if needed).

  5. Enjoy the normal system without unnecessary symlinks.

Note: pin/lock file should be created before step 4.