vagrant@ubuntu18-bionic:~$ uname -a Linux ubuntu18-bionic 4.15.0-76-generic #86-Ubuntu SMP Fri Jan 17 17:24:28 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux vagrant@ubuntu18-bionic:~$ sudo apt list --installed | grep mongod WARNING: apt does not have a stable CLI interface. Use with caution in scripts. mongodb-org/bionic,now 4.2.3 amd64 [installed] mongodb-org-mongos/bionic,now 4.2.3 amd64 [installed,automatic] mongodb-org-server/bionic,now 4.2.3 amd64 [installed,automatic] mongodb-org-shell/bionic,now 4.2.3 amd64 [installed,automatic] mongodb-org-tools/bionic,now 4.2.3 amd64 [installed,automatic] vagrant@ubuntu18-bionic:~$ sudo apt remove 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-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 packages will be REMOVED: mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools 0 upgraded, 0 newly installed, 5 to remove and 46 not upgraded. After this operation, 294 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 125478 files and directories currently installed.) Removing mongodb-org (4.2.3) ... Removing mongodb-org-mongos (4.2.3) ... Removing mongodb-org-server (4.2.3) ... Removing mongodb-org-shell (4.2.3) ... Removing mongodb-org-tools (4.2.3) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... vagrant@ubuntu18-bionic:~$ cd /etc/apt/ vagrant@ubuntu18-bionic:/etc/apt$ cd sources.list.d/ vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ ls -la total 12 drwxr-xr-x 2 root root 4096 Feb 12 21:09 . drwxr-xr-x 7 root root 4096 Feb 5 17:07 .. -rw-r--r-- 1 root root 107 Feb 12 21:09 mongodb-org-4.2.list vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo rm -rf mongodb-org-4.2.list vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo apt-get update Hit:1 http://archive.ubuntu.com/ubuntu bionic InRelease Get:2 http://security.ubuntu.com/ubuntu bionic-security InRelease [88.7 kB] Get:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease [88.7 kB] Get:4 http://archive.ubuntu.com/ubuntu bionic-backports InRelease [74.6 kB] Get:5 http://security.ubuntu.com/ubuntu bionic-security/main amd64 Packages [636 kB] Get:6 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages [853 kB] Get:7 http://security.ubuntu.com/ubuntu bionic-security/main Translation-en [208 kB] Get:8 http://security.ubuntu.com/ubuntu bionic-security/universe amd64 Packages [645 kB] Get:9 http://archive.ubuntu.com/ubuntu bionic-updates/main Translation-en [298 kB] Get:10 http://security.ubuntu.com/ubuntu bionic-security/universe Translation-en [217 kB] Get:11 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 Packages [1049 kB] Get:12 http://archive.ubuntu.com/ubuntu bionic-updates/universe Translation-en [324 kB] Fetched 4481 kB in 2s (2816 kB/s) Reading package lists... Done # Following the MDB install docs: https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | sudo apt-key add - OK vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.2.list deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo apt-get update Ign:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 InRelease Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 Release [3953 B] Hit:3 http://archive.ubuntu.com/ubuntu bionic InRelease Hit:4 http://security.ubuntu.com/ubuntu bionic-security InRelease Get:5 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 Release.gpg [801 B] Hit:6 http://archive.ubuntu.com/ubuntu bionic-updates InRelease Hit:7 http://archive.ubuntu.com/ubuntu bionic-backports InRelease Get:8 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 Packages [4077 B] Fetched 8831 B in 1s (15.0 kB/s) Reading package lists... Done vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo apt-get install -y mongodb-org Reading package lists... Done Building dependency tree Reading state information... Done The following additional packages will be installed: mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools The following NEW packages will be installed: mongodb-org mongodb-org-mongos mongodb-org-server mongodb-org-shell mongodb-org-tools 0 upgraded, 5 newly installed, 0 to remove and 46 not upgraded. Need to get 97.4 MB of archives. After this operation, 294 MB of additional disk space will be used. Get:1 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-shell amd64 4.2.3 [12.0 MB] Get:2 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-server amd64 4.2.3 [18.4 MB] Get:3 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-mongos amd64 4.2.3 [10.1 MB] Get:4 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org-tools amd64 4.2.3 [57.0 MB] Get:5 https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2/multiverse amd64 mongodb-org amd64 4.2.3 [3532 B] Fetched 97.4 MB in 8s (13.0 MB/s) Selecting previously unselected package mongodb-org-shell. (Reading database ... 125077 files and directories currently installed.) Preparing to unpack .../mongodb-org-shell_4.2.3_amd64.deb ... Unpacking mongodb-org-shell (4.2.3) ... Selecting previously unselected package mongodb-org-server. Preparing to unpack .../mongodb-org-server_4.2.3_amd64.deb ... Unpacking mongodb-org-server (4.2.3) ... Selecting previously unselected package mongodb-org-mongos. Preparing to unpack .../mongodb-org-mongos_4.2.3_amd64.deb ... Unpacking mongodb-org-mongos (4.2.3) ... Selecting previously unselected package mongodb-org-tools. Preparing to unpack .../mongodb-org-tools_4.2.3_amd64.deb ... Unpacking mongodb-org-tools (4.2.3) ... Selecting previously unselected package mongodb-org. Preparing to unpack .../mongodb-org_4.2.3_amd64.deb ... Unpacking mongodb-org (4.2.3) ... Setting up mongodb-org-shell (4.2.3) ... Setting up mongodb-org-mongos (4.2.3) ... Setting up mongodb-org-tools (4.2.3) ... Setting up mongodb-org-server (4.2.3) ... Setting up mongodb-org (4.2.3) ... Processing triggers for man-db (2.8.3-2ubuntu0.1) ... # Fails! vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo systemctl start mongod Failed to start mongod.service: Unit mongod.service not found. # Fixes: vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo systemctl daemon-reload # Works: vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo systemctl start mongod vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo systemctl status mongod ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-02-14 16:22:22 UTC; 3min 59s ago Docs: https://docs.mongodb.org/manual Main PID: 807 (mongod) CGroup: /system.slice/mongod.service └─807 /usr/bin/mongod --config /etc/mongod.conf Feb 14 16:22:22 ubuntu18-bionic systemd[1]: Started MongoDB Database Server. Feb 14 16:23:11 ubuntu18-bionic systemd[1]: mongod.service: Current command vanished from the unit file, execution # Subsequent restarts are fine, issue is only with uninstall & reinstall: vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo systemctl restart mongod vagrant@ubuntu18-bionic:/etc/apt/sources.list.d$ sudo systemctl status mongod ● mongod.service - MongoDB Database Server Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-02-14 16:40:06 UTC; 1s ago Docs: https://docs.mongodb.org/manual Main PID: 3275 (mongod) CGroup: /system.slice/mongod.service └─3275 /usr/bin/mongod --config /etc/mongod.conf Feb 14 16:40:06 ubuntu18-bionic systemd[1]: Started MongoDB Database Server.