-1

I am trying to install, configure, and start a postgresql 12 service on amazon linux 2023. I have installed the service from source and have created a postgresql.service file in /usr/lib/systemd/system/. I am not able to start the service (I placed the error below) and is there any other configuration that needs to be done? Thank you :)

contents of postgresql.service

systemd unit configuration
#
# This can be installed as a service on new system with
#   systemctl enable "$PWD/postgresql.service"
#
# Check status with
#   systemctl status postgresql

[Unit] Description=PostgreSQL database server

[Service] WorkingDirectory=/usr/lib/systemd/system ExecStart="/usr/lib/systemd/system/postgresql.service" TimeoutSec=300

[Install] WantedBy=multi-user.target

permissions:

-rwxr-xr-x. 1 root root 397 Oct 20 11:52 postgresql.service

error:

× postgresql.service - PostgreSQL database server
 Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; preset: disabled)
 Active: failed (Result: exit-code) since Fri 2023-10-20 11:55:36 UTC; 4s ago
Duration: 1ms
Process: 364804 ExecStart=/usr/lib/systemd/system/postgresql.service (code=exited, status=203/EXEC)

Oct 20 11:55:36 ip- systemd[1]: Started postgresql.service - PostgreSQL database server. Oct 20 11:55:36 ip- systemd[364804]: postgresql.service: Failed to execute /usr/lib/systemd/system/postgresql.service: Exec format error Oct 20 11:55:36 ip- systemd[364804]: postgresql.service: Failed at step EXEC spawning /usr/lib/systemd/system/postgresql.service: Exec format error Oct 20 11:55:36 ip systemd[1]: postgresql.service: Main process exited, code=exited, status=203/EXEC Oct 20 11:55:36 ip- systemd[1]: postgresql.service: Failed with result 'exit-code'.

justaguy
  • 229

2 Answers2

2

Note the "Permission denied" errors. Use chmod to set permissions appropriately, or start the service as su.

1

ExecStart="/usr/lib/systemd/system/postgresql.service"

This makes no sense at all. What do you expect from a service that tries to run itself as an executable?

Let alone that it's not a valid executable anyway.

Tom Yan
  • 10,996