I'm trying to create a systemd service. I see this error message in my journal.

Failed at step CHDIR spawning /bin/sh: No such file or directory

What causes this?


I had

ExecStartPost=/bin/rm /tmp/dir    
ExecStartPost=/bin/sh -c "foo bar"

One ExecStartPost was deleting the working directory. The second ExecStartPost couldn't get into that directory to run the command. That's the error that was generated.

  • Are you sure it was /bin/rm /tmp/dir, and not rmdir? rm would fail if /tmp/dir was a directory. Sep 27 '21 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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