1

When I did sudo apt-get update on the command line I found errors with "W: Target Packages"

sudo apt-get update
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal InRelease                                       
Get:3 http://security.ubuntu.com/ubuntu focal-security InRelease [109 kB]                       
Get:4 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]                      
Get:5 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease [101 kB]                    
Hit:6 https://deb.nodesource.com/node_15.x focal InRelease                                      
Ign:7 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 InRelease                       
Hit:8 https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 Release                         
Hit:9 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal InRelease
Hit:10 http://lenovo.archive.canonical.com focal InRelease
Fetched 324 kB in 2s (142 kB/s)
Reading package lists... Done
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons-small (multiverse/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons-hidpi (multiverse/dep11/icons-64x64@2.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Packages (multiverse/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Packages (multiverse/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target Translations (multiverse/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-amd64.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11 (multiverse/dep11/Components-all.yml) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons-small (multiverse/dep11/icons-48x48.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons (multiverse/dep11/icons-64x64.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target DEP-11-icons-hidpi (multiverse/dep11/icons-64x64@2.tar) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-amd64) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1
W: Target CNF (multiverse/cnf/Commands-all) is configured multiple times in /etc/apt/sources.list:58 and /etc/apt/sources.list.d/mongodb-org-4.4.list:1

I have tried

 apt-get remove --purge mongodb
apt-get autoremove --purge mongodb

The result

~$ sudo apt-get purge mongodb-org*
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'mongodb-org-unstable-tools' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-mongos' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-tools' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable-server' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable-shell' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-shell' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable-mongos' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-unstable' for glob 'mongodb-org*'
Note, selecting 'mongodb-org' for glob 'mongodb-org*'
Note, selecting 'mongodb-org-server' for glob 'mongodb-org*'
Package 'mongodb-org-mongos' is not installed, so not removed
Package 'mongodb-org-shell' is not installed, so not removed
Package 'mongodb-org-tools' is not installed, so not removed
Package 'mongodb-org-unstable' is not installed, so not removed
Package 'mongodb-org-unstable-mongos' is not installed, so not removed
Package 'mongodb-org-unstable-server' is not installed, so not removed
Package 'mongodb-org-unstable-shell' is not installed, so not removed
Package 'mongodb-org-unstable-tools' is not installed, so not removed
The following package was automatically installed and is no longer required:
  libcurl3
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  mongodb-org* mongodb-org-server*
0 upgraded, 0 newly installed, 2 to remove and 21 not upgraded.
After this operation, 62.2 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 187143 files and directories currently installed.)
Removing mongodb-org-server (4.0.4) ...
Failed to stop mongod.service: Unit mongod.service not loaded.
invoke-rc.d: initscript mongod, action "stop" failed.
dpkg: error processing package mongodb-org-server (--remove):
 installed mongodb-org-server package pre-removal script subprocess returned error exit status 5
Errors were encountered while processing:
 mongodb-org-server
E: Sub-process /usr/bin/dpkg returned an error code (1)
  • We can help you better if you edit your question to show us the complete output of your remove and autoremove commands. We are not good at guessing. Meanwhile, you really should fix that seemingly unrelated problem with your sources. – user535733 Feb 13 '21 at 22:55
  • I'm not seeing a sudo in there, nor a specific error message from the removal process. What does sudo apt remove --purge mongodb result in when you run it? –  Feb 13 '21 at 23:11

1 Answers1

0
sudo rm /etc/apt/sources.list
sudo software-properties-gtk
  • Go to Other Software
  • Pick your options
  • Save

Answer from How to fix error W: Target Packages (main/binary-amd64/Packages) is configured multiple times in my sources.list file?

  • Don't delete the source.list, open it with an editor, e.g., nano +58 /etc/apt/sources.list. Should put you at least close to the crime scene, it should look the same as the one you have in /etc/apt/sources.list.d/mongodb-org-4.4.list. –  Feb 14 '21 at 07:40
  • ....if you remove a source entry, all packages originate from that source will be unmaintained by the package-system, i.e., until you restore the origin. –  Feb 14 '21 at 07:59