Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3ZLf-0006KD-An for pgsql-general@arkaria.postgresql.org; Sun, 24 Jan 2021 06:58:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l3ZLd-0003x9-Nu for pgsql-general@arkaria.postgresql.org; Sun, 24 Jan 2021 06:58:09 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3ZLd-0003x2-A5 for pgsql-general@lists.postgresql.org; Sun, 24 Jan 2021 06:58:09 +0000 Received: from susanne.redcor.ch ([178.63.103.72]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l3ZLa-0004wu-Gg for pgsql-general@postgresql.org; Sun, 24 Jan 2021 06:58:08 +0000 Received: from [192.168.0.43] (84-72-41-4.dclient.hispeed.ch [84.72.41.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: robert@redo2oo.ch) by susanne.redcor.ch (Postfix) with ESMTPSA id 5A623A050A; Sun, 24 Jan 2021 07:58:02 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=redo2oo.ch; s=201908; t=1611471483; bh=FlI/YHAj/2JQB+OC5wJf15Jyx6WXddvlSLw0xdAiUU4=; h=Subject:To:References:From:Date:In-Reply-To:From; b=qYt9x1GtGBBcfjT6xtzxiNSbCAGUmEdBH1O95hRTG869I6kr2twVE9K2DyeXLSQbD mTgWoYuL2scx6SnCMSkGMxPo6QrwcGMldx4zAS4WlpRFSUYSfSpmdeTj++Gw1yWLR5 nqd22ydE8L5xRmzpKkuiXrNeUnf6o8dn5oK6K+wkdshxkxYzWPgPdXeUiTNFUDfs92 u37up1GoNGXZ62stGntIMZSigKSy4WTD0jJqhFiygH+f2qqbMPO1c4XetKv05kznHW RF9ZhLFVDXuA3VrVbpWKFkZ0n7Q5LMAjGaqxZ7qtdbPhEIQ9JfDOpk0+Ivv/3SAKK7 Tt05YFA8kLETQ== Subject: Re: ubuntu 18: PostgreSQL does not start. how can I totally remove and reinstall it To: robert rottermann , "pgsql-general@postgresql.org" References: <82dcf27f-2399-412c-30e9-c9b6d03f62c9@redcor.ch> <90b62d7f-1659-513a-ca25-3d803329e235@aklaver.com> From: "robert@redo2oo.ch" Message-ID: <2df6a113-10ea-2e48-accf-e0db8909a581@redo2oo.ch> Date: Sun, 24 Jan 2021 07:58:02 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <90b62d7f-1659-513a-ca25-3d803329e235@aklaver.com> Content-Type: multipart/alternative; boundary="------------8943B85ABECDF437AA61CA78" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------8943B85ABECDF437AA61CA78 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Thanks Adrian On 23.01.21 21:45, Adrian Klaver wrote: > On 1/23/21 12:36 PM, robert rottermann wrote: >> Hi there >> >> I made somehow a mess with my PostgreSQL installation an an ubuntu 18.4 with >> PostgreSQL 10.0 >> >> service postgresql status >> ● postgresql.service - PostgreSQL RDBMS >>     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor >> preset: enabled) >>     Active: active (exited) since Sat 2021-01-23 21:21:13 CET; 2min 26s ago >>    Process: 1853 ExecStart=/bin/true (code=exited, status=0/SUCCESS) >>   Main PID: 1853 (code=exited, status=0/SUCCESS) > > What if you try: > > sudo service postgresql@10-main status > > Also  what does: > > pg_lsclusters > > show? root@elfero-test:~/scripts# pg_lsclusters Ver Cluster Port Status Owner    Data directory              Log file 10  main    5433 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log root@elfero-test:~/scripts# service postgresql@10-main status ● postgresql@10-main.service - PostgreSQL Cluster 10-main    Loaded: loaded (/lib/systemd/system/postgresql@.service; indirect; vendor preset: enabled)    Active: active (running) since Sat 2021-01-23 22:11:40 CET; 9h ago   Process: 1348 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code=exited, status=0/SUCCESS)  Main PID: 1460 (postgres)     Tasks: 7 (limit: 4543)    CGroup: /system.slice/system-postgresql.slice/postgresql@10-main.service            ├─1460 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf            ├─1471 postgres: 10/main: checkpointer process            ├─1472 postgres: 10/main: writer process            ├─1473 postgres: 10/main: wal writer process            ├─1474 postgres: 10/main: autovacuum launcher process            ├─1475 postgres: 10/main: stats collector process            └─1476 postgres: 10/main: bgworker: logical replication launcher Jan 23 22:11:38 elfero-test systemd[1]: Starting PostgreSQL Cluster 10-main... Jan 23 22:11:40 elfero-test systemd[1]: Started PostgreSQL Cluster 10-main. Now I can also run psql. (why I could not before, I do not know ..) BUT still I can not access the db from python. even a simple python script like: importpsycopg2 conn = psycopg2.connect(host="localhost", user="postgres", database="postgres") Produces: root@elfero-test:~/scripts# python test_elfero.py Traceback (most recent call last):   File "test_elfero.py", line 2, in     conn = psycopg2.connect(host="localhost", user="postgres", database="postgres")   File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect     conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError: could not connect to server: Connection refused     Is the server running on host "localhost" (127.0.0.1) and accepting     TCP/IP connections on port 5432? Any help is much appreciated Robert --------------8943B85ABECDF437AA61CA78 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
Thanks Adrian

On 23.01.21 21:45, Adrian Klaver wrote:
On 1/23/21 12:36 PM, robert rottermann wrote:
Hi there

I made somehow a mess with my PostgreSQL installation an an ubuntu 18.4 with PostgreSQL 10.0

service postgresql status
● postgresql.service - PostgreSQL RDBMS
    Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
    Active: active (exited) since Sat 2021-01-23 21:21:13 CET; 2min 26s ago
   Process: 1853 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
  Main PID: 1853 (code=exited, status=0/SUCCESS)

What if you try:

sudo service postgresql@10-main status

Also  what does:

pg_lsclusters

show?
root@elfero-test:~/scripts# pg_lsclusters
Ver Cluster Port Status Owner    Data directory              Log file
10  main    5433 online postgres /var/lib/postgresql/10/main /var/log/postgresql/postgresql-10-main.log
root@elfero-test:~/scripts# service postgresql@10-main status
● postgresql@10-main.service - PostgreSQL Cluster 10-main
   Loaded: loaded (/lib/systemd/system/postgresql@.service; indirect; vendor preset: enabled)
   Active: active (running) since Sat 2021-01-23 22:11:40 CET; 9h ago
  Process: 1348 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 10-main start (code=exited, status=0/SUCCESS)
 Main PID: 1460 (postgres)
    Tasks: 7 (limit: 4543)
   CGroup: /system.slice/system-postgresql.slice/postgresql@10-main.service
           ├─1460 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf
           ├─1471 postgres: 10/main: checkpointer process  
           ├─1472 postgres: 10/main: writer process  
           ├─1473 postgres: 10/main: wal writer process  
           ├─1474 postgres: 10/main: autovacuum launcher process  
           ├─1475 postgres: 10/main: stats collector process  
           └─1476 postgres: 10/main: bgworker: logical replication launcher  

Jan 23 22:11:38 elfero-test systemd[1]: Starting PostgreSQL Cluster 10-main...

Jan 23 22:11:40 elfero-test systemd[1]: Started PostgreSQL Cluster 10-main.


Now I can also run psql. (why I could not before, I do not know ..)
BUT still I can not access the db from python.
even a simple python script like:

import psycopg2
conn = psycopg2.connect(host="localhost", user="postgres", database="postgres")

Produces:

root@elfero-test:~/scripts# python test_elfero.py
Traceback (most recent call last):
  File "test_elfero.py", line 2, in <module>
    conn = psycopg2.connect(host="localhost", user="postgres", database="postgres")
  File "/usr/lib/python2.7/dist-packages/psycopg2/__init__.py", line 130, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: could not connect to server: Connection refused
    Is the server running on host "localhost" (127.0.0.1) and accepting
    TCP/IP connections on port 5432?


Any help is much appreciated

Robert

--------------8943B85ABECDF437AA61CA78--