Symptoms

During upgrade of unifi controller on Ubuntu 18.04, we encountered this error

The following information may help to resolve the situation:

The following packages have unmet dependencies:
 mongodb-org : Conflicts: mongodb-clients but 1:3.6.3-0ubuntu1.4 is to be installed
               Conflicts: mongodb-server but 1:3.6.3-0ubuntu1.4 is to be installed
 mongodb-org-mongos : Conflicts: mongodb-clients but 1:3.6.3-0ubuntu1.4 is to be installed
                      Conflicts: mongodb-server but 1:3.6.3-0ubuntu1.4 is to be installed
 mongodb-org-server : Conflicts: mongodb-clients but 1:3.6.3-0ubuntu1.4 is to be installed
                      Conflicts: mongodb-server but 1:3.6.3-0ubuntu1.4 is to be installed
 mongodb-org-shell : Conflicts: mongodb-clients but 1:3.6.3-0ubuntu1.4 is to be installed
                     Conflicts: mongodb-server but 1:3.6.3-0ubuntu1.4 is to be installed
 mongodb-org-tools : Conflicts: mongodb-clients but 1:3.6.3-0ubuntu1.4 is to be installed
                     Conflicts: mongodb-server but 1:3.6.3-0ubuntu1.4 is to be installed
E: Broken packages

Solution

Resource: Install MongoDB Community Edition on Ubuntu — MongoDB Manual

# Install curl
sudo apt-get install gnupg curl

# Update GPG key
curl -fsSL https://pgp.mongodb.com/server-7.0.asc | \
   sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg \
   --dearmor

# Create list file
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list

# Reload apt
sudo apt update

# Upgrade
sudo apt upgrade -y

Last modified: 24 March 2024