2

I have a Raspbian 9 system with an external hard disk, which gets mounted as /srv/file during boot. I am running PostgreSQL and BIND, both of which have data files residing on that disk.

On startup, PostgreSQL routinely fails to start because the external disk filesystem is not mounted yet. BIND starts but, for the same reason, name resolution fails for anything stored on the file system.

systemctl list-units | grep mount tells me the systemd unit for the file system is srv-file.mount. I then went and added

Requires=srv-file.mount

to the [Unit] section of bind9.service and postgresql.service (neither has any other startup requirement), but still to no avail.

What am I missing?

1 Answer 1

3

According to the docs, there is an option specifically for mounts:

RequiresMountsFor=/srv/file/named

ensures all mounts required to access /srv/file/named are in place before this unit starts.

This has worked for BIND.

For PostgreSQL, however, there seems to be some other error. The service seems to be down (Webmin tells me it is, and the application using it does not work either), yet systemctl status postgresql tells me it’s up:

● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Sun 2021-06-13 18:48:18 CEST; 4min 57s ago
  Process: 543 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 543 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/postgresql.service

A look at the unit file tells me it does nothing other than running true. This seems to be a different problem than I thought I had; apparently I edited the wrong file.

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.