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 1kdaWj-0007TU-L8 for pgsql-general@arkaria.postgresql.org; Fri, 13 Nov 2020 14:58:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kdaWh-0006Zx-Oi for pgsql-general@arkaria.postgresql.org; Fri, 13 Nov 2020 14:58:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdaWg-0006Zq-9O for pgsql-general@lists.postgresql.org; Fri, 13 Nov 2020 14:58:11 +0000 Received: from out4-smtp.messagingengine.com ([66.111.4.28]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kdaWc-0005Aa-PD for pgsql-general@lists.postgresql.org; Fri, 13 Nov 2020 14:58:09 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 67E3A5C01D6; Fri, 13 Nov 2020 09:58:04 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Fri, 13 Nov 2020 09:58:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=x +/vdRVukz/XFbDLBhg/Svdlt5PqN+9b+Zm65UIuCDg=; b=lElyaePaUKChk3yRr D1CrUT2nBbx3IFtabSd18snfvpk2cjqrRFGKebNnPivDzDY2VfMEyp/IPD/UB7TT YfIsQvwy/xc6Re1cfwDov64xvz7yAfmKQ1q7jh5IpbOhMFJj2TXFdmkFPYgfTjkb 0Hb4P2JK9v8fwPi27csLYh3BAl+raAr4phYxJdREN3928j3o4zJk0uArblz0RO3n ksYqcGPbstWVH//bns1qYI/9ypUSS6zSdss1JFs6ZvsQR5YKhHpyDNFJFnj5lMeP +FaNdkSq++dPQYQ29mZdH/CNf838uvysuoFlgfKJ0uLND2Woha2Ej5bf524A3r+z tkt+A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=x+/vdRVukz/XFbDLBhg/Svdlt5PqN+9b+Zm65UIuC Dg=; b=g86K1tzEfMIDT9J9CPjSgzzpC2Vr/MwO9xdeH0J7a8wpEskqsy/2YqaKc QIkiJFIkZeGjhEhrZ6EvSOmtHcCta52NyLMOvO/7373obZs8sGIYOTIvfVcdW4gM HsnMCg8jKFhmD8llCJfwUMLynhei0L9gGP1QMJQaA8fGTa3+8j9lJZQx0H73XaHU MQ2FEGeEzPLmzh5QXLbPVa8N3B4SGJGomZJtPNeL91HyFFqNl5n9rUjIpegvOOcJ SZJc8g4dsDBnjbJtnIZCEABVjJFvP3FaK4aQkuDyD+JTEIaE+estT6ySKGwmiA3S GZn0WJjdOn4YkYw+5sq0leHQLlDfA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedruddvhedgjedtucetufdoteggodetrfdotf 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 90C6F3280067; Fri, 13 Nov 2020 09:58:03 -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 , pgsql-general@lists.postgresql.org References: From: Adrian Klaver Message-ID: Date: Fri, 13 Nov 2020 06:58:02 -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: 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 6:32 AM, Jeremy Wilson wrote: > I’m running CentOS 8 on an EC2 instance and attempting to upgrade a 9.5 database to 13 using pg_upgrade. Both are running on the same box and pass initial tests but it fails during the later part of the process. > > --- > > 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 --socketdir=/var/run/postgresql/ > Performing Consistency Checks > ----------------------------- > Checking cluster versions ok > Checking database user is the install user ok > Checking database connection settings ok > Checking for prepared transactions ok > Checking for reg* data types in user tables ok > Checking for contrib/isn with bigint-passing mismatch ok > Checking for tables WITH OIDS ok > Checking for invalid "sql_identifier" user columns ok > Checking for invalid "unknown" user columns ok > Checking for roles starting with "pg_" ok > Creating dump of global objects ok > Creating dump of database schemas > ok > > 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/run/postgresql'" start > Failure, exiting > > --- > > When I manually run that command it works, although when I attempt to connect to the ‘postgres’ database on it, it complains it doesn’t exist. 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. > > I can’t use the dump/restore method to upgrade this server as the data in question is fairly massive and in my testing it took 45 hours to complete. Any help appreciated. > > > > -- Adrian Klaver adrian.klaver@aklaver.com