Mind Dump, Tech And Life Blog
written by Ivan Alenko
published under license CC4-BY
posted at 29. Mar '22

Shitty Systemd Unit Files

Again I will rant on PostgreSQL a bit - and systemd. I dislike systemd, especially when something like postgres fails to start, systemd writes “run these shitty commands which shows nothing useful” basically saying fuck you.

rapthalia:/etc # systemctl start postgresql

░░ The job identifier is 5559 and the job result is done.
Feb 11 00:42:58 rapthalia systemd[1]: Starting PostgreSQL database server...
░░ Subject: A start job for unit postgresql.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit postgresql.service has begun execution.
░░ 
░░ The job identifier is 5559.
Feb 11 00:42:58 rapthalia postgresql-script[19702]:  Your database files were created by PostgreSQL version 13.
Feb 11 00:42:58 rapthalia postgresql-script[19702]:  Using the executables in /usr/lib/postgresql13/bin.
Feb 11 00:42:58 rapthalia postgresql-script[19712]: 2022-02-11 00:42:58.202 CET   [19712]LOG:  redirecting log output to logging collector process
Feb 11 00:42:58 rapthalia postgresql-script[19712]: 2022-02-11 00:42:58.202 CET   [19712]HINT:  Future log output will appear in directory "log".
Feb 11 00:42:58 rapthalia postgresql-script[19710]: pg_ctl: could not start server
Feb 11 00:42:58 rapthalia postgresql-script[19710]: Examine the log output.
Feb 11 00:42:58 rapthalia systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit postgresql.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Feb 11 00:42:58 rapthalia systemd[1]: postgresql.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit postgresql.service has entered the 'failed' state with result 'exit-code'.
Feb 11 00:42:58 rapthalia systemd[1]: Failed to start PostgreSQL database server.
░░ Subject: A start job for unit postgresql.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit postgresql.service has finished with a failure.
░░ 
░░ The job identifier is 5559 and the job result is failed.
rapthalia:/etc # journalctl -u postgresql.service -b
Feb 10 22:30:04 rapthalia systemd[1]: Starting PostgreSQL database server...
Feb 10 22:30:04 rapthalia postgresql-script[1872]:  Your database files were created by PostgreSQL version 13.
Feb 10 22:30:04 rapthalia postgresql-script[1872]:  Using the executables in /usr/lib/postgresql13/bin.
Feb 10 22:30:04 rapthalia postgresql-script[1903]: 2022-02-10 22:30:04.594 CET   [1903]LOG:  redirecting log output to logging collector process
Feb 10 22:30:04 rapthalia postgresql-script[1903]: 2022-02-10 22:30:04.594 CET   [1903]HINT:  Future log output will appear in directory "log".
Feb 10 22:30:04 rapthalia systemd[1]: Started PostgreSQL database server.
Feb 11 00:42:58 rapthalia systemd[1]: Stopping PostgreSQL database server...
Feb 11 00:42:58 rapthalia postgresql-script[19692]:  Your database files were created by PostgreSQL version 13.
Feb 11 00:42:58 rapthalia postgresql-script[19692]:  Using the executables in /usr/lib/postgresql13/bin.
Feb 11 00:42:58 rapthalia systemd[1]: postgresql.service: Deactivated successfully.
Feb 11 00:42:58 rapthalia systemd[1]: Stopped PostgreSQL database server.
Feb 11 00:42:58 rapthalia systemd[1]: Starting PostgreSQL database server...
Feb 11 00:42:58 rapthalia postgresql-script[19702]:  Your database files were created by PostgreSQL version 13.
Feb 11 00:42:58 rapthalia postgresql-script[19702]:  Using the executables in /usr/lib/postgresql13/bin.
Feb 11 00:42:58 rapthalia postgresql-script[19712]: 2022-02-11 00:42:58.202 CET   [19712]LOG:  redirecting log output to logging collector process
Feb 11 00:42:58 rapthalia postgresql-script[19712]: 2022-02-11 00:42:58.202 CET   [19712]HINT:  Future log output will appear in directory "log".
Feb 11 00:42:58 rapthalia postgresql-script[19710]: pg_ctl: could not start server
Feb 11 00:42:58 rapthalia postgresql-script[19710]: Examine the log output.
Feb 11 00:42:58 rapthalia systemd[1]: postgresql.service: Control process exited, code=exited, status=1/FAILURE
Feb 11 00:42:58 rapthalia systemd[1]: postgresql.service: Failed with result 'exit-code'.
Feb 11 00:42:58 rapthalia systemd[1]: Failed to start PostgreSQL database server.

Like here - I got “Examine the log output.”. Well, the fucking systemd is log output. I had to run postgres by manually. Fortunately I think it loaded configuration just fine even with bare command, so wasn’t that painful except having to switch to postgres user with explicit shell.

rapthalia:/etc # su -l postgres -s /bin/bash
postgres@rapthalia:~> postgres
2022-02-11 00:49:45.508 CET   [20205]FATAL:  database files are incompatible with server
2022-02-11 00:49:45.508 CET   [20205]DETAIL:  The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 14.1.

Why are we here?
Just to suffer?
Every night,
I can feel my SysVinit and OpenRC
even my runits
The service managers I’ve lost…
the comfort I lost…
won’t stop hurting
It’s like they are still there.
You feel it too, don’t you?


Why are we here? Copyright - Metal Gear Solid V


Just to suffer? Copyright - Metal Gear Solid V

P.S. Postgres, why -h can’t be help, but hostname? Why can’t we have nice things?

Add Comment