0

I am trying to test how the BindPaths= directive works on a Debian 8 system with systemd.

Currently I have a basic unit file for a service:

[Unit]
Description="Simple Test Service"
BindPaths=/path:/bindmount/path:norbind

[Service]
ExecStart=/usr/bin/long_running_program --flags
Restart=always

[Install]
WantedBy=multi-user.target

When I run findmnt before and after starting the service I do not see the bind mount at /bindmount/path listed at all.

When I ls or ls -a the bind mount location /bindmount/path I do not see any files that are in /path.

Why is this not working as expected?

I see in the systemd BindPath= man page it says:

This option is only available for system services and is not supported for services running in per-user instances of the service manager.

How do I know if I am running in a per-user instance of the service manager vs running a system service? Is it based on if my service is located in /etc/systemd/system vs /lib/systemd/system?

0

The BindPaths option make the file visible to the process ran by the unit. This is not visible at all from the shell where you type the command to start the service. At any moment you may check what file systems are mounted looking at /proc/mounts, but if you run a service with BindPaths, I think the only way to check if the file system is correctly mounted is to check /proc/pid-of-service/mounts. The latter is the list of mounted file system for that process.

About your final questions: /lib/systemd/system contains all normal unit files, while /etc/systemd/system contains custom unit files and all dependencies between units. Per user instances are run with systemctl --user and refers to unit files in the home directory tree.

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.