Error "Failed to get NAME_INIT.D, systemctl didn't recognize this service ('NoSuchUnit')."

When I try to update my Yunohost 3.4.2.4 I get the error message, “Failed to get status information via dbus for service NAME_INIT.D, systemctl didn’t recognize this service (‘NoSuchUnit’).”

I get this error all the time since upgrading to Yunohost 3.4.2.

The log is:

Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/moulinette/interfaces/api.py", line 439, in process
        ret = self.actionsmap.process(arguments, timeout=30, route=_route)
      File "/usr/lib/python2.7/dist-packages/moulinette/actionsmap.py", line 523, in process
        return func(**arguments)
      File "/usr/lib/moulinette/yunohost/tools.py", line 476, in tools_update
        if not cache.update():
      File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 466, in update
        raise FetchFailedException()
    FetchFailedException

And I can’t connect via ssh as well, I get the error message:

sh: connect to host xxx.xx port 22: Connection refused

Well uh okay it looks like 3 different problems …

I would suspect that this is because you attempted multiple time failed login ? Are you trying to connect as root or admin ?

That looks like an issue when with apt’s sources.list … If you are able to succesfully log in through SSH, can you run apt update manually and see if it complains about something ?

The errir about service NAME_INIT.D looks not so important, though I suspect it’s related to a bad-quality app which didn’t sucesfully installed / removed …

Thanks for your help, I can now ssh as an admin. When I try to apt update I get the following errors:

chmod 0700 of directory /var/lib/apt/lists/partial failed - SetupAPTPartialDirectory (1: Operation not permitted)

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

E: Unable to lock directory /var/lib/apt/lists/

W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)

W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

What if you run it with sudo ? sudo apt update

Sorry, I thought that I did use sudo par apparently I did not. With sudo I get the following complains:

W: Target Packages (non-free/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Packages (non-free/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-de) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-de_DE) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://packages.sury.org/php stretch InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B188E2B695BD4743

W: Failed to fetch https://packages.sury.org/php/dists/stretch/InRelease The following signatures couldn't be verified because the public key is not available: NO_PUBKEY B188E2B695BD4743

W: Some index files failed to download. They have been ignored, or old ones used instead.

W: Target Packages (non-free/binary-amd64/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Packages (non-free/binary-all/Packages) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-en_US) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-en) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-de) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

W: Target Translations (non-free/i18n/Translation-de_DE) is configured multiple times in /etc/apt/sources.list:12 and /etc/apt/sources.list.d/non-free.list:1

Well, that sounds pretty similar to Internal error / system update

You installed some questionnable quality app (idk which one, it’s not impossible that it was level 7 'cause we don’t really flag apps with custom repo as bad I think …) and now it broke your setup :confused:

So basically, I would :

  • sudo rm /etc/apt/sources.list.d/non-free.list
  • grep -nr "sury" /etc/apt/sources.list* to find which line the ‘sury’ repo is configured, edit the file, and comment the line by adding a # in the front of it…

Thanks for your help. This is a bit to complicated for me, but as I’m on a testserver anyway, I will just rewind to an old snapshot and start all over.