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 1kdaiC-0007ve-KC for pgsql-general@arkaria.postgresql.org; Fri, 13 Nov 2020 15:10:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kdaiB-0001si-EU for pgsql-general@arkaria.postgresql.org; Fri, 13 Nov 2020 15:10:03 +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 1kdaiB-0001og-6Z for pgsql-general@lists.postgresql.org; Fri, 13 Nov 2020 15:10:03 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdai6-0001oT-SN for pgsql-general@lists.postgresql.org; Fri, 13 Nov 2020 15:10:02 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 98C345C01FC; Fri, 13 Nov 2020 10:09:56 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 13 Nov 2020 10:09:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=c MoZEgCV+mQ2TQq2Q9cU7UQFHuAnLdKnIoei7iK8ibQ=; b=c/UBoT1DVKDj1fOwV oB4jGP3Ee5FpswljWMlG2lmqFf3plk0oWZ2QFJq3/1umrdhfNPuJ3ODX+VVU+czm bUElscG3EaZaHyrjup6RrwfhyYMWfu4zXpWyCXeAm/mbdItTkzaeO33hkJ7dtIt7 QqNV7d4g0RseaCNK8nnB5PlS9V7CLVtDCKN/i1k5wm48n/AwJuUjs/dUBOZnYaSR sI4omDkiH/3OWHZfIrM7ptd6XcBtOQHg7Q0cwKRyjZqrg4gzMXuCNGlRin+zwUl2 ybHurgKHBMfcXMNgUVjypVa+rqGH5JglYqWBo4kptdiTSqYKyftb+984t2melc0t BNjpw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=cMoZEgCV+mQ2TQq2Q9cU7UQFHuAnLdKnIoei7iK8i bQ=; b=hGHgP5yBzo2FnuMRfKR+IKDHiigaT5A73YcQ0LJgc0+DP3Qwnk3atoh8s JctwqBtngud9ibP/Ms7Yy7hfUNumtYU1EJZ6sOoZoqdqI7ECfwqeAwCIX8XfBppb gSKVN2E4maMKOj9on6hv3QrKkBDVILzGtodCsi6ed+HbGLv067ZImSN3hSkd0W5p ksSys1mEFt1RoO80MsZLfLJvFhm3D5prNx91mYmzdbC6oe+6+syPiE7TXIF9HfgZ 0vyNnRMYWp+g5v69cK6JhwjHaVAeFN1qOlakxwJ4TeZKN91U0U4uS+ytBUo43+cq bZmOncv3H4M0LyDnDl6n0sJfiaZpw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvhedgjedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeevveefveefueegffekkefhgeeiueffgfetueejvdfg hfeujeejhfekjeelgedtgeenucfkphepjeehrddujedvrdduledrudefleenucevlhhush htvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhl rghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: from [192.168.1.4] (75-172-19-139.tukw.qwest.net [75.172.19.139]) by mail.messagingengine.com (Postfix) with ESMTPA id C4065328005A; Fri, 13 Nov 2020 10:09:55 -0500 (EST) Subject: Re: Issue upgrading from 9.5 to 13 with pg_upgrade: "connection to database failed: FATAL: database "template1" does not exist" To: Jeremy Wilson Cc: pgsql-general@lists.postgresql.org References: <793E4164-90E9-41F0-B74C-129E1DB76408@clover.co> From: Adrian Klaver Message-ID: <5d5bd3f7-8158-97fa-9d6e-064af852f5ec@aklaver.com> Date: Fri, 13 Nov 2020 07:09:55 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 In-Reply-To: <793E4164-90E9-41F0-B74C-129E1DB76408@clover.co> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 11/13/20 7:02 AM, Jeremy Wilson wrote: > > >> On Nov 13, 2020, at 9:58 AM, Adrian Klaver wrote: >> >> To me it seems the initdb for the 13 instance did not complete successfully. Have you tried clearing /var/lib/pgsql/13/data and doing the init over again? If you do try it monitor the output carefully. > > here’s the complete process: > > bash-4.4$ /usr/pgsql-13/bin/initdb -D /var/lib/pgsql/13/data/ --locale=en_US.UTF-8 > The files belonging to this database system will be owned by user "postgres". > This user must also own the server process. > > The database cluster will be initialized with locale "en_US.UTF-8". > The default database encoding has accordingly been set to "UTF8". > The default text search configuration will be set to "english". > > Data page checksums are disabled. > > fixing permissions on existing directory /var/lib/pgsql/13/data ... ok > creating subdirectories ... ok > selecting dynamic shared memory implementation ... posix > selecting default max_connections ... 100 > selecting default shared_buffers ... 128MB > selecting default time zone ... America/Toronto > creating configuration files ... ok > running bootstrap script ... ok > performing post-bootstrap initialization ... ok > syncing data to disk ... ok > > initdb: warning: enabling "trust" authentication for local connections > You can change this by editing pg_hba.conf or using the option -A, or > --auth-local and --auth-host, the next time you run initdb. > > Success. You can now start the database server using: > > /usr/pgsql-13/bin/pg_ctl -D /var/lib/pgsql/13/data/ -l logfile start > > bash-4.4$ /usr/pgsql-13/bin/pg_ctl -D /var/lib/pgsql/13/data/ -l logfile start > waiting for server to start.... done > server started > bash-4.4$ psql postgres > psql (13.0) > Type "help" for help. > > postgres=# \c template1 > You are now connected to database "template1" as user "postgres". > template1=# \q Well that blows the initdb theory out of the water. > bash-4.4$ /usr/pgsql-13/bin/pg_ctl -D /var/lib/pgsql/13/data/ -l logfile stop > waiting for server to shut down.... done > server stopped > bash-4.4$ /usr/pgsql-13/bin/pg_upgrade --old-bindir /usr/pgsql-9.5/bin --new-bindir /usr/pgsql-13/bin --old-datadir /var/lib/pgsql/9.5/data --new-datadir /var/lib/pgsql/13/data --old-port=54320 --new-port=5432 In your previous post you had --socketdir=/var/run/postgresql/. Did you change that or is it missing? > > connection to database failed: FATAL: database "template1" does not exist > > could not connect to target postmaster started with the command: > "/usr/pgsql-13/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/pgsql/13/data" -o "-p 5432 -b -c synchronous_commit=off -c fsync=off -c full_page_writes=off -c vacuum_defer_cleanup_age=0 -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/pgsql'" start Where is Postgres putting its sockets? > Failure, exiting > -- Adrian Klaver adrian.klaver@aklaver.com