Search Postgresql Archives

Re: Service not starting on Ubuntu 15.04

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Adrian,

Thanks. I know about the systemd change, and indeed the postgres package I end up with _has_ systemd integration already:

$ cat /etc/systemd/system/multi-user.target.wants/postgresql.service
# systemd service for managing all PostgreSQL clusters on the system. This
# service is actually a systemd target, but we are using a service since
# targets cannot be reloaded.

[Unit]
Description=PostgreSQL RDBMS

[Service]
Type=oneshot
ExecStart=/bin/true
ExecReload=/bin/true
RemainAfterExit=on

[Install]
WantedBy=multi-user.target


Here are the contents of bootstrap.log; notice I added some checks and waits. As you can see, service stop and start has effect in that calls to status seem to say the service has started and stopped. However, it clearly never starts. Interestingly, the same exact calls to service stop and start _after_ cloud-init has finished will give me a running postgres service.

+ apt-get install --quiet --quiet postgresql
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (This frontend requires a controlling tty.)
debconf: falling back to frontend: Teletype
dpkg-preconfigure: unable to re-open stdin: 
Selecting previously unselected package libpq5:amd64.
(Reading database ... 53521 files and directories currently installed.)
Preparing to unpack .../libpq5_9.4.5-0ubuntu0.15.04_amd64.deb ...
Unpacking libpq5:amd64 (9.4.5-0ubuntu0.15.04) ...
Selecting previously unselected package postgresql-client-common.
Preparing to unpack .../postgresql-client-common_166bzr2_all.deb ...
Unpacking postgresql-client-common (166bzr2) ...
Selecting previously unselected package postgresql-client-9.4.
Preparing to unpack .../postgresql-client-9.4_9.4.5-0ubuntu0.15.04_amd64.deb ...
Unpacking postgresql-client-9.4 (9.4.5-0ubuntu0.15.04) ...
Selecting previously unselected package ssl-cert.
Preparing to unpack .../ssl-cert_1.0.35_all.deb ...
Unpacking ssl-cert (1.0.35) ...
Selecting previously unselected package postgresql-common.
Preparing to unpack .../postgresql-common_166bzr2_all.deb ...
Adding 'diversion of /usr/bin/pg_config to /usr/bin/pg_config.libpq-dev by postgresql-common'
Unpacking postgresql-common (166bzr2) ...
Selecting previously unselected package postgresql-9.4.
Preparing to unpack .../postgresql-9.4_9.4.5-0ubuntu0.15.04_amd64.deb ...
Unpacking postgresql-9.4 (9.4.5-0ubuntu0.15.04) ...
Selecting previously unselected package postgresql.
Preparing to unpack .../postgresql_9.4+166bzr2_all.deb ...
Unpacking postgresql (9.4+166bzr2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Processing triggers for systemd (219-7ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up libpq5:amd64 (9.4.5-0ubuntu0.15.04) ...
Setting up postgresql-client-common (166bzr2) ...
Setting up postgresql-client-9.4 (9.4.5-0ubuntu0.15.04) ...
update-alternatives: using /usr/share/postgresql/9.4/man/man1/psql.1.gz to provide /usr/share/man/man1/psql.1.gz (psql.1.gz) in auto mode
Setting up ssl-cert (1.0.35) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Setting up postgresql-common (166bzr2) ...
debconf: unable to initialize frontend: Dialog
debconf: (TERM is not set, so the dialog frontend is not usable.)
debconf: falling back to frontend: Readline
Adding user postgres to group ssl-cert

Creating config file /etc/postgresql-common/createcluster.conf with new version

Creating config file /etc/logrotate.d/postgresql-common with new version
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
Setting up postgresql-9.4 (9.4.5-0ubuntu0.15.04) ...
Creating new cluster 9.4/main ...
  config /etc/postgresql/9.4/main
  data   /var/lib/postgresql/9.4/main
  locale en_US.UTF-8
Flags of /var/lib/postgresql/9.4/main set as -------------e-C
  port   5432
update-alternatives: using /usr/share/postgresql/9.4/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
Setting up postgresql (9.4+166bzr2) ...
Processing triggers for libc-bin (2.21-0ubuntu4) ...
Processing triggers for systemd (219-7ubuntu6) ...
Processing triggers for ureadahead (0.100.0-19) ...
+ service postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2015-10-26 10:57:51 UTC; 3s ago
 Main PID: 7481 (code=exited, status=0/SUCCESS)

Oct 26 10:57:51 ip-10-103-210-147 systemd[1]: Starting PostgreSQL RDBMS...
Oct 26 10:57:51 ip-10-103-210-147 systemd[1]: Started PostgreSQL RDBMS.
Oct 26 10:57:54 ip-10-103-210-147 systemd[1]: Started PostgreSQL RDBMS.
+ sleep 10
+ service postgresql stop
+ service postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Mon 2015-10-26 10:58:05 UTC; 5ms ago
 Main PID: 7481 (code=exited, status=0/SUCCESS)

Oct 26 10:57:51 ip-10-103-210-147 systemd[1]: Starting PostgreSQL RDBMS...
Oct 26 10:57:51 ip-10-103-210-147 systemd[1]: Started PostgreSQL RDBMS.
Oct 26 10:57:54 ip-10-103-210-147 systemd[1]: Started PostgreSQL RDBMS.
Oct 26 10:58:05 ip-10-103-210-147 systemd[1]: Stopped PostgreSQL RDBMS.
Oct 26 10:58:05 ip-10-103-210-147 systemd[1]: Stopping PostgreSQL RDBMS...
+ true
+ sleep 10
+ service postgresql start
+ service postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2015-10-26 10:58:15 UTC; 6ms ago
  Process: 7726 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 7726 (code=exited, status=0/SUCCESS)

Oct 26 10:58:15 ip-10-103-210-147 systemd[1]: Starting PostgreSQL RDBMS...
Oct 26 10:58:15 ip-10-103-210-147 systemd[1]: Started PostgreSQL RDBMS.
+ sleep 10
+ service postgresql status
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Mon 2015-10-26 10:58:15 UTC; 10s ago
  Process: 7726 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 7726 (code=exited, status=0/SUCCESS)

Oct 26 10:58:15 ip-10-103-210-147 systemd[1]: Starting PostgreSQL RDBMS...
Oct 26 10:58:15 ip-10-103-210-147 systemd[1]: Started PostgreSQL RDBMS.
+ pstree
systemd-+-accounts-daemon-+-{gdbus}
        |                 `-{gmain}
        |-2*[agetty]
        |-atd
        |-cloud-init-+-part-001-+-part-001---tee
        |            |          `-pstree
        |            `-sh---tee
        |-cron
        |-dbus-daemon
        |-dhclient
        |-irqbalance
        |-polkitd-+-{gdbus}
        |         `-{gmain}
        |-rsyslogd-+-{in:imklog}
        |          |-{in:imuxsock}
        |          `-{rs:main Q:Reg}
        |-sshd---sshd---bash---tail
        |-sshd
        |-systemd---(sd-pam)
        |-systemd-journal
        |-systemd-logind
        |-systemd-timesyn---{sd-resolve}
        `-systemd-udevd
+ sudo -u postgres psql -c 'CREATE USER teamcity WITH PASSWORD '\''teamcity'\'';'
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


On Mon, Oct 26, 2015 at 1:42 PM, Adrian Klaver <adrian.klaver@xxxxxxxxxxx> wrote:
On 10/26/2015 04:21 AM, Lasse Westh-Nielsen wrote:
Hey,

I posted to stackoverflow about my problem upgrading from Ubuntu 14.04
to Ubuntu 15.04:
http://stackoverflow.com/questions/33306475/ubuntu-15-04-postgresql-doesnt-start

Pretty sure it is no coincidence that the 14.04 --> 15.04 upgrade changes the init process from Upstart to systemd. Might want to take a look at this article:

http://linux.softpedia.com/blog/Ubuntu-15-04-Users-Can-Switch-Off-Systemd-and-Use-Upstart-479373.shtml

and this:

https://wiki.ubuntu.com/SystemdForUpstartUsers



Tl;dr: postgresql service does not start properly when installed as a
package using cloud-init.

What does the /var/log/bootstrap.log show?



And I can't figure out if I am doing something wrong, if the AMI is no
good, if the package has problems, ... I reckon I cannot be the first
person to use Postgres on Ubuntu Vivid, but I have been hammering my
head against the wall with this for hours.

Any help greatly appreciated!

Regards,

Lasse




--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux