Can't import backup file - dbeaver

Linux Mint 20.1
DBaver 22.1.4
I try to restore PostgreSQL from backup file.
But I get error:
/run/user/1000/doc/65139af1/bin/pg_restore --verbose --host=localhost --port=5432 --username=myUserName --format=c --dbname=myDB/home/alex/postgresql.backup
Task 'PostgreSQL restore' started at Thu Dec 15 14:49:01 EET 2022
/run/user/1000/doc/65139af1/bin/pg_restore: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
Task 'PostgreSQL restore' finished at Thu Dec 15 14:49:01 EET 2022
2022-12-15 14:49:01.945 - IO error: Process failed (exit code = 127). See error log.
2022-12-15 14:49:01.947 - java.io.IOException: Process failed (exit code = 127). See error log.
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.validateErrorCode(AbstractNativeToolHandler.java:242)
at org.jkiss.dbeaver.ext.postgresql.tasks.PostgreDatabaseRestoreHandler.validateErrorCode(PostgreDatabaseRestoreHandler.java:151)
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.executeProcess(AbstractNativeToolHandler.java:223)
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.doExecute(AbstractNativeToolHandler.java:262)
at org.jkiss.dbeaver.tasks.nativetool.AbstractNativeToolHandler.lambda$0(AbstractNativeToolHandler.java:83)
at org.jkiss.dbeaver.runtime.RunnableContextDelegate.lambda$0(RunnableContextDelegate.java:39)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

check library libpq.so.5 it is installed or not, check use command in your terminal
ldconfig -p | grep libpq.so.5
if installed, you will see
try this :

Related

Could not deploy React app from Visual studio Code to azure App service

I am trying to deploy a simple React app to Azure App Service from Visual Studio Code using AzureAppService extension. However it was failed with the error: Couldn't detect a version for the platform 'nodejs' in the repo. the node version on both local machine and Azure Web App is 16.
Any idea please?
9:10:47 pm spa1234: Command: oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 16 -p virtualenv_name= --log-file /tmp/build-debug.log -i /tmp/8dab4f80016b776 -p compress_node_modules=tar-gz | tee /tmp/oryx-build.log
9:10:53 pm spa1234: Operation performed by Microsoft Oryx, https://github.com/Microsoft/Oryx
9:10:53 pm spa1234: You can report issues at https://github.com/Microsoft/Oryx/issues
9:10:53 pm spa1234: Oryx Version: 0.2.20220812.1, Commit: cdf6b1b, ReleaseTagName: 20220812.1
9:10:53 pm spa1234: Build Operation ID: |75RCaacLtWg=.52a37c81_
9:10:53 pm spa1234: Repository Commit : 745ee158-98c2-4cb4-8cba-c067ab33681a
9:10:53 pm spa1234: Detecting platforms...
9:10:53 pm spa1234: Could not detect any platform in the source directory.
9:10:53 pm spa1234: Error: Couldn't detect a version for the platform 'nodejs' in the repo.
9:10:56 pm spa1234: /bin/bash -c "oryx build /tmp/zipdeploy/extracted -o /home/site/wwwroot --platform nodejs --platform-version 16 -p virtualenv_name= --log-file /tmp/build-debug.log -i /tmp/8dab4f80016b776 -p compress_node_modules=tar-gz | tee /tmp/oryx-build.log ; exit $PIPESTATUS "
9:10:56 pm spa1234: Generating summary of Oryx build
9:10:56 pm spa1234: Parsing the build logs
9:10:56 pm spa1234: Found 0 issue(s)
9:10:56 pm spa1234: Build Summary :
Suggestion here is to make the SCM_DO_BUILD_DURING_DEPLOYMENT= FALSE it should work.

HowTo: Completely Uninstall Postgresql14 from MacOs Catalina If I've used the EnterpriseDB.com GUI installer

