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 1kg3X9-0004ik-4e for pgsql-general@arkaria.postgresql.org; Fri, 20 Nov 2020 10:20:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kg3X8-0004ke-3i for pgsql-general@arkaria.postgresql.org; Fri, 20 Nov 2020 10:20:50 +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 1kg3X7-0004kW-RE for pgsql-general@lists.postgresql.org; Fri, 20 Nov 2020 10:20:49 +0000 Received: from gaia.bitwizard.nl ([149.210.166.240]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kg3X3-0005fq-Tn for pgsql-general@lists.postgresql.org; Fri, 20 Nov 2020 10:20:47 +0000 Received: from abra2.bitwizard.nl (unknown [10.8.0.6]) by gaia.bitwizard.nl (Postfix) with ESMTPS id 619485A0044 for ; Fri, 20 Nov 2020 11:20:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bitwizard.nl; s=default; t=1605867643; bh=C4GwEi1Nb+64LgMHHIXN+faXCwIdqTQyWNi75a9IkIU=; h=Date:From:To:Subject:From; b=AP9sT3jYUi2Fp7eE2Og1Xd3jF2/WuvClhMJRY4qs4EZLjObyhaT62swgcESsy6Ewn KVAbdvVMdDjE9ykY73DQVbefyADtFDFqWtw85+iwnwgvBdv2LstARmtq2NgwUKW7nY gYKjHfSNiq9vTsDHh0x35L0OMjqWiqEg+Gf72GvCzLaB6RdgYhctvVYZx+Kl8sMCGG m2dRI7hkJi97RJ3VPZpbzAKWlYcqUgcyD2McGdixHdXnkkVQTbQ+iVU+BEaCaSm1SC 2SG7dE+TdhH68BMiCJtzFLoS+XWRi9lgk+2Mv9wXvq5wEcHZj7WFH9F7c6YUj5CLVL p7sa9Pl5mdiIg== Received: by abra2.bitwizard.nl (Postfix, from userid 1000) id 3797EE42612; Fri, 20 Nov 2020 11:20:43 +0100 (CET) Date: Fri, 20 Nov 2020 11:20:43 +0100 From: Roger Wolff To: pgsql-general@lists.postgresql.org Subject: Recovering old installation. Message-ID: <20201120102042.fhhljrtiiyh5qsqo@BitWizard.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, I have a little problem here... I had a hardware failure. Replaced the power supply and then the system wouldn't boot. I eventually bought a new computer, new SSD for a root/boot disk. Did a fresh install then moved over the storage drives and went on my merry way.... Now... it seems after an earlier migration I had fogotten to move the postgresql backup to the new postgresql installation. So now I have my database in version 9.5 in /oldroot/.... somewhere and a new instance of psql (Version 12) is running in the freshly installed instance. My plan-of-attack is to simply chroot to /oldroot, start the old 9.5 server run a psqldump and un-dump into the new server (have to figure out how, but should be documented) But the problem is: how do I start the server in the old root? All searches for "chroot postgresql" turn up people who, for security reasons, want to run postgresql inside a chroot environment. All searches for "start postgresql" tell me to simply type "service postgresql start". Great on a normal system, but not here: abra2:/etc# service postgresql start * Starting PostgreSQL 9.5 database server * The PostgreSQL server failed to start. Please check the log output: 2020-11-20 10:54:59 CET [2080825-1] FATAL: could not open shared memory segment "/PostgreSQL.1552904327": Function not implemented [fail] abra2:/etc# journalctl No journal files were found. -- No entries -- OK. One step further. Monted (bind) /dev onto /oldroot/dev and now the message chages to "permission denied" as opposed to "function not implemented". One of the things I'd like to do is to start the server manually. In /lib/systemd/system I find postgresql@.service that says: # systemd service template for PostgreSQL clusters. The actual instances will # be called "postgresql@version-cluster", e.g. "postgresql@9.3-main". The # variable %i expands to "version-cluster", %I expands to "version/cluster". # (%I breaks for cluster names containing dashes.) and: ExecStart=@/usr/bin/pg_ctlcluster postgresql@%i --skip-systemctl-redirect %i start So, I figured out that my cluster is called "main" and my version is 9.5. So now I expect that commandline to expand to: /usr/bin/pg_ctlcluster postgresql@9.5-main --skip-systemctl-redirect 9.5-main start And when I try that I get: Error: specified cluster does not exist Now that error message is less useful than it could be. I don't know if the postgresql@9.5-main or the 9.5-main is what it considers the "specified cluster". Anyway, I tried a few variations but can't get it to recognize the "specified cluster". abra2:/lib/systemd/system# pg_lsclusters Ver Cluster Port Status Owner Data directory Log file 9.5 main 5432 down postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log abra2:/lib/systemd/system# Simplifying the commandline to: /usr/bin/pg_ctlcluster 9.5-main start it seems to do something... but then again: FATAL: could not open shared memory segment "/PostgreSQL.964036999": Permission denied So then running strace -f to see what failed... No EPERM returns from any system call. Sigh. So... Any ideas for helping me get my server up-and-running for five minutes to run a pgdump ? Roger. -- ** R.E.Wolff@BitWizard.nl ** https://www.BitWizard.nl/ ** +31-15-2049110 ** ** Delftechpark 11 2628 XJ Delft, The Netherlands. KVK: 27239233 ** f equals m times a. When your f is steady, and your m is going down your a is going up. -- Chris Hadfield about flying up the space shuttle.