In testing, DEB installs of latest MDB v4.2.3 run into the following error if MDB had been previously installed and then uninstalled on the machine:
Failed to start mongod.service: Unit mongod.service not found.
The fix is to manually run:
sudo systemctl daemon-reload
We've gotten some light feedback on the docs concerning this, so I went and tested this:
Findings:
- I was able to verify this on Ubuntu 18 and Debian 10, and have attached steps to reproduce (for Ubuntu 18).
- I believe the DEB install script just needs to add the systemctl daemon-reload command post-install. It would appear that our RPMs do perform this step post-install. I've attached a comparison. Sure enough, in testing RPMs on CentOS 8 and 7, this problem does not occur (i.e. install, uninstall, reinstall does not require explicitly running daemon-reload on RPM distros)
- Interestingly, the DEB uninstall script (postrm) does run the systemctl daemon-reload command. Ironically, it might be its very inclusion in the uninstall step that causes this issue in the first place, since it forces systemd to realize that the mongod.service file has been removed.
- This probably affects any DEB-using distro that uses systemd until files, even those on which users might be running SysV Init commands (i.e. service) instead of systemctl, as those distros redirect those commands to systemd in the background. A tweak to the DEB install steps to include daemon-reload would fix these distros too, but should be done in a way that it fails silently on non-systemd machines. The RPM seems to handle this well, and might be a good source for comparison.
Hope this helps!
- causes
-
SERVER-52937 mongodb-org 4.2.11 debian package is failing to install
- Closed
- related to
-
SERVER-52806 deb install files assume systemd
- Closed
-
SERVER-50888 Consider SERVER-46342 for backport to v4.2 --> v3.6
- Closed