Skip to content

ExecStart does not search $path? Could it? #199

@dnisbet

Description

@dnisbet

When setting up a service in a container I get:

   ERROR:systemctl: slapd.service: Exec is not an absolute path: ExecStart=sh -c 'mkdir -p /run/slapd; \
    chown "$SLAPD_USER":"$SLAPD_GROUP" /run/slapd; \
    [ -d "$SLAPD_CONF" ] && confflag=-F || confflag=-f; \
    exec /usr/sbin/slapd -d0 \
     ${SLAPD_SERVICES:+-h "$SLAPD_SERVICES"} \
     ${SLAPD_USER:+-u "$SLAPD_USER"} \
     ${SLAPD_GROUP:+-g "$SLAPD_GROUP"} \
     ${SLAPD_CONF:+$confflag "$SLAPD_CONF"} \
     $SLAPD_OPTIONS'

   ERROR:systemctl: slapd.service: Exec command does not exist: (ExecStart) sh
   ERROR:systemctl: slapd.service: but this does exist: /usr/bin/sh
   ERROR:systemctl: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   ERROR:systemctl: The SystemD ExecXY commands must always be absolute paths by definition.
   ERROR:systemctl: Oops, 1 executable paths were not found in the current environment. Refusing.
   ERROR:systemctl: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Could it not search the paths systemd might? Or must it be an absolute path as stated in the error?

eg:

systemd-path search-binaries-default

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

Service file:

cat /usr/lib/systemd/system/slapd.service

[Unit]
Description=OpenLDAP Server Daemon
After=network.target

It doesn't really need network-online. Might revisit this for trixie:

old initscript does have dependency on network-online.

#After=network-online.target

For binding to particular IPs with systemd-networkd, use

#After=systemd-networkd-wait-online@eth0:no-carrier.service

(with appropriate name for eth0)

Documentation=man:slapd
Documentation=man:slapd-config
Documentation=man:slapd-mdb

[Service]
Type=notify

/etc/default/slapd sets:

SLAPD_SERVICES SLAPD_CONF SLAPD_USER SLAPD_GROUP SLAPD_OPTIONS

Also can set KRB5_KTNAME

EnvironmentFile=/etc/default/slapd

can use User=, but it does not accept $Variables (compatibility)

can use RuntimeDirectory= but it need to be owned by user anyway

ExecStart=sh -c 'mkdir -p /run/slapd;
chown "$SLAPD_USER":"$SLAPD_GROUP" /run/slapd;
[ -d "$SLAPD_CONF" ] && confflag=-F || confflag=-f;
exec /usr/sbin/slapd -d0
${SLAPD_SERVICES:+-h "$SLAPD_SERVICES"}
${SLAPD_USER:+-u "$SLAPD_USER"}
${SLAPD_GROUP:+-g "$SLAPD_GROUP"}
${SLAPD_CONF:+$confflag "$SLAPD_CONF"}
$SLAPD_OPTIONS'

[Install]
WantedBy=multi-user.target

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions