服务无法连接到 upstart: 连接被拒绝

分享于 

3分钟阅读

ubuntu

  繁體

问题

我刚通过do-release-upgrade更新,现在某些upstart作业(如fail2ban和plexmediaserver )无法启动(已经尝试重新安装)


sudo service fail2ban start


Job for fail2ban.service failed. See"systemctl status fail2ban.service" and"journalctl -xe" for details.



 systemctl status fail2ban.service


â fail2ban.service - Fail2Ban Service


 Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)


 Active: failed (Result: start-limit) since Mon 2015-04-27 19:47:27 BST; 26s ago


 Docs: man:fail2ban(1)


 Process: 14423 ExecStart=/usr/bin/fail2ban-client -x start (code=exited, status=255)



sudo service plexmediaserver start


Failed to start plexmediaserver.service: Unit plexmediaserver.service failed to load: No such file or directory.



sudo dpkg -i plexmediaserver_0.9.11.16.958-80f1748_amd64.deb


(Reading database ... 88738 files and directories currently installed.)


Preparing to unpack plexmediaserver_0.9.11.16.958-80f1748_amd64.deb ...


stop: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused




答案1

从15.04年开始,Ubuntu切换到systemd作为它服务框架,适用桌面和服务器。

建议的修复

请参阅wiki文章将upstart脚本转换为systemd

快速修复(仅适用于15.04 )

要永久切换回upstart只需运行:


sudo apt-get install upstart-sysv


sudo update-initramfs -u


sudo reboot




答案2

我发现fail2ban的问题是,在配置文件中有一个错误:/etc/fail2ban/jail.local

在pam部分,port变量被列出两次


[pam-generic]



...



port = all


banaction = iptables-allports


port = anyport



即使本节被禁用( enabled = false 在配置中,这会导致一个错误。我简单地注释掉了第二个定义


# port = anyport



我通过手动运行fail2ban找到了这个:


sudo fail2ban-client start




答案3

解决方案就是最近的VirtualBox更新。

在终端(Ctrl+Alt+F1如果从恢复模式访问)中运行:


sudo apt-get purge virtualbox-guest-x11