I've been trying to get this to work by following the answers in these questions:
How to uninstall postgresql on my Mac (running Snow Leopard)
Completely uninstall PostgreSQL 9.0.4 from Mac OSX Lion?
...but they're not working. So, here's what I have tried instead/in addition...
.
me#myMac:~$ cd /Library/PostgreSQL/14
me#myMac:/Library/PostgreSQL/14$ ./uninstall-postgresql.app/
-bash: ./uninstall-postgresql.app/: is a directory
me#myMac:/Library/PostgreSQL/14$ open ./uninstall-postgresql.app/
LSOpenURLsWithRole() failed with error -10810 for the file /Library/PostgreSQL/14/uninstall-postgresql.app.
me#myMac:/Library/PostgreSQL/14$ open -a ./uninstall-postgresql.app/
Unable to find application named './uninstall-postgresql.app/'
me#myMac:/Library/PostgreSQL/14$ open -a uninstall-postgresql.app/
Unable to find application named 'uninstall-postgresql.app/'
me#myMac:/Library/PostgreSQL/14$ sudo open uninstall-postgresql.app/
Password:
LSOpenURLsWithRole() failed with error -10810 for the file /Library/PostgreSQL/14/uninstall-postgresql.app.
me#myMac:/Library/PostgreSQL/14$ cd /Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS/
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ install
install install_name_tool installvst
install-info installer
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ installer
Usage: installer [-help] [-dominfo] [-volinfo] [-pkginfo] [-allowUntrusted] [-dumplog]
[-verbose | -verboseR] [-vers] [-config] [-plist]
[-file <pathToFile>] [-lang <ISOLanguageCode>] [-listiso]
[-showChoicesXML] [-applyChoiceChangesXML <pathToFile>]
[-showChoicesAfterApplyingChangesXML <pathtoFile>]
-pkg <pathToPackage>
-target <[DomainKey|MountPoint]>
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ installbuilder.sh
-bash: installbuilder.sh: command not found
SINCE I couldn't run/find installbuilder.sh using the following command...
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ installbuilder.sh
-bash: installbuilder.sh: command not found
...as the other answers in my OP suggest, I went on to try the steps below:
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ls -la
total 3112
drwxr-xr-x 5 root daemon 160 Sep 23 10:48 ./
drwxr-xr-x 5 root daemon 160 Sep 23 09:18 ../
-rwxr-xr-x 1 root daemon 673 Sep 23 10:48 installbuilder.sh*
-rwxr-xr-x 1 root daemon 1449456 Sep 23 10:07 osx-x86_64*
-rwxr-xr-x 1 root daemon 135216 Jul 14 11:21 uninstall-postgresql*
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./installbuilder.sh
Unable to initialize installer
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./uninstall-postgresql
Usage: ./uninstall-postgresql installerName [args ...]
me#myMac:/Library/PostgreSQL/14/uninstall-postgresql.app/Contents/MacOS$ ./uninstall-postgresql osx-x86_64
and VOILA!!!
This launched the uninstall GUI
Choose UNINSTALL ALL / REMOVE ENTIRE INSTALLATION
The uninstaller will do its thing and then prompt you with this:
At this point you'll want to follow the steps provided in this PREVIOUS StackOverflow ANSWER - steps 3 through 6 of #user1181328's answer. I'll list them here for convenience:
Remove the PostgreSQL and data folders. The Wizard will notify you that these were not removed.
sudo rm -rf /Library/PostgreSQL
Remove the ini file:
sudo rm /etc/postgres-reg.ini
Remove the PostgreSQL user:
using System Preferences -> Users & Groups.
Unlock the settings panel by clicking on the padlock and entering your password.
Select the PostgreSQL user and click on the minus button.
Restore your shared memory settings:
sudo rm /etc/sysctl.conf
That should be all! The uninstall wizard would have removed all icons and start-up applications files so you don't have to worry about those.

Automatic creation of replication slot not working on Barman 2.11?

