WAL-E: Cannot restart postgresql after backup-fetch - postgresql

This is on Ubuntu 14.04 LTS
EDIT:
WAL-E installed using pip, with secret keys managed by envdir, according to the instructions https://gist.github.com/elithrar/8682235 and https://github.com/wal-e/wal-e#dependencies.
I am trying to restore a database using WAL-E, and everything appears to go well initially, as I have Postgres installed and running, and can easily create or restore a database and access it locally and remotely via pgadmin. Where it goes bad is when I try to perform a restore from an S3 backup using wal-e fetch-backup. It appears to go well up until the point of starting the postgres.
There are a number of errors that come up, appearing to be either missing packages or permissions issues, like the following:
* Starting PostgreSQL 9.3 database server
* The PostgreSQL server failed to start. Please check the log output:
2015-07-11 00:41:11 EDT LOG: database system was interrupted; last known up at 2015-06-30 05:00:02 EDT
2015-07-11 00:41:11 EDT LOG: starting archive recovery
Traceback (most recent call last):
File "/usr/local/bin/wal-e", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3084, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3070, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 651, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 952, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 847, in resolve
new_requirements = dist.requires(req.extras)[::-1]
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2602, in requires
dm = self._dep_map
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2803, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2825, in _compute_dependencies
for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2794, in _parsed_pkg_info
metadata = self.get_metadata(self.PKG_INFO)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1617, in get_metadata
return self._get(self._fn(self.egg_info, name))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1728, in _get
with open(path, 'rb') as stream:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/six-1.9.0.dist-info/METADATA'
2015-07-11 00:41:11 EDT LOG: invalid checkpoint record
2015-07-11 00:41:11 EDT FATAL: could not locate required checkpoint record
2015-07-11 00:41:11 EDT HINT: If you are not restoring from a backup, try removing the file "/var/lib/postgresql/9.3/main/backup_label".
2015-07-11 00:41:11 EDT LOG: startup process (PID 1693) exited with exit code 1
2015-07-11 00:41:11 EDT LOG: aborting startup due to startup process failure
I had several of these and was able to resolve them by changing the group and modifying the permissions on the noted files to match others in the directory, but I suspect the problem has more to do with how and/or where these packages were installed. After resolving the above issue, postgres still fails to start up, returning the following:
* Starting PostgreSQL 9.3 database server
* The PostgreSQL server failed to start. Please check the log output:
2015-07-11 00:30:04 EDT LOG: database system was interrupted; last known up at 2015-06-30 05:00:02 EDT
2015-07-11 00:30:04 EDT LOG: starting archive recovery
Traceback (most recent call last):
File "/usr/local/bin/wal-e", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3084, in <module>
#_call_aside
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3070, in _call_aside
f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3097, in _initialize_master_working_set
working_set = WorkingSet._build_master()
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 651, in _build_master
ws.require(__requires__)
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 952, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 839, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'wal-e==0.8.1' distribution was not found and is required by the application
2015-07-11 00:30:04 EDT LOG: invalid checkpoint record
2015-07-11 00:30:04 EDT FATAL: could not locate required checkpoint record
2015-07-11 00:30:04 EDT HINT: If you are not restoring from a backup, try removing the file "/var/lib/postgresql/9.3/main/backup_label".
2015-07-11 00:30:04 EDT LOG: startup process (PID 1495) exited with exit code 1
2015-07-11 00:30:04 EDT LOG: aborting startup due to startup process failure
It is complaining about the 'wal-e==0.8.1' distribution was not found..., but it is clearly installed and executable:
ls -l /usr/local/lib/python2.7/dist-packages
total 608
drwxr-sr-x 2 root staff 4096 Jul 10 20:14 argparse-1.3.0.dist-info
-rw-r--r-- 1 root staff 88400 Jul 10 20:14 argparse.py
-rw-r--r-- 1 root staff 65659 Jul 10 20:14 argparse.pyc
drwxr-sr-x 6 root staff 4096 Jul 9 22:36 azure
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 azure-0.11.1.egg-info
drwxr-sr-x 5 root staff 4096 Jul 9 22:36 babel
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 Babel-1.3.egg-info
drwxr-sr-x 57 root staff 4096 Jul 9 22:36 boto
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 boto-2.38.0.dist-info
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 concurrent
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 dateutil
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 debtcollector
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 debtcollector-0.5.0.dist-info
-rw-r--r-- 1 root staff 207 Jul 10 20:10 easy-install.pth
-rw-r--r-- 1 root staff 126 Jul 10 20:33 easy_install.py
-rw-r--r-- 1 root staff 315 Jul 10 20:33 easy_install.pyc
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 futures-3.0.3.dist-info
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 gevent
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 gevent-1.0.2.egg-info
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 greenlet-0.4.7.egg-info
-rwxr-xr-x 1 root staff 82869 Jul 9 22:36 greenlet.so
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 iso8601
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 iso8601-0.1.10.egg-info
drwxr-sr-x 15 root staff 4096 Jul 9 22:36 keystoneclient
drwxr-sr-x 2 root staff 4096 Jul 10 20:33 _markerlib
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 msgpack
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 msgpack_python-0.4.6.egg-info
drwxr-sr-x 5 root staff 4096 Jul 9 22:36 netaddr
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 netaddr-0.7.15.dist-info
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 netifaces-0.10.4.egg-info
-rwxr-xr-x 1 root staff 58386 Jul 9 22:36 netifaces.so
drwxr-sr-x 4 root staff 4096 Jul 9 22:36 oslo
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 oslo_config
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 oslo.config-1.14.0.dist-info
-rw-r--r-- 1 root root 299 Jul 9 22:35 oslo.config-1.14.0-py2.7-nspkg.pth
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 oslo_i18n
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 oslo.i18n-2.1.0.dist-info
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 oslo_serialization
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 oslo.serialization-1.7.0.dist-info
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 oslo_utils
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 oslo.utils-1.8.0.dist-info
-rw-r--r-- 1 root root 299 Jul 9 22:35 oslo.utils-1.8.0-py2.7-nspkg.pth
drwxr-sr-x 5 root staff 4096 Jul 10 20:14 pbr
drwxr-sr-x 2 root staff 4096 Jul 10 20:14 pbr-1.3.0.dist-info
drwxr-sr-x 4 root staff 4096 Jul 10 20:10 pip-7.1.0-py2.7.egg
drwxr-sr-x 3 root staff 4096 Jul 10 20:33 pkg_resources
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 python_dateutil-2.4.2.dist-info
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 python_keystoneclient-1.6.0.dist-info
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 python_swiftclient-2.4.0.dist-info
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 pytz
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 pytz-2015.4.dist-info
drwxr-sr-- 3 root staff 4096 Jul 9 23:25 requests
drwxr-sr-- 2 root staff 4096 Jul 9 23:25 requests-2.7.0.dist-info
drwxr-sr-x 3 root staff 4096 Jul 10 20:33 setuptools
drwxr-sr-x 2 root staff 4096 Jul 10 20:33 setuptools-18.0.1.dist-info
drwxr-sr-x 3 root staff 4096 Jul 9 22:36 simplejson
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 simplejson-3.7.3.egg-info
drwxr-sr-- 2 root staff 4096 Jul 9 23:26 six-1.9.0.dist-info
-rw-r--r-- 1 root root 29664 Jul 9 23:26 six.py
-rw-r--r-- 1 root root 29006 Jul 9 23:26 six.pyc
drwxr-sr-x 4 root staff 4096 Jul 9 22:36 stevedore
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 stevedore-1.6.0.dist-info
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 swiftclient
drwxr-sr-x 7 root staff 4096 Jul 9 22:35 wal_e
drwxr-sr-x 2 root staff 4096 Jul 9 22:35 wal_e-0.8.1.egg-info
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 wrapt
drwxr-sr-x 2 root staff 4096 Jul 9 22:36 wrapt-1.10.5.egg-info
I have done quite a bit of searching, but haven't found anything that helps. Any suggestions or points in the right direction are appreciated.
Additionally, it would be of great interest to solve this to ensure that my primary installation will behave in the event that a restoration is necessary. Backing up is pointless if I can't restore it.

