Problems starting up PostgreSQL 9.1 powered by Webuzo | | /etc/init.d/postgresql: Bad substitution

Whenever I try to start the PostgreSQL 9.1 DB service it's throwing this error.

[email protected]:~# sudo service postgresql status
/etc/init.d/postgresql: 1: /etc/init.d/postgresql: typeset: not found
/etc/init.d/postgresql: 30: /etc/init.d/postgresql: Bad substitution

The last log entry in the DB log (postgresql-9.1-main.log) was:

2018-05-08 19:02:41 CST LOG: received smart shutdown request
2018-05-08 19:02:41 CST LOG: autovacuum launcher shutting down
2018-05-08 19:02:41 CST FATAL: terminating connection due to administrator command
2018-05-08 19:02:41 CST FATAL: terminating connection due to administrator command
2018-05-08 19:02:41 CST FATAL: terminating connection due to administrator command
2018-05-08 19:02:41 CST FATAL: terminating connection due to administrator command
2018-05-08 19:02:41 CST LOG: shutting down
2018-05-08 19:02:41 CST LOG: database system is shut down

We haven't installed nor change any configuration recently. I'm puzzled about this issue. We'll be grateful if anyone has any idea about how to solve this problem.

Thank you

4 Replies

Hey there,

The "Smart Shutdown request” message in postgresql-9.1-main.log is indicating postgres process is manually killed. "Smart" mode (the default) waits for all active clients to disconnect and any online backup to finish.

CST FATAL: terminating connection due to administrator command

This could be the result of a KILL() command or a SIGTERM signal. I found some postgresql documentation that should help inform your troubleshooting:

https://www.postgresql.org/message-id/5665.1202148155%40sss.pgh.pa.us

https://www.postgresql.org/message-id/BA2AEDD6-1B9E-4E3D-BD71-B6ABF2D0353A%40unicell.co.il

https://www.postgresql.org/docs/9.1/static/app-pg-ctl.html

I hope that helps move your troubleshooting forward. Please let us know the outcome of these troubleshooting steps so we can better support you and other users in the future.

Sincerely,
Tara T
Linode Support Team

Hi,

Thank you Tara for your reply, I checked those links and the 2nd one looks really similar to what we are going through. However I couldn't find any entry for an "apt-get upgrade". But I found that the service was trying to execute using shell "dash" instead of "bash" (causing the ugly message because dash it's more basic than bash) so I did change the first line to #!/bin/bash and then another error appeared

"/var/lib/pgsql/data is missing. Use "service postgresql initdb" to initialize the cluster first."

Taking a closer look I found something:

on Apr 4th 2018 there was a change in the symlink file called:
/etc/init.d/postgresql Now it's pointing to --> /usr/local/apps/pgsql/bin/postgresqlctl

And this folder /usr/local/apps/pgsql/bin/ belongs to PGVERSION=9.3.4 version. I've installed 9.1 from the beginning using the "PostgreSQL powered by Webuzo" profile that Linode setup offered me.

I was able to find my previous Conf folder for 9.1 --> /usr/lib/postgresql/9.1/bin however after trying to start the DB using this command "su postgres -c '/usr/lib/postgresql/9.1/bin/pg_ctl start -D /etc/postgresql/9.1/main/ -l /var/log/postgresql/hoy.log'" it's throwing this message in log file :

FATAL: could not create lock file "/var/run/postgresql/.s.PGSQL.5432.lock": No such file or directory

I think I need to reinstall postgresql 9.1 and its service, however I'm afraid to delete previous information, by any chance do you know where I can locate the complete folder for the DB in 9.1? So I can create a copy just in case? Or how can I reinstall just the service for PostgreSQL 9.1 leaving untouch the data?

Thank you

Hi everyone

I got my PostgreSQL 9.1 DB up and running again. I had to do the following:

1- Change symlink

ln -sfn /usr/lib/postgresql/9.1/bin/postgresqlctl9.1 postgresql

2- Create a script for initialize DB I called it postgresqlctl9.1

3- Upload Script to /usr/lib/postgresql/9.1/bin/, make sure it has 755 permission.

4- Create a folder for PID and change Owner and permissions

mkdir /var/run/postgresql
chown postgres:postgres /var/run/postgresql

5- Start service

sudo service postgresql start

My website it's up and running with all my data. Thanks @Ttaylor for everything

I will post the script I used, I found it here [https://blog.2ndquadrant.com/creating-a-postgresql-service-on-ubuntu/].

However I'm concern about the logging configuration… before it was rolling daily, but now it is not.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct