在Ubuntu 16.04上找不到systemctl命令。

当我尝试在Ubuntu 16.04上安装RocketChat时,在命令提示符中输入。
systemctl enable mongod

之后我遇到了这个问题。
systemctl: command not found

怎么解决这个问题?

在终端上尝试执行以下命令:dpkg-query -S /bin/systemctl - Liso
我尝试了这个,我得到了"dpkg-query: 找不到与模式/bin/systemctl匹配的路径。" - Vignesh Ramamoorthy
2@VigneshRamamoorthy: 这个命令whereis systemctl会给你什么结果? - Saurav Kumar
我尝试安装systemd软件包,但出现错误:“未找到软件包systemd,但有另一个软件包引用它。这可能意味着软件包缺失、已被废弃或仅能从其他来源获取。”E: 软件包'systemd'没有可安装的候选项。 - Vignesh Ramamoorthy
whereis systemctl 命令返回 "systemctl:"@saurav kumar - Vignesh Ramamoorthy
1你确定你正在使用Ubuntu 16.04吗?请更新你的帖子,附上cat /etc/os-releasels -al $(which init)的输出。 - N0rbert
1抱歉,我的版本是12.04.5 LTS。名称为"Ubuntu" 版本为"12.04.5 LTS, Precise Pangolin" ID为ubuntu ID_LIKE为debian 漂亮的名称为"Ubuntu precise (12.04.5 LTS)" 版本ID为"12.04" 如何在Ubuntu 12.04.5 LTS, Precise Pangolin上安装RocketChat?有任何教程指南吗? - Vignesh Ramamoorthy
1个回答

首先,您需要检查是否安装了 systemd 软件包 - sudo dpkg -l | grep systemd
如果没有安装,则可以手动安装它 sudo apt-get install systemd。但如果已经安装了,可能会损坏,所以您可以尝试重新安装它 sudo apt-get install --reinstall systemd
如果软件包已安装,即使重新安装后仍无法正常工作,请列出此软件包中文件的完整路径 sudo dpkg -L systemd。也许二进制文件位于未包含在$PATH变量中的目录中。

2我尝试安装systemd软件包时遇到了错误:“软件包systemd不可用,但被另一个软件包引用。 这可能意味着该软件包缺失、已过时或仅可从其他来源获取。” E: 软件包'systemd'没有可安装的候选项。 - Vignesh Ramamoorthy
1sudo apt-cache search systemd的输出是什么? - M. Dm.
这是sudo apt-cache search systemd的输出结果:"live-config-systemd - Debian Live - 系统配置脚本(systemd后端) nagios-plugins-contrib - 适用于nagios兼容监控系统的插件" - Vignesh Ramamoorthy
2你在系统安装后运行了 sudo apt-get update 吗?我觉得你的软件源有些问题。 - M. Dm.
2请修正您的回答:apt-get install --reinstall systemd - Marco
只需重新安装软件包 apt-get install --reinstall systemd,然后查看 dpkg -L systemd 中的任何路径是否在你的 echo $PATH 中。 - pegasuspect