I'm having trouble figuring out how to remove systemd units that no longer have files. They still seem to linger in the system somehow.

The old broken units I am trying to remove:

core@ip-172-16-32-83 ~ $ systemctl list-units --all firehose-router*
  UNIT                       LOAD      ACTIVE SUB    DESCRIPTION
<E2><97><8F> firehose-router@02.service not-found failed failed firehose-router@02.service
<E2><97><8F> firehose-router@03.service not-found failed failed firehose-router@03.service

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

The files do not exist, yet a reload still has these units lingering:

core@ip-172-16-32-83 ~ $ systemctl list-unit-files firehose-router@02.service
core@ip-172-16-32-83 ~ $ sudo systemctl daemon-reload
core@ip-172-16-32-83 ~ $ systemctl list-units --all firehose-router*
  UNIT                       LOAD      ACTIVE SUB    DESCRIPTION
<E2><97><8F> firehose-router@02.service not-found failed failed firehose-router@02.service
<E2><97><8F> firehose-router@03.service not-found failed failed firehose-router@03.service

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

2 loaded units listed.
To show all installed unit files use 'systemctl list-unit-files'.

There are no files related to them that I can find:

core@ip-172-16-32-83 ~ $ sudo find /var/run/systemd -name "*firehose-router*"
core@ip-172-16-32-83 ~ $ find /etc/systemd/ -name "*firehose-router*"
core@ip-172-16-32-83 ~ $ find /usr/lib/systemd/ -name "*firehose-router*"
core@ip-172-16-32-83 ~ $

So how do I get rid of these?

share|improve this question
    
You don't mention it, but I guess it fails if you try to systemctl disable them, right? – dawud Jun 19 '14 at 18:27
1  
It just exist with 0. There is nothing to disable (it is already missing / disabled). – Andy Shinn Jun 19 '14 at 18:31
    
I tried all the solutions suggested here (and below so far) and rebooted and nothing worked. The units I'm trying to remove were once installed or attempted to install, and then later apt purged. So apparently apt purge does not remove the configuration that is given to systemd. It's still not clear to me if these "not-found" units cause any problems. – Eliptical view Sep 30 '16 at 5:05
    
I suspect I might be able to delete files in /var/lib/systemd/deb-systemd-helper-enabled/ but am not sure if I want to mess with this. I appear to have two known dead ends there: mariadb.service.dsh-also and mysql.service.dsh-also – Eliptical view Sep 30 '16 at 5:20
    
@Elipticalview Make a backup of these files, just in case, and afterwards remove these? – gf_ Feb 24 '17 at 10:09
up vote 46 down vote accepted

The command you're after is systemctl reset-failed

share|improve this answer
3  
Thank you! I don't know why that was not more obvious to me... – Andy Shinn Jun 19 '14 at 18:40
5  
This worked for finally cleaning up a "real" service, but I have an alias service that refuses to go away. I tried disable, daemon-reloadand reset-failed but the alias service comes up as not-found inactive dead always. I also searched the disk for anything that matches the service name with no results. – Mark Lakata Jul 1 '15 at 18:16
2  
I just ran into this and systemctl stop <service> worked for me. – mpontillo Aug 8 '16 at 21:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.