redhat linux sudo su - failed - redhat

I am no more able to do sudo su - to get root authentication. I am logged in as test user. I mapped test from unconfined_u to SElinux user staff_u. I restarted the vm machine on google cloud. I can login to vm as test user, but if I do sudo su -, I get following error:
su: avc.c:74: avc_context_to_sid_raw: Assertion `avc_running' failed.
Aborted

It seems to be a known bug of CentOS and Redhat:
0011249: su: avc.c:74: avc_context_to_sid_raw: Assertion `avc_running'
failed.
Description Whenever I execute a su - command after switching
into the sysadm_r, I get this fault. The system is in enforcing mode
when I get this error. When in permissive mode, this does trigger the
error. Attempted to address the problem with audit2allow to see if
that could temporarily resolved the problem while I looked for a
permanent solution but that did not work either
There are the 2 referencies:
Centos bug
RedHat Bug

Related

5: Input/output error Error: Failure while executing; `/bin/launchctl bootstrap gui/502 and FATAL: password authentication failed for user

The error 5: Input/output Error: Failure while executing; /bin/launchctl bootstrap gui/502 /Users/Andrea/Library/LaunchAgents/homebrew.mxcl.postgresql.plist exited with 5 is occurring when typing in the command "brew services start postgresql".
I am trying to create a database using homebrew and postgresql. If I type the command "brew services stop postgresql" and then start it back up the error does not occur. But will reoccur on the initial start of postgresql.
After, I stop postgresql and restart it using homebrew I type in "createdb 'test'. This error appears:
"error: could not connect to database template1: FATAL: password authentication failed for user "Andrea". Initially I tried to primarily work on the password authentication with no luck.
Here are the steps I have taken:
I have changed the method column to trust in my hba_pg files.
I have tried the command ALTER in the terminal to change the password.
I created a root login on my computer, where I tried to access the file and use the root's password to create the database.
The command chpass to change my user's password.
Help would be much appreciated. Thank you!
This is what I did to resolve on my Mac.
Looked at the postgres.log cat /usr/local/var/log/postgres.log | tail -100
Found the following error on my logs FATAL: lock file "postmaster.pid" already exists
Fix above PID issue and restart the server.
rm /usr/local/var/postgres/postmaster.pid
brew services restart postgresql
Sometimes this can be solved by simply running
brew services restart postgresql
instead of
brew services start postgresql
It happens when a previous postgres process doesn't terminate properly (maybe because you killed a psql process in activity monitor or otherwise). Restarting appears to properly unlock/delete the postmaster.pid file where "start" doesn't.
On the m1 mac I had the same issue and had to remove the postmaster.pid file as well. For m1 macs, the file is at /opt/homebrew/var/postgres/postmaster.pid, so I ran
/opt/homebrew/var/postgres/postmaster.pid
and I could brew services start postgresql successfully.
The other answers didn't apply because I didn't have the pid file (or many other files in those directories). The same error was caused by a bad install, most likely because I had previously installed libpq to get the psql CLI in isolation previously as per: Correct way to install psql without full Postgres on macOS?.
Solution, clean install:
> brew uninstall postgresql
> brew uninstall libpq
> brew install postgresql
> brew services run postgresql
To build on what #gajen-sunthara said, I made sure to upgrade my postgresql installation:
brew services upgrade postgresql
Then removed the postmaster.pid:
rm /usr/local/var/postgres/postmaster.pid
And restarted postgresql:
brew services restart postgresql
And that should get it going again :)
I got the same error:
% brew services start yabai
Bootstrap failed: 5: Input/output error
Try re-running the command as root for richer errors.
Error: Failure while executing; `/bin/launchctl bootstrap gui/503 /Users/myuser/Library/LaunchAgents/
homebrew.mxcl.yabai.plist` exited with 5.
I have an extra user who manages brew called brew.
After trying to run a brew service with sudo, this was a solution (on Apple silicon):
% sudo brew services stop yabai
% sudo chmod -R g+w /opt/homebrew
% sudo chown -R brew /opt/homebrew
% brew services start yabai
I know this has already been answered, but for anyone seeing this in the future, here is some help.
This often happens because it wasn't properly stopped when it was used at a different time, and the version you are using now has a conflict with what you were running previously. There are a few ways to fix it.
Try stoping it with brew services stop postgresql
Start it with brew services start postgresql
You can also just do brew services restart postgresql and not do step 1 and 2. Hope this helps someone!

How to access Odoo 14 using WSL

I have installed Odoo 14 in Ubuntu 20LTS as WSL, everything seems fine and the service is running. However, I am lost on how to access Odoo page. I have tried 0.0.0.0:8069 in Windows (Chrome) but it says that:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
Any help on that?
Also, please let me know how I can change the Port for Odoo in Ubuntu in WSL.
Many Thanks.
Here is the solution to my problem :
PostgreSQL: Why psql can't connect to server?
Step 5: Check postgres user belongs to ssl-cert user group
It happened to me and it turned out that I removed erroneously the Postgres user from "ssl-cert" group. Run the below code to fix the user group issue and for fixing the permissions
sudo gpasswd -a postgres ssl-cert
# Fixed ownership and mode
sudo chown root:ssl-cert /etc/ssl/private/ssl-cert-snakeoil.key
sudo chmod 740 /etc/ssl/private/ssl-cert-snakeoil.key
# now postgresql starts! (and install command doesn't fail anymore)
sudo service postgresql restart````

Gitlab not starting after upgrade to Ubuntu 18.04

I have successfully upgraded Gitlab to 12.1.6 on Ubuntu 16.04 and checked that all was working. After making sure Ubuntu was fully up to date I checked again: Gitlab worked.
I then used the do-release-upgrade command to update to Ubuntu 18.04. After restart, everything seems to work ok, but Gitlab refuses to start.
I get the following errors:
fail: alertmanager: runsv not running
fail: gitaly: runsv not running
fail: gitlab-exporter: runsv not running
fail: gitlab-workhorse: runsv not running
fail: grafana: runsv not running
fail: logrotate: runsv not running
fail: nginx: runsv not running
fail: node-exporter: runsv not running
fail: postgres-exporter: runsv not running
fail: postgresql: runsv not running
fail: prometheus: runsv not running
fail: redis: runsv not running
fail: redis-exporter: runsv not running
fail: sidekiq: runsv not running
fail: unicorn: runsv not running
I tried:
gitlab-ctl reconfigure --> runs with success
I installed runit with success, rebooted the machine but the errors remain
I found a similar issue here: on Stackoverflow, followed the instructions (yum --> apt), still no success
and here on Gitlab. This advised to run
sudo systemctl restart gitlab-runsvdir
sudo gitlab-ctl restart
But the first command never finishes
I found this: on Gitlab which states to run
sudo gitlab-rake gitlab:env:info --trace
Output:
** Invoke gitlab:env:info (first_time)
** Invoke gitlab_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute gitlab_environment
** Execute gitlab:env:info
System information
System: Ubuntu 18.04
Current User: git
Using RVM: no
Ruby Version: 2.6.3p62
Gem Version: 2.7.9
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 3.2.12
Git Version: 2.24.1
Sidekiq Version:5.2.7
Go Version: unknown
rake aborted!
PG::ConnectionBad: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/opt/gitlab/postgresql/.s.PGSQL.5432"?
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `initialize'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `new'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/pg-1.1.4/lib/pg.rb:56:in `connect'
which suggests that the Postgresql server is not running. I have no idea how to start it. Any ideas?
UPDATE: Since then I found an answer that said for some reason on the reboot command the runsv process gets stuck. To solve this you have to:
sudo service gitlab-runsvdir start
sudo gitlab-ctl reconfigure
sudo gitlab-ctl restart
I wanted to post the same above question. This happens to me when i do the monthly upgrade/updates to our GitLab. I tried your solution before, but to me they didn't solve the problem.
I present my solution, but use these tips with caution, as I still sometimes struggle with this problem in different ways.
I do a combination of these command, the order of these steps are really important(!):
sudo systemctl disable gitlab-runsvdir.service
sudo gitlab-ctl reconfigure
sudo gitlab-rake db:migrate
sudo gitlab-ctl restart gitlab-runsvdir--has to be aborted with Ctrl-C
sudo /opt/gitlab/embedded/bin/runsvdir-start--has to be aborted with Ctrl-C
Reference:
In this issue Stan Hu's answer helped me:
https://gitlab.com/gitlab-org/omnibus-gitlab/-/issues/3744
Now yesterday I messed up and didn't do the first step, which could cause my problems, because somehow then for 10 hours the postgresql server was down and it couldn't make it back up again.
If i would have stick to the order, maybe it wouldn't have happened, because it didn't happen in the past while I upgraded/updated GitLab several times.
This was the connection error yesterday, same issue as questioner's
Automatic restart this morning
This morning magically the server at 7:13 am, was accepting connections again. (althought i tried to restart it yesterday, it didn't make any difference then)
Still GitLab wasn't reachable online from web browser as of 7:30 am.
One hour later, and a few runsvdir restarting/starting commands after (added it to the commands order), the GitLab is working. I have no idea why.
Got the same problem, and I ended up running /opt/gitlab/embedded/bin/runsvdir-start manually. I fixed my problem, launched reconfigure, and then it worked from there.
I ran into a similar runsv error, but only saw it for once service, not the whole list you have. These steps are a log of my attempts to get it working - probably not a direct line, but my local Gitlab does work now:
In the CentOS vm:
vi /etc/gitlab/gitlab.rb
change the external_url from http://example.gitlab.com to http://192.168.1.131
sudo gitlab-ctl reconfigure
first observed the error runsv not running
yum update -y
sudo gitlab-ctl status
sudo gitlab-ctl restart
sudo gitlab-ctl reconfigure
systemctl start gitlab-runsvdir.service
systemctl status gitlab-runsvdir.service
sudo gitlab-ctl reconfigure
still saw an error about runsv not running, several times, but it was never a blocker and the reconfigure was successful
On host
navigate to 192.168.1.131
See the prompt for root password
As for the issue with Postgres, I'm not sure

Unable to run OTRS daemon, OTRS6 on Cent OS 7

I am facing issue while trying to start ORTS daemon on CentOS linux
FACILITY:
OTRS-otrs.Daemon.pl - Daemon
Kernel::System::Daemon::DaemonModules::SystemConfigurationSyncManager-07
MESSAGE:
Access denied for user 'otrs'#'localhost' (using password: YES)
When I am trying get the status using command:
./opt/otrs/bin/otrs.Daemon.pl status
getting this message:
Manage the OTRS daemon process.
Daemon running
But when I go to the web page it says that OTRS Daemon is not running.
Any help is appreciated!?
The error comes from the mysql daemon and has nothing to do with Perl. Try this on the command-line on the server running otrs:
mysql --user=otrs --host=localhost --password=XXXXXXX
That will probably fail with the same error. Once you have fixed your mysql configuration so that the command succeeds, otrs should also start.
Omit the option --password and let mysql prompt you for the password, if you are not alone on the machine.
Another reason for the failure could, of course, be that you have misconfigured otrs, and you have to change the mysql user, host, or password.
After searching for solution for two days i finally get it working.
I first change to /opt/otrs/bin/ directory.
To get the daemon working, you have to start the daemon as otrs user.
To do that just change user to otrs : you can use this command. (su otrs) from your terminal, you will be prompted for the password for otrs. Just enter the password and use the (whoami) command to check if you are otrs. If it shows that the current user is otrs issue this command (./otrs.Daemon.pl status) to see the current status of the daemon. if it shows that the daemon not running then issue this command (./otrs.Daemon.pl start).

Postgres cant connect to server: No such file or directory

I'm running Debian server and use SSH to manage it. Today I tried to install Postgres and follow this steps to do it:
apt-get install postgresql
su - postgres
psql
After the last command I got:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I found several solutions in the Web, but all of them doesn't works for me. As example I found, that I need to delete "postmaster.pid" in here:
/usr/local/var/postgres/postmaster.pid
But I have no such directory as "postgres" in my "var" folder...
Please, help...:(
What you did is correct and normally sufficient except when something goes wrong with the automatic creation of the first cluster by apt-get install postgresql. Often there is an error message like this in the middle of the success reports:
Error: could not create default cluster
Since you can't have done any work with postgres yet, purge the packages with
apt-get purge 'postgresql*'
then reinstall with
apt-get install postgresql
but this time, pay close attention to any error message that would imply that the initial cluster was not created, that will give the actual reason of the problem.