I am not entirely sure what resolved the The 'wal-e==0.8.1' distribution was not found errro, but on rebooting I never saw that again.
Aside from that, fixing this was rather straightforward.
The executable bit on a number of python distributions was not set.
Chowning these fixed the error:
chmod o+x /usr/local/lib/python2.7/dist-packages/requests-2.7.0.dist-info/
chmod o+x /usr/local/lib/python2.7/dist-packages/requests
...

Reason backup_label is not created properly
Run the below command in your Master
su postgres
psql -c "select pg_start_backup('initial_backup');"
rsync -cva --inplace --exclude=pg_xlog
/var/lib/postgresql/9.1/main/
slave_IP_address:/var/lib/postgresql/9.1/main/
psql -c "select pg_stop_backup();"
cd /var/lib/postgresql/9.1/main
create file name recovery.conf add the below lines
standby_mode = 'on'
primary_conninfo = 'host=master_IP_address
port=5432 user=rep password=yourpassword' trigger_file =
'/tmp/postgresql.trigger.5432'
service postgresql restart

Related

Linux - RHEL 8.3 - Unable to start PostgreSQL 13 service - Cannot open shared object library

Trying to setup PostgreSQL 13 on RHEL 8.3 Linux Server. Attempting to start the service after following the installation steps outlined in the PostgreSQL documentation including the initdb I get the below output when running journalctl -xe after trying systemctl start postgresql-13:
-- Subject: Unit postgresql-13.service has begun start-up
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit postgresql-13.service has begun starting up.
Mar 19 23:53:11 host.local postmaster[485386]: 2021-03-19 23:53:11.209 AWST [485386] FATAL: could not load library "/usr/pgsql-13/lib/timescaledb.so": /usr/pgsql-13/lib/timescaledb.so: cannot open shared object file: Operation not permitted
Mar 19 23:53:11 host.local postmaster[485386]: 2021-03-19 23:53:11.209 AWST [485386] LOG: database system is shut down
Mar 19 23:53:11 host.local systemd[1]: postgresql-13.service: Main process exited, code=exited, status=1/FAILURE
Mar 19 23:53:11 host.local systemd[1]: postgresql-13.service: Failed with result 'exit-code'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- The unit postgresql-13.service has entered the 'failed' state with result 'exit-code'.
Mar 19 23:53:11 host.local systemd[1]: Failed to start PostgreSQL 13 database server.
-- Subject: Unit postgresql-13.service has failed
-- Defined-By: systemd
-- Support: https://access.redhat.com/support
--
-- Unit postgresql-13.service has failed.
--
-- The result is failed.
Digging around I thought okay, let's check my ldconfig conf files. But they correctly reference the libraries mentioned in the output. So I tried manually running ldconfig with -v to see the output.
[root#host ~]# ldconfig -n -v /usr/pgsql-13/lib
/usr/pgsql-13/lib:
libpqwalreceiver.so -> libpqwalreceiver.so
libpq.so.5 -> libpq.so.5.13
libpgtypes.so.3 -> libpgtypes.so.3.13
libecpg_compat.so.3 -> libecpg_compat.so.3.13
libecpg.so.6 -> libecpg.so.6.13
However, an ls -l /usr/pgsql-13/lib shows a much larger output of libraries, leaving me to wonder what am I missing? I have tried changing permissions within the directory but that made no change so reverted the permissions:
total 13784
-rwxr-xr-x 1 root root 20440 Feb 11 09:43 adminpack.so
-rwxr-xr-x 1 root root 36976 Feb 11 09:43 amcheck.so
-rwxr-xr-x 1 root root 7680 Feb 11 09:43 auth_delay.so
-rwxr-xr-x 1 root root 16256 Feb 11 09:43 auto_explain.so
-rwxr-xr-x 1 root root 11896 Feb 11 09:43 autoinc.so
drwxr-xr-x 2 root root 6 Feb 11 09:43 bitcode
-rwxr-xr-x 1 root root 29504 Feb 11 09:43 bloom.so
-rwxr-xr-x 1 root root 32672 Feb 11 09:43 btree_gin.so
-rwxr-xr-x 1 root root 92872 Feb 11 09:43 btree_gist.so
-rwxr-xr-x 1 root root 16128 Feb 11 09:43 citext.so
-rwxr-xr-x 1 root root 50568 Feb 11 09:43 cube.so
-rwxr-xr-x 1 root root 16088 Feb 11 09:43 cyrillic_and_mic.so
-rwxr-xr-x 1 root root 50224 Feb 11 09:43 dblink.so
-rwxr-xr-x 1 root root 11848 Feb 11 09:43 dict_int.so
-rwxr-xr-x 1 root root 497200 Feb 11 09:43 dict_snowball.so
-rwxr-xr-x 1 root root 11984 Feb 11 09:43 dict_xsyn.so
-rwxr-xr-x 1 root root 7696 Feb 11 09:43 earthdistance.so
-rwxr-xr-x 1 root root 11792 Feb 11 09:43 euc2004_sjis2004.so
-rwxr-xr-x 1 root root 7688 Feb 11 09:43 euc_cn_and_mic.so
-rwxr-xr-x 1 root root 15952 Feb 11 09:43 euc_jp_and_sjis.so
-rwxr-xr-x 1 root root 7704 Feb 11 09:43 euc_kr_and_mic.so
-rwxr-xr-x 1 root root 16512 Feb 11 09:43 euc_tw_and_big5.so
-rwxr-xr-x 1 root root 24736 Feb 11 09:43 file_fdw.so
-rwxr-xr-x 1 root root 28960 Feb 11 09:43 fuzzystrmatch.so
-rwxr-xr-x 1 root root 11680 Feb 11 09:43 hstore_plperl.so
-rwxr-xr-x 1 root root 67120 Feb 11 09:43 hstore.so
-rwxr-xr-x 1 root root 11888 Feb 11 09:43 insert_username.so
-rwxr-xr-x 1 root root 54640 Feb 11 09:43 _int.so
-rwxr-xr-x 1 root root 102720 Feb 11 09:43 isn.so
-rwxr-xr-x 1 root root 15808 Feb 11 09:43 jsonb_plperl.so
-rwxr-xr-x 1 root root 11864 Feb 11 09:43 latin2_and_win1250.so
-rwxr-xr-x 1 root root 11816 Feb 11 09:43 latin_and_mic.so
-rw-r--r-- 1 root root 727708 Feb 11 09:43 libecpg.a
-rw-r--r-- 1 root root 101788 Feb 11 09:43 libecpg_compat.a
lrwxrwxrwx 1 root root 22 Feb 11 09:43 libecpg_compat.so -> libecpg_compat.so.3.13
lrwxrwxrwx 1 root root 22 Feb 11 09:43 libecpg_compat.so.3 -> libecpg_compat.so.3.13
-rwxr-xr-x 1 root root 38320 Feb 11 09:43 libecpg_compat.so.3.13
lrwxrwxrwx 1 root root 15 Feb 11 09:43 libecpg.so -> libecpg.so.6.13
lrwxrwxrwx 1 root root 15 Feb 11 09:43 libecpg.so.6 -> libecpg.so.6.13
-rwxr-xr-x 1 root root 101288 Feb 11 09:43 libecpg.so.6.13
-rw-r--r-- 1 root root 1310988 Feb 11 09:43 libpgcommon.a
-rw-r--r-- 1 root root 1306378 Feb 11 09:43 libpgcommon_shlib.a
-rw-r--r-- 1 root root 624890 Feb 11 09:43 libpgfeutils.a
-rw-r--r-- 1 root root 702572 Feb 11 09:43 libpgport.a
-rw-r--r-- 1 root root 701762 Feb 11 09:43 libpgport_shlib.a
-rw-r--r-- 1 root root 458268 Feb 11 09:43 libpgtypes.a
lrwxrwxrwx 1 root root 18 Feb 11 09:43 libpgtypes.so -> libpgtypes.so.3.13
lrwxrwxrwx 1 root root 18 Feb 11 09:43 libpgtypes.so.3 -> libpgtypes.so.3.13
-rwxr-xr-x 1 root root 83704 Feb 11 09:43 libpgtypes.so.3.13
-rw-r--r-- 1 root root 1762742 Feb 11 09:43 libpq.a
lrwxrwxrwx 1 root root 13 Feb 11 09:43 libpq.so -> libpq.so.5.13
lrwxrwxrwx 1 root root 13 Feb 11 09:43 libpq.so.5 -> libpq.so.5.13
-rwxr-xr-x 1 root root 338992 Feb 11 09:43 libpq.so.5.13
-rwxr-xr-x 1 root root 25136 Feb 11 09:43 libpqwalreceiver.so
-rwxr-xr-x 1 root root 11832 Feb 11 09:43 lo.so
-rwxr-xr-x 1 root root 63000 Feb 11 09:43 ltree.so
-rwxr-xr-x 1 root root 11864 Feb 11 09:43 moddatetime.so
-rwxr-xr-x 1 root root 45928 Feb 11 09:43 pageinspect.so
-rwxr-xr-x 1 root root 11848 Feb 11 09:43 passwordcheck.so
-rwxr-xr-x 1 root root 11872 Feb 11 09:43 pg_buffercache.so
-rwxr-xr-x 1 root root 139552 Feb 11 09:43 pgcrypto.so
-rwxr-xr-x 1 root root 7720 Feb 11 09:43 pg_freespacemap.so
-rwxr-xr-x 1 root root 20592 Feb 11 09:43 pgoutput.so
-rwxr-xr-x 1 root root 29440 Feb 11 09:43 pg_prewarm.so
-rwxr-xr-x 1 root root 16144 Feb 11 09:43 pgrowlocks.so
-rwxr-xr-x 1 root root 45520 Feb 11 09:43 pg_stat_statements.so
-rwxr-xr-x 1 root root 29264 Feb 11 09:43 pgstattuple.so
-rwxr-xr-x 1 root root 54608 Feb 11 09:43 pg_trgm.so
-rwxr-xr-x 1 root root 20440 Feb 11 09:43 pg_visibility.so
-rwxr-xr-x 1 root root 25224 Feb 11 09:43 pgxml.so
drwxr-xr-x 4 root root 31 Mar 18 22:32 pgxs
drwxr-xr-x 2 root root 86 Mar 18 22:32 pkgconfig
-rwxr-xr-x 1 root root 200640 Feb 11 09:43 plpgsql.so
-rwxr-xr-x 1 root root 113888 Feb 11 09:43 postgres_fdw.so
-rwxr-xr-x 1 root root 20224 Feb 11 09:43 refint.so
-rwxr-xr-x 1 root root 38008 Feb 11 09:43 seg.so
-rwxr-xr-x 1 root root 71264 Feb 11 09:43 sepgsql.so
-rwxr-xr-x 1 root root 20528 Feb 11 09:43 sslinfo.so
-rwxr-xr-x 1 root root 24536 Feb 11 09:43 tablefunc.so
-rwxr-xr-x 1 root root 11872 Feb 11 09:43 tcn.so
-rwxr-xr-x 1 root root 16264 Feb 11 09:43 test_decoding.so
-rwxr-xr-x 1 root root 618784 Mar 19 09:12 timescaledb-2.1.0.so
-rwxrwxrwx 1 root root 52520 Mar 19 10:11 timescaledb.so
-rwxr-xr-x 1 root root 605640 Mar 19 09:12 timescaledb-tsl-2.1.0.so
-rwxr-xr-x 1 root root 12000 Feb 11 09:43 tsm_system_rows.so
-rwxr-xr-x 1 root root 12008 Feb 11 09:43 tsm_system_time.so
-rwxr-xr-x 1 root root 16160 Feb 11 09:43 unaccent.so
-rwxr-xr-x 1 root root 122400 Feb 11 09:43 utf8_and_big5.so
-rwxr-xr-x 1 root root 15912 Feb 11 09:43 utf8_and_cyrillic.so
-rwxr-xr-x 1 root root 212488 Feb 11 09:43 utf8_and_euc2004.so
-rwxr-xr-x 1 root root 85536 Feb 11 09:43 utf8_and_euc_cn.so
-rwxr-xr-x 1 root root 159264 Feb 11 09:43 utf8_and_euc_jp.so
-rwxr-xr-x 1 root root 110120 Feb 11 09:43 utf8_and_euc_kr.so
-rwxr-xr-x 1 root root 208424 Feb 11 09:43 utf8_and_euc_tw.so
-rwxr-xr-x 1 root root 269888 Feb 11 09:43 utf8_and_gb18030.so
-rwxr-xr-x 1 root root 155168 Feb 11 09:43 utf8_and_gbk.so
-rwxr-xr-x 1 root root 7720 Feb 11 09:43 utf8_and_iso8859_1.so
-rwxr-xr-x 1 root root 32336 Feb 11 09:43 utf8_and_iso8859.so
-rwxr-xr-x 1 root root 171552 Feb 11 09:43 utf8_and_johab.so
-rwxr-xr-x 1 root root 134664 Feb 11 09:43 utf8_and_sjis2004.so
-rwxr-xr-x 1 root root 89632 Feb 11 09:43 utf8_and_sjis.so
-rwxr-xr-x 1 root root 175648 Feb 11 09:43 utf8_and_uhc.so
-rwxr-xr-x 1 root root 36424 Feb 11 09:43 utf8_and_win.so
-rwxr-xr-x 1 root root 20752 Feb 11 09:43 uuid-ossp.so
I'm hoping for solutions, but would even appreciate just the next direction to take so that I may hopefully find the answer. Please note I've tried re-installing PostgreSQL and doing a new initdb etc to no success.

Installing Postgresql 9.6 on AWS - EC2

I have to install a specific version of Postgresql to my AWS-EC2 instance.
I followed the tutorial :Setting up PostgreSQ.
In the past i did as per the tutorial and it worked perfectly fine. This time, since I need the 9.6 version, I twisted a bit :
$ sudo yum install postgresql96 postgresql96-server postgresql96-devel postgresql96-contrib postgresql96-docs
the installation worked fine. I am now trying to resume the setup :
sudo postgresql-setup initdb
and get the following error:
$ sudo postgresql-setup initdb
sudo: postgresql-setup: command not found
i tried the following as well just for the sake of it.
$ sudo postgresql96-setup initdb
sudo: postgresql96-setup: command not found
$ ls -ila /etc/rc.d/init.d
total 264
393352 drwxr-xr-x 2 root root 4096 Nov 5 08:25 .
393347 drwxr-xr-x 10 root root 4096 Aug 26 18:05 ..
393961 -rwxr-xr-x 1 root root 1729 Mar 27 2017 acpid
394280 -rwxr-xr-x 1 root root 2062 Aug 16 2016 atd
394415 -rwxr-xr-x 1 root root 3448 Mar 8 2017 auditd
394323 -r-xr-xr-x 1 root root 1362 Mar 30 2017 blk-availability
394399 lrwxrwxrwx 1 root root 46 Aug 26 18:05 cfn-hup -> /opt/aws/apitools/cfn-init/init/redhat/cfn-hup
393935 -rwxr-xr-x 1 root root 5160 Feb 28 2014 cgconfig
393936 -rwxr-xr-x 1 root root 3580 Feb 28 2014 cgred
394243 -rwxr-xr-x 1 root root 3782 Oct 4 2018 cloud-config
394244 -rwxr-xr-x 1 root root 3763 Oct 4 2018 cloud-final
394245 -rwxr-xr-x 1 root root 3855 Oct 4 2018 cloud-init
394246 -rwxr-xr-x 1 root root 3840 Oct 4 2018 cloud-init-local
394058 -rwxr-xr-x 1 root root 2826 Sep 28 2016 crond
393819 -rw-r--r-- 1 root root 25651 Aug 17 2017 functions
393820 -rwxr-xr-x 1 root root 6037 Aug 17 2017 halt
394186 -rwxr-xr-x 1 root root 1395 Dec 13 2017 hibagent
394131 -rwxr-xr-x 1 root root 2267 Nov 12 2018 hibinit-agent
393401 -rwxr-xr-x 1 root root 8563 Sep 27 2013 ip6tables
393402 -rwxr-xr-x 1 root root 8468 Sep 27 2013 iptables
394156 -rwxr-xr-x 1 root root 1955 Oct 29 2018 irqbalance
393821 -rwxr-xr-x 1 root root 652 Jan 18 2017 killall
394324 -r-xr-xr-x 1 root root 2137 Mar 30 2017 lvm2-lvmetad
394325 -r-xr-xr-x 1 root root 2274 Mar 30 2017 lvm2-lvmpolld
394326 -r-xr-xr-x 1 root root 3045 Mar 30 2017 lvm2-monitor
394211 -rwxr-xr-x 1 root root 2904 Sep 18 2014 mdmonitor
394195 -rwxr-xr-x 1 root root 2200 Jul 2 17:59 messagebus
393822 -rwxr-xr-x 1 root root 4334 Jan 18 2017 netconsole
393823 -rwxr-xr-x 1 root root 5309 Jan 18 2017 netfs
393824 -rwxr-xr-x 1 root root 6742 Aug 17 2017 network
394003 -rwxr-xr-x 1 root root 6703 Oct 8 2015 nfs
394074 -rwxr-xr-x 1 root root 3526 Oct 8 2015 nfslock
394152 -rwxr-xr-x 1 root root 1926 May 3 2019 ntpd
393919 -rwxr-xr-x 1 root root 2049 May 3 2019 ntpdate
394548 -rwxr-xr-x 1 root root 7949 Dec 4 2018 postgresql96
394426 -rwxr-xr-x 1 root root 1556 Sep 10 2014 psacct
393778 -rwxr-xr-x 1 root root 2034 Sep 27 2013 quota_nld
393748 -rwxr-xr-x 1 root root 1515 May 17 2016 rdisc
394296 -rwxr-xr-x 1 root root 1816 Aug 17 2017 rngd
393273 -rwxr-xr-x 1 root root 2073 May 9 2018 rpcbind
394082 -rwxr-xr-x 1 root root 2518 Oct 8 2015 rpcgssd
394084 -rwxr-xr-x 1 root root 2305 Oct 8 2015 rpcidmapd
394087 -rwxr-xr-x 1 root root 2464 Oct 8 2015 rpcsvcgssd
393972 -rwxr-xr-x 1 root root 2011 Nov 11 2014 rsyslog
393643 -rwxr-xr-x 1 root root 2056 Sep 10 2014 saslauthd
394014 -rwxr-xr-x 1 root root 3702 Aug 17 2016 sendmail
393825 -rwxr-xr-x 1 root root 647 Jan 18 2017 single
394647 -rwxr-xr-x 1 root root 4180 Oct 23 23:47 sshd
393639 -rwxr-xr-x 1 root root 1642 Mar 19 2014 udev-post
Chances are high that Amazon Linux doesn't fit well with PostgreSQL 9.6 or need extra undocumented custom installation steps.
To install a specific version of services like PostgreSQL, the easiest way and probably the new standard is using Docker (and docker-compose).
So, (almost) whatever the Linux distribution you are using:
sudo yum install docker then sudo service docker start (The extensive doc for Amazon Linux or other Linux distributions)
Then install docker-compose
Find an example of a docker-compose.yml file for PostgreSQL, there are many. Just make sure your image parameter is set to image: "postgres:9.6"
docker-compose up and you should be all set

Why do I see different files in Visual Studio Code terminal and Linux terminal?

I noticed that a lot of commands were missing when using VSCode terminal. So I tried a ls -l / on both my distro's and VSCode's terminals.
Linux Mint Xfce Terminal:
livy#linux-mint:~$ ls -l /
total 2097252
drwxr-xr-x 2 root root 4096 Aug 13 15:13 bin
drwxr-xr-x 4 root root 4096 Aug 13 15:15 boot
drwxr-xr-x 2 root root 4096 Aug 13 15:06 cdrom
drwxr-xr-x 20 root root 4260 Aug 15 08:40 dev
drwxr-xr-x 147 root root 12288 Aug 13 16:46 etc
drwxr-xr-x 4 root root 4096 Aug 13 15:06 home
lrwxrwxrwx 1 root root 33 Aug 13 15:07 initrd.img -> boot/initrd.img-4.15.0-54-generic
lrwxrwxrwx 1 root root 33 Aug 13 15:04 initrd.img.old -> boot/initrd.img-4.15.0-54-generic
drwxr-xr-x 23 root root 4096 Aug 13 15:07 lib
drwxr-xr-x 2 root root 4096 Jul 29 19:15 lib64
drwx------ 2 root root 16384 Aug 13 14:59 lost+found
drwxr-xr-x 2 root root 4096 Jul 29 19:14 media
drwxr-xr-x 2 root root 4096 Jul 29 19:14 mnt
drwxr-xr-x 3 root root 4096 Aug 13 15:18 opt
dr-xr-xr-x 214 root root 0 Aug 15 08:40 proc
drwx------ 4 root root 4096 Aug 13 15:07 root
drwxr-xr-x 32 root root 940 Aug 15 08:41 run
drwxr-xr-x 2 root root 12288 Aug 13 15:14 sbin
drwxr-xr-x 2 root root 4096 Jul 29 19:14 srv
-rw------- 1 root root 2147483648 Aug 15 08:40 swapfile
dr-xr-xr-x 13 root root 0 Aug 15 09:31 sys
drwxrwxrwt 15 root root 4096 Aug 15 08:53 tmp
drwxr-xr-x 11 root root 4096 Jul 29 19:14 usr
drwxr-xr-x 11 root root 4096 Jul 29 19:50 var
lrwxrwxrwx 1 root root 30 Aug 13 15:07 vmlinuz -> boot/vmlinuz-4.15.0-54-generic
And here is the result from VSCode terminal:
livy#linux-mint:~$ ls -l /
total 2097204
drwxr-xr-x 6 nfsnobody nfsnobody 4096 Aug 13 16:00 app
lrwxrwxrwx 1 livy livy 7 Aug 15 09:13 bin -> usr/bin
drwxr-xr-x 2 livy livy 80 Aug 15 09:13 boot
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Aug 13 15:06 cdrom
drwxr-xr-x 5 livy livy 340 Aug 15 09:13 dev
drwxr-xr-x 15 livy livy 860 Aug 15 09:13 etc
drwxr-xr-x 4 nfsnobody nfsnobody 4096 Aug 13 15:06 home
lrwxrwxrwx 1 livy livy 33 Aug 15 09:13 initrd.img -> boot/initrd.img-4.15.0-54-generic
lrwxrwxrwx 1 livy livy 33 Aug 15 09:13 initrd.img.old -> boot/initrd.img-4.15.0-54-generic
lrwxrwxrwx 1 livy livy 7 Aug 15 09:13 lib -> usr/lib
lrwxrwxrwx 1 livy livy 9 Aug 15 09:13 lib64 -> usr/lib64
drwx------ 2 nfsnobody nfsnobody 16384 Aug 13 14:59 lost+found
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jul 29 19:14 media
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jul 29 19:14 mnt
drwxr-xr-x 3 nfsnobody nfsnobody 4096 Aug 13 15:18 opt
dr-xr-xr-x 209 nfsnobody nfsnobody 0 Aug 15 09:13 proc
drwxr-xr-x 6 livy livy 160 Aug 15 09:13 run
lrwxrwxrwx 1 livy livy 8 Aug 15 09:13 sbin -> usr/sbin
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Jul 29 19:14 srv
-rw------- 1 nfsnobody nfsnobody 2147483648 Aug 15 08:40 swapfile
drwxr-xr-x 7 livy livy 140 Aug 15 09:13 sys
drwxr-xr-x 4 livy livy 80 Aug 15 09:13 tmp
drwxr-xr-x 12 nfsnobody nfsnobody 4096 Aug 13 16:00 usr
drwxr-xr-x 7 livy livy 160 Aug 15 09:13 var
lrwxrwxrwx 1 livy livy 30 Aug 15 09:13 vmlinuz -> boot/vmlinuz-4.15.0-54-generic
From the file owners, permissions, and modification date... it looks like they are working on different file systems. VSCode's /bin even points to /usr/bin, while it is not the case in Xfce terminal. The strange thing is that I can still use VSCode's terminal to navigate my home directory (/home/livy) and make changes to files. It even sources the content of my ~/.bashrc file.
What I am missing here?
I was having this exact same issue and discovered that the cause was that VSCode was installed as a Flatpak package. Uninstall it (be it a snap or a Flatpak package) and install the .deb file distributed by Microsoft.

install Ansible on Centos 6.9

i have a machine with CentOS 6.9 as OS and it is minimal. i was trying to install Ansible on my machine. i can't connect my machine to internet to set repository and install Ansible so i downloaded ansible.tar.gz. what shoud i do to install it?
the content of tar file:
drwxr-xr-x. 2 root root 4096 Mar 14 22:33 bin
drwxr-xr-x. 2 root root 4096 Mar 14 22:33 changelogs
drwxr-xr-x. 3 root root 4096 Mar 14 22:33 contrib
-rw-r--r--. 1 root root 35148 Mar 14 22:33 COPYING
drwxr-xr-x. 6 root root 4096 Mar 14 22:33 docs
drwxr-xr-x. 3 root root 4096 Mar 14 22:33 examples
drwxr-xr-x. 3 root root 4096 Mar 14 22:33 lib
drwxr-xr-x. 2 root root 4096 Mar 14 22:33 licenses
-rw-r--r--. 1 root root 13416 Mar 14 22:33 Makefile
-rw-r--r--. 1 root root 759 Mar 14 22:33 MANIFEST.in
drwxr-xr-x. 10 root root 4096 Mar 14 22:33 packaging
-rw-r--r--. 1 root root 7298 Mar 14 22:33 PKG-INFO
-rw-r--r--. 1 root root 4752 Mar 14 22:33 README.rst
-rw-r--r--. 1 root root 371 Mar 14 22:33 requirements.txt
-rw-r--r--. 1 root root 10714 Mar 14 22:33 setup.py
-rw-r--r--. 1 root root 3624 Mar 14 22:33 shippable.yml
-rw-r--r--. 1 root root 5565 Mar 14 22:33 SYMLINK_CACHE.json
drwxr-xr-x. 11 root root 4096 Mar 14 22:33 test
-rw-r--r--. 1 root root 1129 Mar 14 22:33 tox.ini
i tried to install epel then install ansible but i had no success:
rpm -ivh epel-release-6-8.noarch.rpm
Refer to ansible docs. It explained how to install by building it yourself at the end of this part.
You can also build an RPM yourself. From the root of a checkout or
tarball, use the make rpm command to build an RPM you can distribute
and install.
git clone https://github.com/ansible/ansible.git
cd ./ansible
make rpm
sudo rpm -Uvh ./rpm-build/ansible-*.noarch.rpm

Installing Mongodb "no section headers." Error

I am trying to install mongodb on Centos 6.6. I am following the steps here: https://www.liquidweb.com/kb/how-to-install-mongodb-on-centos-6/
I have added the following (where it states on the tutorial):
[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1
As you can see here:
However, when I try and install I get the following error
Where am I going wrong?
My file listing for /etc/yum.repos.d is;
4.0K drwxr-xr-x 2 root root 4.0K Jun 26 13:12 .
4.0K drwxr-xr-x 66 root root 4.0K Jun 24 14:19 ..
4.0K -rw-r--r-- 1 root root 2.0K Oct 23 2014 CentOS-Base.repo
4.0K -rw-r--r-- 1 root root 647 Oct 23 2014 CentOS-Debuginfo.repo
4.0K -rw-r--r-- 1 root root 289 Oct 23 2014 CentOS-fasttrack.repo
4.0K -rw-r--r-- 1 root root 630 Oct 23 2014 CentOS-Media.repo
8.0K -rw-r--r-- 1 root root 5.3K Oct 23 2014 CentOS-Vault.repo
4.0K -rw-r--r-- 1 root root 1.1K Jul 3 2015 city-fan.org.repo
4.0K -rw-r--r-- 1 root root 191 Jun 26 12:56 mongodb-org-3.2.repo
12K -rw------- 1 root root 12K Jun 26 12:53 .mongodb-org-3.2.repo.swp
4.0K -rw-r--r-- 1 root root 200 Jun 26 13:12 mongodb-org-3.4.repo
12K -rw------- 1 root root 12K Jun 26 12:55 .mongodb-org.repo.swp
12K -rw------- 1 root root 12K Jun 24 14:16 .mongodb.repo.swp
4.0K -rw-r--r-- 1 root root 472 Apr 26 2016 nodesource-el.repo
4.0K -rw-r--r-- 1 root root 219 Dec 18 2013 vz.repo
From your error message it would appear that at least one of your .repo files is corrupt.
The file mongodb-org-3.2.repo has an errant \n on line 2 But looking at your file listing it would appear you have several files, some of which are corrupted (hence the .swp files left behind)
You should do a full file listing with ls -lash /etc/yum.repos.d and delete all the files with 'mongo' in the name.
Then create a new file named mongodb.repo and add the following to it;
[mongodb-org-3.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
Then run yum install mongodb-org
I think the param in [mongodb] is not enough and is a lack of header information. you should specify the version as well.
for example for MongoDB v2.0, il should look like:
[mongodb-org-2.0]
name=...ect
regards