2

I have tried to start ejabberd service with systemctl in Ubuntu 22.04, but I keep getting:

Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142

1 Answers1

1

If you arrived here trying to install a package, you can fix it temporary while we wait for a fix allowing you to install the package.

Remember to change <package> with the name of the package you're getting the problem.

  • Look on /var/lib/dpkg/info/<package>.postinst
  • Edit that file and comment the lines with the deb-systemd-invoke commands. If they're inside a if/then which will be empty place a echo '1' to avoid problems with the empty if.
  • Run the apt install another time which should finish the installation
  • Edit the /var/lib/dpkg/info/<package>.postinst another time and leave it as it was before.
  • Enable the service /lib/systemd/systemd-sysv-install enable <package>
  • You're a legend! Thank you! This exact behaviour occurred to me on an U24.04 server (in regards to an openssh-server upgrade) and your answer got it fixed! – techsk8 Apr 29 '25 at 21:27
  • If you encounter this problem with openssh-server on Ubuntu 24.04 specifically, be sure to try systemctl start ssh.socket by hand at least once to see how that fails. Earlier, the systemd-generator for sshd set only the port number, while systemd defaults to binding only IPv6 (god knows why); I "fixed" it by adding BindIPv6Only=both. Cue the next update, now the generator explicitly binds 0.0.0.0:22 and [::]:22, so that option now causes an 'address already in use' error at the exact same line in deb-systemd-invoke--but you have to check the journal to see what the actual error was. – pyansharp Aug 21 '25 at 16:52