Discussion:
[systemd-devel] How to troubleshoot 'step CHDIR spawning' failure.
MikeB
2016-04-13 11:28:34 UTC
Permalink
I'm running systemd 215 on a fairly up-to-date Debian Jessie system.

I have a Type=forking service that fails on its first ExecStartPre command
which is using /bin/mkdir to create a directory.

The service fails to start with the following.

Apr 13 10:07:42 localhost systemd[1]: Starting OVSDB Server Daemon...
Apr 13 10:07:42 localhost systemd[4069]: Failed at step CHDIR spawning
/bin/mkdir: No such file or directory
Apr 13 10:07:42 localhost systemd[1]: ovsdb-server.service: control process
exited, code=exited status=200
Job for ovsdb-server.service failed. See 'systemctl status
ovsdb-server.service' and 'journalctl -xn' for details.
Apr 13 10:07:42 localhost systemd[1]: Failed to start OVSDB Server Daemon.
Apr 13 10:07:42 localhost systemd[1]: Unit ovsdb-server.service entered
failed state.
a

I've verified that '/bin/mkdir' does exist and does run fine. So I assume
the the 'No such file or directory' refers to the target of the chdir.

My question is how do I troubleshoot from here? What can I do to determine
exactly what file or directory is not being found. I'd like to understand
what is wrong and fix it.

Thanks and Regards,
Mike
Tomasz Torcz
2016-04-13 11:48:08 UTC
Permalink
Post by MikeB
I'm running systemd 215 on a fairly up-to-date Debian Jessie system.
I have a Type=forking service that fails on its first ExecStartPre command
which is using /bin/mkdir to create a directory.
The service fails to start with the following.
Apr 13 10:07:42 localhost systemd[1]: Starting OVSDB Server Daemon...
Apr 13 10:07:42 localhost systemd[4069]: Failed at step CHDIR spawning
/bin/mkdir: No such file or directory
Apr 13 10:07:42 localhost systemd[1]: ovsdb-server.service: control process
exited, code=exited status=200
Job for ovsdb-server.service failed. See 'systemctl status
ovsdb-server.service' and 'journalctl -xn' for details.
Apr 13 10:07:42 localhost systemd[1]: Failed to start OVSDB Server Daemon.
Apr 13 10:07:42 localhost systemd[1]: Unit ovsdb-server.service entered
failed state.
a
I've verified that '/bin/mkdir' does exist and does run fine. So I assume
the the 'No such file or directory' refers to the target of the chdir.
My question is how do I troubleshoot from here? What can I do to determine
exactly what file or directory is not being found. I'd like to understand
what is wrong and fix it.
CHDIR failure points to something related with directory. Check
what directives you have in unit file - maybe WorkingDirectory= with
dir that do not exists? Or RootDirectory= ?
Speculating further - maybe you are trying to mkdir directory which
you also put in RootDirectory= ? This won't work, because /bin/mkdir is
run in the same environment that main process; but you can
– investigate if PermissionStartOnly= (man systemd.service) will help you
– use RuntimeDirectory= (man systemd.service) to automate directory
creation
- use tmpfiles to precreate all directories
--
Tomasz .. oo o. oo o. .o .o o. o. oo o. ..
Torcz .. .o .o .o .o oo oo .o .. .. oo oo
o.o.o. .o .. o. o. o. o. o. o. oo .. .. o.
MikeB
2016-04-13 13:59:47 UTC
Permalink
Post by Tomasz Torcz
* I've verified that '/bin/mkdir' does exist and does run fine. So I assume
*>>* the the 'No such file or directory' refers to the target of the chdir.
*>> >>* My question is how do I troubleshoot from here? What can I do
to determine
*>>* exactly what file or directory is not being found. I'd like to understand
*>>* what is wrong and fix it.
*>
Post by Tomasz Torcz
CHDIR failure points to something related with directory. Check
what directives you have in unit file - maybe WorkingDirectory= with
dir that do not exists? Or RootDirectory= ?
Speculating further - maybe you are trying to mkdir directory which
you also put in RootDirectory= ? This won't work, because /bin/mkdir is
run in the same environment that main process; but you can
– investigate if PermissionStartOnly= (man systemd.service) will help you
– use RuntimeDirectory= (man systemd.service) to automate directory
creation
- use tmpfiles to precreate all directories
Sorry, I should have included the entire contents of the service file.

Your speculation was right on... hidden among all the commands the the
[Service] section was a WorkingDirectory= statement that I hadn't noticed.
It was, indeed, pointing to a directory that doesn't exist.

Easy fix. Thank you.

Loading...