I am using barman 2.11 and postgres 9.5 in my setup. I specified "create_slot = auto" in the server config for automatic replication slot creation as mentioned in the docs but it unfortunately appears to have no effect & the barman check reports the issue as below,
My server config:
[postgres-source-db]
; Configuration options for the server named 'postgres-source-db'
description = "Config for PostgreSQL Database Backup via rsync/SSH with WAL streaming"
ssh_command = ssh -q postgres#postgres-source-db
conninfo = host=postgres-source-db user=barman dbname=dcmdb
backup_method = rsync
parallel_jobs = 1
reuse_backup = link
archiver = on
backup_options = exclusive_backup
streaming_conninfo = host=postgres-source-db user=barman
streaming_archiver = on
slot_name = barman
create_slot = auto
===
Barman check output:
barman#4f5c93878899:~$ barman check postgres-source-db
Server postgres-source-db:
WAL archive: FAILED (please make sure WAL shipping is setup)
PostgreSQL: OK
superuser or standard user with backup privileges: OK
PostgreSQL streaming: OK
wal_level: OK
replication slot: FAILED (replication slot 'barman' doesn't exist. Please execute 'barman receive-wal --create-slot postgres-source-db')
directories: OK
retention policy settings: OK
backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
ssh: OK (PostgreSQL server)
not in recovery: OK
systemid coherence: OK (no system Id stored on disk)
pg_receivexlog: OK
pg_receivexlog compatible: OK
receive-wal running: FAILED (See the Barman log file for more details)
archive_mode: OK
archive_command: OK
archiver errors: OK
barman#4f5c93878899:~$
I should note that the test check succeeds as shown below,
barman#4f5c93878899:~$ psql -U barman -h postgres-source-db -c "IDENTIFY_SYSTEM" replication=1
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
systemid | timeline | xlogpos | dbname
---------------------+----------+-----------+--------
6854705426793291833 | 1 | 0/3000AE0 |
(1 row)
barman#4f5c93878899:~$
Am i missing something?
UPDATE (made partial headway, but still not out of the woods):
One more update & info to add. I am setting this up on docker containers & notice that the cron setup was missing despite my installing this from the PostgreSQL apt-repository. Once i logged into the container & ran
'/usr/bin/barman -q cron'
to start the WAL receiver i see that the status has changed to success. Not sure why it did not run automatically, any clue?
Doesn't look like a permission issue but the syntax of the content in '/etc/cron.d/barman' seems strange to me,
barman#bef22f0beec3:~$ cat /etc/cron.d/barman
# /etc/cron.d/barman: crontab entries for the barman package
MAILTO=root
* * * * * barman [ -x /usr/bin/barman ] && /usr/bin/barman -q cron
barman#bef22f0beec3:~$
Below are the terminal outputs,
barman#4f5c93878899:~$ crontab -l
no crontab for barman
barman#4f5c93878899:~$ su root
Password:
root#4f5c93878899:/var/lib/barman# crontab -l
no crontab for root
root#4f5c93878899:/var/lib/barman# exit
exit
barman#4f5c93878899:~$ id
uid=102(barman) gid=103(barman) groups=103(barman)
barman#4f5c93878899:~$ pwd
/var/lib/barman
barman#4f5c93878899:~$ cat /etc/cron.d/barman
# /etc/cron.d/barman: crontab entries for the barman package
MAILTO=root
* * * * * barman [ -x /usr/bin/barman ] && /usr/bin/barman -q cron
barman#4f5c93878899:~$ ls -ltr /etc/cron.d/barman
-rw-r--r-- 1 root root 140 Jul 9 11:18 /etc/cron.d/barman
barman#4f5c93878899:~$ /usr/bin/barman -q cron
barman#4f5c93878899:~$ ps -aef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 05:00 ? 00:00:00 /bin/bash /docker-entrypoint.sh barman
root 24 1 0 05:00 ? 00:00:00 /usr/sbin/sshd -D
root 27 24 0 05:03 ? 00:00:00 sshd: barman [priv]
barman 33 27 0 05:03 ? 00:00:00 sshd: barman#pts/0
barman 34 33 0 05:03 pts/0 00:00:00 -bash
barman 107 1 4 05:18 ? 00:00:00 /usr/bin/python3 /usr/bin/barman -c /etc/barman.conf -q receive-wal postgres-source-db
barman 111 107 1 05:18 ? 00:00:00 /usr/lib/postgresql/12/bin/pg_receivewal --dbname=dbname=replication host=postgres-source-db options=-cdatestyle=iso replication=true user=barman application_name
barman 114 34 0 05:18 pts/0 00:00:00 ps -aef
barman#4f5c93878899:~$
barman#4f5c93878899:~$ barman check postgres-source-db
Server postgres-source-db:
PostgreSQL: OK
superuser or standard user with backup privileges: OK
PostgreSQL streaming: OK
wal_level: OK
replication slot: OK
directories: OK
retention policy settings: OK
backup maximum age: FAILED (interval provided: 1 day, latest backup age: No available backups)
compression settings: OK
failed backups: OK (there are 0 failed backups)
minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
ssh: OK (PostgreSQL server)
not in recovery: OK
systemid coherence: OK (no system Id stored on disk)
pg_receivexlog: OK
pg_receivexlog compatible: OK
receive-wal running: OK
archive_mode: OK
archive_command: OK
continuous archiving: OK
archiver errors: OK
barman#4f5c93878899:~$
Thanks
Just for others that might be facing the same issue, i resolved it.
The problem appears to be due to two bugs in barman (i see it on Debian, not sure of others),
The cron.d entry (/etc/cron.d/barman) is missing a new line at the end & it turns out that is needed for cron to execute them at-least on Debian.
The cron was not started automatically by default & i had to start it from my entry point script.
With the above two fixed it works like a charm.

Dockerfile RUN command not working

I am trying to create IBM WAS image from my local binary but it is not working . i used the dockerfile and added below command but getting error :
Dockerfile:
FROM centos:centos6
RUN yum update -y
RUN "/docker/software/im/installc -acceptLicense -accessRights nonAdmin \
-installationDirectory /docker/IBM/InstallationManager -dataLocation /docker/var/ibm/InstallationManager -showProgress"
Error:
---> Running in 206e970b75c8 /bin/sh: /docker/software/im/installc -acceptLicense -accessRights nonAdmin -installationDirectory /docker/IBM/InstallationManager -dataLocation
/docker/var/ibm/InstallationManager -showProgress: No such file or
directory The command '/bin/sh -c "/docker/software/im/installc
-acceptLicense -accessRights nonAdmin -installationDirectory /docker/IBM/InstallationManager -dataLocation
/docker/var/ibm/InstallationManager -showProgress"' returned a
non-zero code: 127
Docker is trying to run installc from within the image. The image centos:centos6 image does not contain IBM Installation Manager.
I recommend taking a look at the WebSphere traditional Docker images published by IBM to Docker hub. If you wish to create something slightly different for example use centos instead of ubuntu then take a look at the instructions for building WebSphere traditional Docker images, they are Apache licensed so you are free to adapt them.
Docker build error :
/bin/sh: /tmp/im/installc: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
The command '/bin/sh -c unzip -qd /tmp/im /tmp/agent.installer.linux.gtk.x86_1.8.0.20140902_1503.zip && /tmp/im/installc -acceptLicense -show Progress -installationDirectory /usr/lib/im -dataLocation /var/im && rm -rf /tmp/agent.installer.linux.gtk.x86_1.8.0.20140902_1503.zip /tmp/i m' returned a non-zero code: 126
Linux version : AWS linux 3.10.0-514.10.2.el7.x86_64 #1 SMP Mon Feb 20 02:37:52 EST 2017 x86_64 x86_64 x86_64 GNU/Linux

Error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory

I am trying to execute pg_dump on PostgreSQL 9.0.4 server running on Debian and I am getting the error below:
./pg_dump: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
libpq.so.5 is a link to libpq.so.5.3 as shown below
lrwxrwxrwx 1 root root 12 Jun 27 16:24 libpq.so.5 -> libpq.so.5.3
-rwxr-xr-x 1 root root 180749 Jun 21 02:43 libpq.so.5.3
What is it that I am doing wrong?
Try this:
1: Know the path of libpq.so.5
find / -name libpq.so.5
Output example:
/usr/pgsql-9.4/lib/libpq.so.5
If found nothing, check if you have already installed the suitable postgresql-libs for your postgresql version and your OS platform
2: Symbolic link that library in a "well known" library path like /usr/lib:
ln -s /usr/pgsql-9.4/lib/libpq.so.5 /usr/lib/libpq.so.5
Attention:
If your platform is 64 bit, you MUST also symbolic link to 64 bit libraries path:
ln -s /usr/pgsql-9.4/lib/libpq.so.5 /usr/lib64/libpq.so.5
3: Be happy !
In which directory are these libpq files? You can try setting environment variable LD_LIBRARY_PATH to point to this directory or make sure it's in standard place.
Also, why isn't the libpq.so.5 link shown in the "as shown below" section? Maybe you should just run ldconfig?
Ubuntu 21.10+
Since this is the top search result for the error. I'll add an updated answer. I received the error when trying to start a django server.
I hadn't installed the postgres stuff.
Try:
sudo apt install libpq-dev
See:
https://packages.ubuntu.com/impish/libpq-dev
I was getting the same error message on Postgres 9.5 on RHEL 6.5 which lead me to this post. But a find for the file libpq.so.5 returned nothing, which made things more confusing.
In the end the following symbolic links made it run
ln -s /opt/rh/rh-postgresql95/root/usr/lib64/libpq.so.rh-postgresql95-5 /usr/lib64/libpq.so.rh-postgresql95-5
ln -s /opt/rh/rh-postgresql95/root/usr/lib64/libpq.so.rh-postgresql95-5 /usr/lib/libpq.so.rh-postgresql95-5
These paths are for RHEL, use find / -name libpq.so to location your installation and add it to the same destination folders /usr/lib/ and /usr/lib64/ using the orginal file name.
The root cause appears that the installation did not place this file into a shared location.
This error probably occurs because of $LD_LIBRARY_PATH environment variable is not set.
When you install your application from source code using prefix (./configure --prefix=/some/path), you have to inform where your lib/ path is. I just found a solution for this, and I added this variable to postgres user init bash script:
printf 'export PATH=$PATH:/opt/apl/pgsql/bin\nexport LD_LIBRARY_PATH=/opt/apl/pgsql/lib:$LD_LIBRARY_PATH\n' > /etc/profile.d/postgres.sh
redhat 7 is missing few steps after installing yum install pgadmin4:
sudo ln -s /usr/lib64/pgdg-libpq5/lib/libpq.so /usr/lib64/libpq.so.5
sudo ln -s /usr/lib64/pgdg-libpq5/lib/libpq.so /usr/lib/libpq.so.5
sudo chown -R apache:apache /var/lib/pgadmin4/
then you can run
sudo python3 /usr/lib/python3.6/site-packages/pgadmin4-web/setup.py
and if all successful:
systemctl start httpd
systemctl status httpd
apachectl configtest
and make sure the httpd starts ok
I had exactly the same problem with the pg 9.6 install. I fixed it like this. Rather irritating that the installer doesn't factor this in.
***********post yum install & running initdb *********
Success. You can now start the database server using:
/opt/rh/rh-postgresql96/root/usr/bin/pg_ctl -D /var/opt/rh/rh-postgresql96/lib/pgsql/data -l logfile start
-bash-4.2$ /opt/rh/rh-postgresql96/root/usr/bin/pg_ctl -D /var/opt/rh/rh-postgresql96/lib/pgsql/data -l logfile start
/opt/rh/rh-postgresql96/root/usr/bin/pg_ctl: **error while loading shared libraries: libpq.so.rh-postgresql96-5: cannot open shared object file: No such file or directory**
-bash-4.2$ id
uid=26(postgres) gid=26(postgres) groups=26(postgres) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
**************
-bash-4.2$ cat LibFix
ln -s /opt/rh/rh-postgresql96/root/usr/lib64/libpq.so.rh-postgresql96-5 /usr/lib64/libpq.so.rh-postgresql96-5
ln -s /opt/rh/rh-postgresql96/root/usr/lib64/libpq.so.rh-postgresql96-5 /usr/lib/libpq.so.rh-postgresql96-5
**************
[root#****lab ~]# ln -s /opt/rh/rh-postgresql96/root/usr/lib64/libpq.so.rh-postgresql96-5 /usr/lib64/libpq.so.rh-postgresql96-5
[root#****lab ~]# ln -s /opt/rh/rh-postgresql96/root/usr/lib64/libpq.so.rh-postgresql96-5 /usr/lib/libpq.so.rh-postgresql96-5
[root#****lab ~]# su - postgres
Last login: Thu Apr 5 08:57:21 CEST 2018 on pts/0
-bash-4.2$ /opt/rh/rh-postgresql96/root/usr/bin/pg_ctl -D /var/opt/rh/rh-postgresql96/lib/pgsql/data -l logfile start
server starting
-bash-4.2$ ps -ef | grep postgres
root 12778 7883 0 09:07 pts/0 00:00:00 su - postgres
postgres 12779 12778 0 09:07 pts/0 00:00:00 -bash
postgres 12802 1 0 09:08 pts/0 00:00:00 /opt/rh/rh-postgresql96/root/usr/bin/postgres -D /var/opt/rh/rh-postgresql96/lib/pgsql/data
postgres 12803 12802 0 09:08 ? 00:00:00 postgres: logger process
postgres 12805 12802 0 09:08 ? 00:00:00 postgres: checkpointer process
postgres 12806 12802 0 09:08 ? 00:00:00 postgres: writer process
postgres 12807 12802 0 09:08 ? 00:00:00 postgres: wal writer process
postgres 12808 12802 0 09:08 ? 00:00:00 postgres: autovacuum launcher process
postgres 12809 12802 0 09:08 ? 00:00:00 postgres: stats collector process
postgres 12810 12779 0 09:08 pts/0 00:00:00 ps -ef
-bash-4.2$ id
uid=26(postgres) gid=26(postgres) groups=26(postgres) context=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
-bash-4.2$ psql
psql (9.6.5)
postgres=# \conninfo
You are connected to database "postgres" as user "postgres" via socket in "/var/run/postgresql" at port "5432".