51

Just updated via do-release-upgrade and now certain upstart jobs such as fail2ban and plexmediaserver will not start (have tried reinstalling)

$ 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

Any ideas with where to start on this?

abu_bua
  • 10,473
  • 10
  • 45
  • 62
matty87a
  • 511
  • 1
  • 4
  • 3
  • Can you add the contents of `/lib/systemd/system/fail2ban.service` to your post? The `failed (Result: start-limit)` indicates that the service is constantly failing and trying to restart, and `systemd` is limiting how many times it starts in a given time period. Also wondering if [this bug report](https://bugs.archlinux.org/task/31170) is relevant. – TheSchwa Apr 28 '15 at 17:09
  • [status: Unable to connect to Upstart:](https://askubuntu.com/q/719228/582516) may helps – LF00 Oct 28 '17 at 11:45

5 Answers5

54

Ubuntu switched to systemd as its service framework starting in 15.04 for all flavors, including Desktop and Server. The recommended practice is to change your upstart jobs to systemd jobs (see the wiki article for more info). You can also switch back to upstart if you want, which is certainly the quicker fix. I recommend you read the first few sections of the wiki article to weight the pros and cons.

Recommended Fix

Refer to the wiki article to transition your upstart scripts to systemd.

Discussion and coding guide: Systemd For Upstart Users

Quick Fix (for 15.04 only)

To permanently switch back to upstart just run:

sudo apt-get install upstart-sysv
sudo update-initramfs -u
sudo reboot

EDIT: The wiki article only recommends this for 15.04, but some users have found it helpful on 16.04 too.

Zanna
  • 69,223
  • 56
  • 216
  • 327
TheSchwa
  • 3,820
  • 1
  • 25
  • 38
  • 1
    Surely `systemd` is only the default on newly installed systems, not on systems that were upgraded from 14.10? – Jos Apr 28 '15 at 10:08
  • 1
    Taking a closer look at the output you posted, the job is apparently trying to start using `systemd` and not `upstart`. Notice that `systemctl` is mentioned several times, which is the command line interface to `systemd`. In addition, the `Failed to connect to socket` error suggests that `upstart` is not running at all. It looks like `fail2ban` is trying to use `systemd` but the script has an error, and `plexmediaserver` is trying to use `upstart` which no longer exists. – TheSchwa Apr 28 '15 at 16:44
  • See also http://askubuntu.com/questions/600026/problems-starting-plexmediaserver-on-kubuntu-15-04 regarding `plexmediaserver` on 15.04 – TheSchwa Apr 28 '15 at 16:48
  • 3
    Is Upstart discontinued now? I just liked how easy it was to create new services.. – Kapé Aug 30 '16 at 20:12
  • @Kape Yes, it's being replaced by systemd. I do believe however that almost all of the upstart jobs will be backwards compatible to minimize the impact to end users during the transition process. – BobTuckerman Oct 25 '16 at 16:42
  • 7
    the quick fix screwed up my ubuntu install (16.04) had to boot into recovery mode, with root prompt and type: `apt-get remove upstart-sysv` and `update-initramfs -u` to get everything working again – JqueryToAddNumbers Jan 13 '17 at 07:39
  • @ExceptionSlayer srry to hear that :( I added a note in the answer about versions, since from the wiki "If you are running Ubuntu vivid (15.04), you can easily switch between upstart and systemd at will since both packages are installed at present." – TheSchwa Jan 15 '17 at 22:46
  • 1
    That happened to me, too, @ExceptionSlayer. Thank you for the instructions. – Robin Zimmermann Jan 25 '17 at 21:13
  • Thank you @ExceptionSlayer for your comment and saving my system. This quick fix screwed up my ubuntu install (16.04) as well. – Greg G May 17 '17 at 17:12
5

I found the problem for fail2ban was an error in the configuration file: /etc/fail2ban/jail.local

In the pam section, the port variable is listed twice

[pam-generic]

...

port     = all
banaction = iptables-allports
port     = anyport

Even though this section is disabled (enabled = false) in my configuration, this causes an error. I simply commented out this second definition

# port     = anyport

I found this by running fail2ban manually:

sudo fail2ban-client start
Zanna
  • 69,223
  • 56
  • 216
  • 327
1

Here the solution. It's all about the recent VirtualBox update.

Run in terminal (Ctrl+Alt+F1 if you are acceding from recovery mode):

sudo apt-get purge virtualbox-guest-x11
Eliah Kagan
  • 116,445
  • 54
  • 318
  • 493
0

In my case where the Ubuntu version was upgraded, it was just the way we run command in case of the new Ubuntu version :

New command which works:

 sudo service ssh restart

To check tcp is listening on port 22, you should get some output from this command : sudo netstat -anp | grep sshd

To check ssh is running :

  1. eval ssh-agent
  2. ps -aux | grep ssh

Note: We are considering that the key required to ssh is loaded in the ssh agent from the box where ssh is being initiated and the key is also added to .ssh/authorized_keys file on the box in which ssh is being done.

abu_bua
  • 10,473
  • 10
  • 45
  • 62
-3

I had this problem after upgrading a Linux VM (VirtualBox).

Turns out I had to run VBoxLinuxAdditions.run from the pseudo-terminal as root and reboot to fix this.

FYI in case anyone out there has the same problem.

David