fbpx

How to Fix Pg_ctl command not found

Sometimes after a fresh PostgreSQL install if we want to start or stop from PostgreSQL rather than controlling the PostgreSQL instance start and stop from the root. And when we run the pg_ctl from the command prompt as a PostgreSQL Linux user we see the error bash: pg_ctl: command not found… 

In this article, lets learn how to fix it

As PostgreSQL check your pg base directory 

 

And now add this PostgreSQL to the Linux path so that it’s always available. I would recommand to create a postgresql env. file so that it more easy to handle rather than messing with other systems runing on linux operating system.

				
					--Step 1 
-bash-4.2$ echo $PGDATA
/var/lib/pgsql/10/data

--Step 2
-bash-4.2$ echo "PATH=/usr/pgsql-10/bin:$PATH">>~/.postgre_10.profile

--Step 3
chmod 777 .postgre_10.profile

--Step 4 
. .postgre_10.profile

--Step 5
Check pg_ctl now

-bash-4.2$ pg_ctl --version
pg_ctl (PostgreSQL) 10.17
-bash-4.2$



				
			

How to Fix Cannot open your terminal ‘/dev/pts/2’ – please check

Normally we see a common error when we switch or sudo to a user to run the screen session and it gets closes with the error ‘Cannot open your terminal ‘/dev/pts/2′ – please check’. fix it very tiny but it took a long for me to find so I thought I will share the quick fix and save our prices time.

Error:

[thedbadmin@testdb01 ~]$ screen -x 12991.screen_testCannot open your terminal ‘/dev/pts/0’ – please check.[thedbadmin@testdb01 ~]$

Step 1: logout from the user that you have logged in.

Step 2: log as your user or from where you want to run screen and just give full privileged to /dev/pts/* 

Fix : 
$ chmod 777 /dev/pts/*

 

Note: if you get any warning or error after executing the above command,  just ignore it safely.

Now you can start the screen again hopefully you won’t see that error again

Happy programming !!!

Apache Tomcat: java.net.BindException: Permission denied (Bind failed) :443

How to fix error: Apache tomcat : java.net.BindException: Permission denied (Bind failed) <null>:443

 

Full Error:

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-bio-4443"]
java.net.BindException: Permission denied (Bind failed) <null>:4443
	at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:413)
	at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:715)
	at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:452)
	at org.apache.coyote.http11.AbstractHttp11JsseProtocol.init(AbstractHttp11JsseProtocol.java:119)
	at org.apache.catalina.connector.Connector.initInternal(Connector.java:978)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	at org.apache.catalina.core.StandardService.initInternal(StandardService.java:560)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:840)
	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:642)
	at org.apache.catalina.startup.Catalina.load(Catalina.java:667)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:253)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:427)
Caused by: java.net.BindException: Permission denied (Bind failed)
	at java.net.PlainSocketImpl.socketBind(Native Method)
	at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:387)
	at java.net.ServerSocket.bind(ServerSocket.java:390)
	at java.net.ServerSocket.<init>(ServerSocket.java:252)
	at java.net.ServerSocket.<init>(ServerSocket.java:196)
	at javax.net.ssl.SSLServerSocket.<init>(SSLServerSocket.java:136)
	at sun.security.ssl.SSLServerSocketImpl.<init>(SSLServerSocketImpl.java:71)
	at sun.security.ssl.SSLServerSocketFactoryImpl.createServerSocket(SSLServerSocketFactoryImpl.java:80)
	at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(JSSESocketFactory.java:256)
	at org.apache.tomcat.util.net.JIoEndpoint.bind(JIoEndpoint.java:400)
	... 17 more

 

Why, when, and where we get this error?

 

We get this issue while starting Apache tomcat on secure port 443. The error “java.net.BindException: Permission denied (Bind failed) :443 ” is visible in /usr/share/tomcat/logs/catalina.2016-12-02.log

 

How to fix it

This error occurs when your Linux firewall levels are set to ‘enforcing‘.To fix this error make it ‘permissive

  1. Check current firewall status using the command ‘getenforce
  2. Edit the file ‘vi /etc/selinux/config’ and make it ‘permissive’ from ‘enforcing’
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #       enforcing - SELinux security policy is enforced.
    #       permissive - SELinux prints warnings instead of enforcing.
    #       disabled - No SELinux policy is loaded.
    SELINUX=permissive
    # SELINUXTYPE= can take one of these two values:
    #       targeted - Targeted processes are protected,
    #       mls - Multi Level Security protection.
    SELINUXTYPE=targeted
  3. Reboot the system using ‘reboot‘ as the root
  4. After reboot check, if tomcat is up with 443 port
    netstat -plan| grep 443
  5. And check the tomcat URL with ssl/https  (https://localhost:443)

Leave a comment if you find the article helpful.

 

Read More

How to fix ORA-28368: cannot auto-create wallet
AWS Services and their Azure alternatives 
How to Manage AWS S3 Bucket with AWS CLI

How to connect PostgreSQL Database from PgAdmin
How to create AWS rds PostgreSQL Database
Convert pem to ppk
How to Install PuTTy on Window
How to Install and create AWS EC2 Instance using Terraform
AWS MySQL RDS Database Creation using AWSCLI
How to Create MySQL Database with AWS RDS
How to connect to AWS MySQL / MariaDB RDS or EC2 database from MySQL WorkBench

 

How to fix ORA-28368: cannot auto-create wallet

How to fix ORA-28368: cannot auto-create wallet

While starting the database or configuring TDE (Transparent Data Encryption) which comes under Oracle Advance Security.  TDE is Tablespace encryption which saves the tablespace data from unauthorized access. Transparent Data Encryption only works on tablespace level not with database object level or Tables. You might have seen ora-26368:cannot auto-create wallet. There are easy fixes for this error. ORA-28368 mostly related to oracle wallet Parameter and wallet path mismatch. Oracle wallet is the option where the oracle database stores the encryption key.

 

HD wallpaper: assorted-color cards on black leather wallet, credit ...

Full error

 

SQL> startup
ORACLE instance started.

Total System Global Area 1761607680 bytes
Fixed Size 2925360 bytes
Variable Size 536874192 bytes
Database Buffers 1207959552 bytes
Redo Buffers 13848576 bytes
Database mounted.
Database opened.
SQL> alter system set encryption key identified by “oracle”;
alter system set encryption key identified by “oracle”
*
ERROR at line 1:
ORA-28368: cannot auto-create wallet

 

Solutions

1. Check the path of the wallet in sqlnet.ora path should exist.

2. Extra space in starting of  “ENCRYPTION_WALLET_LOCATION”  in sqlnet.ora

3. Wallet file ewallet.p12 or ewallet.sso have wrong permission. It should be “chmod 600 ewallet.p12

 

Read More

How to connect PostgreSQL Database from PgAdmin
How to create AWS rds PostgreSQL Database
Convert pem to ppk
How to Install PuTTy on Window
How to Install and create AWS EC2 Instance using Terraform
AWS MySQL RDS Database Creation using AWSCLI
How to Create MySQL Database with AWS RDS
How to connect to AWS MySQL / MariaDB RDS or EC2 database from MySQL WorkBench