YUM Command hangs when using root privilege - redhat

I'm trying to execute yum command in redhat 7, when I use yum without root privilege it works fine but when I use root privilege (with sudo or with root user), it hangs and take a long time without any result.
I tried to see if there is any proccess (using top command) in the same time when the command hangs so I found that in the time of launching the command, a yum process appears and after that the command continue hanging and no processes appear.
I tried yum command with basic privilege:
$ yum list installed
Result: all installed packages
I tried yum command with root privilege:
$ sudo yum list installed
Result: hangs or freeze without any result

Related

deleting files in /var/lib/postgresql/12/main while attempting to replication in postresql

I am new to postgres and was following this tutorial for setting Up Physical Streaming Replication with PostgreSQL
In step 3 while running the following command:
sudo -u postgres rm -r /var/lib/postgresql/12/main/*
I was getting the following error
rm: cannot remove '/var/lib/postgresql/12/main/*': No such file or directory
while the /var/lib/postgresql/12/main/ clearly had many files if explored manually.
In desperation, I deleted all the files inside /var/lib/postgresql/12/main/ manually and now any of the further steps are not working.
I have even tried to uninstall and install postgresql-12 using
sudo apt-get --purge remove postgresql
and
sudo apt -y install postgresql-12 postgresql-client-1 respectively
I have even tried doing the whole process again from start and while running the following command:
sudo -u postgres psql
sudo pg_ctlcluster 12 main start
I got this error:
Job for postgresql#12-main.service failed because the service did not take the steps required by its unit configuration.
See "systemctl status postgresql#12-main.service" and "journalctl -xe" for details.
while resolving the above issue using :
sudo chown postgres.postgres /var/lib/postgresql/12/main/global/pg_internal.init
I got this error...
chown: cannot access '/var/lib/postgresql/12/main/global/pg_internal.init': No such file or directory
I think this is happening because of the manual deletion of all the files and folder in
/var/lib/postgresql/12/main/
Any help is much appreciated
Thanks
The glob * is evaluated by your regular user before the sudo is invoked, but your regular user can't see into that directory. So what gets sent to the postgres user is an order to remove the file with the literal name of '/var/lib/postgresql/12/main/*', which doesn't exist. You would need to have your shell that evaluated the glob be postgres, so it can see what it is doing before invoking rm. Something like:
sudo -u postgres bash -c 'rm -r /var/lib/postgresql/12/main/*'
For the rest of it, you didn't give enough details to know what is going on, like what was in the logs, or what were the directory listings at the time your command failed.

CentOS 7 terminal hangs after executing yum localinstall command

I'm trying to execute yum localinstall on telegraf rmp ,but my terminal hangs and I need to kill the process .
The /var/log/yum.log is empty .
Any idea why it's happening ?
this is the command sudo yum localinstall telegraf-1.19.2-1.x86_64.rpm

Unable to reinstall postgresql on mac

I'm trying to reset postgreSQL but looks like it is stuck on Mac M1 with a password and every time that I uninstall and reinstall postgreSQL it is remembering the previously set password.
So when I run brew uninstall postgresql and then brew install postgresql it is not fixing the problem.
I tried to delete the /tmp/.s.PGSQL but it looks like that makes it worse because now can't find this file even on the reinstall.
So what is the proper way to completely remove postgreSQL from a Mac M1 and then reinstall it from 0.
Disclaimer: Make sure you backup your db's in case you need them later because running these commands will delete all your local Postgres databases.
First you need to run:
$ brew uninstall postgres
$ rm -rf /usr/local/var/postgres
$ rm /usr/local/var/log/postgres.log
$ rm -f ~/.psqlrc ~/.psql_history
If you want to make sure there are no other Postgres-adjacent Homebrew formulae still installed you can eihter check via:
$ brew list --formula | grep -e postgres -e psql
or search your entire system for file name matches:
$ sudo find / -name "*postgres*" -o -name "*psql*"
Before reinstalling postgreSQL it might be a good time to reboot your machine. After the reboot run the following commands to get your fresh installation of postgreSQL:
Make sure your Homebrew is fully updated and give Homebrew a chance to diagnose any problems:
$ brew update
$ brew doctor
The diagnostic command $ brew doctor should exit cleanly with the simple message 'Your system is ready to brew.'
Now you can reinstall postgreSQL and see if it runs via:
$ brew install postgres
$ brew services start postgresql
Source: https://blog.testdouble.com/posts/2021-01-28-how-to-completely-uninstall-homebrew-postgres/

pg_dump error "bash: /usr/bin/pg_dump: No such file or directory"

I've been running pgcli for some time and have just started trying to back-up my database. I've tried running pg_dump, but have been having various problems. When I enter this into the CLI:
pg_dump --version
I get the response:
bash: /usr/bin/pg_dump: No such file or directory
I've tried installing postgresql-client, as per:
sudo apt-get install postgresql-client
and
sudo apt-get install postgresql-client-common
But I get the same results whenever I try to use the pg_dump command. I don't know where to begin to resolve this.
(I've picked up the above ideas from previous stack threads, eg: what is the meaning of the pg_dump and pg_restore errors)

Install Marklogic in ubuntu 16.04?

I want to install MarkLogic 9 on my ubuntu machine. I tried following steps from this doc
sudo apt-get install alien
sudo alien --to-deb --verbose MarkLogic-9.0-3.1.x86_64.rpm
sudo dpkg -i marklogic_4.1-6_amd64.deb
sudo /etc/init.d/MarkLogic start
But when I tried the second one I got an error like this:
iama#learner:~$ sudo alien --to-deb --verbose MarkLogic-9.0-3.1.x86_64.rpmFile "MarkLogic-9.0-3.1.x86_64.rpm" not found.
I don't know how to proceed further. I just wanted to confirm, is there any official documentation to install MarkLogic 9 in ubuntu?
The error is "File Not Found"
Make sure the rpm file exists in the current directory with read privileges with the name given.
Make sure sudo is not changing to another directory.
To be certain, use an absolute file path.
Then, test with sudo ls -l file..