Cant apt-get remove or apt-get install | fopen permission denied - linux

So out of no where I was unable to SSH into my headless linux box.
So I hooked up a screen and started tooling with it.
My server is still fully functional and the box seems in tact. I just wouldn't let me SSH in.
So I tried follow a few online tutorials on adding my IP to the SSH allow file but nothing seemed to work.
I kept getting
"Network Connect: Connection Refused"
when attempting to SSH in with putty.
So I decided to nuke the iptables and do
sudo apt-get remove --purge iptables
which resulted in a failure.
Something like this
"processing tables for mandb " "fopen permission denied"
So I tried doing
sudo apt-get install iptables
which it said the same fopen error.
End result is my server is up and running but I have no ssh capabilities into my box. On that note though I do still have an active samba connection. Take that for what its worth.

The fopen permission denied thing when doing apt-get or dpkg, is very often a sign that your manpages cache at /var/cache/man is owned by root:root instead of man:root. Try changing this with
chown -R man:root /var/cache/man

I followed the instructions below and the problem was solved. I hope it works for you.
sudo apt autoremove
sudo dpkg --configure -a
sudo apt-get update
sudo apt-get upgrade

Related

Ubuntu Remmina "Protocol plugin RDP is not installed" Error, RDP missing

Ubuntu 18.04:
It looks like the Remmina Remote Desktop app was updated today and I lost the RDP protocol in the process. VNC, SSH and SPICE are still available but no RDP.
I tried rebooting, uninstalling and reinstalling using:
sudo killall remmina
sudo apt-get purge remmina* -y
rm -Rf /home/`whoami`/.remmina/remmina.pref
sudo apt-get install remmina* -y
This combo'd with a reboot before and after but still no RDP.
I also noticed that the Ubuntu Software (Gnome Software) has 2 Remmina apps listed.
I found a link (the fix) on Remmina website by accident.
The normal install instructions on their site also did not work but then I looked at compiling from source.
https://gitlab.com/Remmina/Remmina/-/wikis/Compilation/Compile-on-Ubuntu-18.04
I added to the "purge" section of the remove command above and this worked:
sudo killall remmina
sudo apt purge "remmina*" "libfreerdp*" "libwinpr*" "freerdp*"
rm -Rf /home/`whoami`/.remmina/remmina.pref
Reboot and then install using the "Ubuntu Software", choose the one with the mostly Blue icon.
It looks like the FreeRDP libraries may have been the issue for me.

Unable to install libsasl2-devel on Amazon Linux 2 machine

I am running Ansible playbook and trying to install OS dependencies packages for python. I am trying to run the following:
sudo yum install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel
However, it fails at installing libsasl2-devel with the message:
"No package matching 'libsasl2-devel' found available, installed or updated"
All my instances are Amazon Linux 2 machines. Is there any alternative package for this? I tried to look into this but I found solutions for Ubuntu only.
I was able to get it to work in a series of steps. Its a yum issue after other databases are installed and not cleaned up before installing mysql
clear sasl first: sudo yum remove cyrus-sasl
if you have installed maria, there will be conflicts, remove that as well
sudo yum remove mariadb mariadb-server mariadb-libs
take note of anything uninstalled by this to re-add later. If this is too much, you can take a risk and not remove sasl, but it might not reset the availability of the package.
Start here to clean up the dependency issues: https://serverfault.com/questions/873955/how-solve-mysql-5-7-dependency follow the command given by clean all as sudo rm -rf /var/cache/yum/*
This can possibly resolve your issues right there, if not continue the installation below.
delete all data left in /var/lib/mysql/ or you may have upgrade issues.
resinstall sasl:
sudo yum install cyrus-sasl cyrus-sasl-devel and any other packages removed above.
Establish mysql5.7 with the yum services.
wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm
sudo yum localinstall -y mysql57-community-release-el6-11.noarch.rpm
sudo yum repolist enabled | grep "mysql.*-community.*"
sudo yum repolist enabled | grep mysql
sudo yum install -y mysql-community-common mysql-community-libs mysql-community-server mysql-community-client
if that doesn't work, re-clear the yum cache again and re-run sudo yum install -y mysql-community-server
if that works, then
sudo service mysqld start
IF the /var/lib/mysql is empty, it will have created a temporary password in the /var/log/mysqld.log (use sudo to read)
run sudo mysql_secure_installation and establish your real password and security settings.
now you should have access via mysql -u root -p

How to Install Gitlab on Centos 6.6 VPS?

I tried installing as mentioned here: https://about.gitlab.com/downloads/
sudo yum install openssh-server
sudo yum install postfix
sudo yum install cronie
sudo service postfix start
sudo chkconfig postfix on
sudo lokkit -s http -s ssh
curl -O https://downloads-packages.s3.amazonaws.com/centos-6.6/gitlab-7.7.2_omnibus.5.4.2.ci-1.el6.x86_64.rpm
sudo rpm -i gitlab-7.7.2_omnibus.5.4.2.ci-1.el6.x86_64.rpm
sudo gitlab-ctl reconfigure
It looks like everything went successfully, but but I don't get anything on my hostname. Is there anything I missed?
GitLab will try to setup the FQDN by using the hostname of your machine. To do this manually, open /etc/gitlab/gitlab.rb and edit the external url according to the documentation, which by the way if you haven't already read, I suggest that you do it!

CouchDB: Unable to start CouchDB normally

I am a newbie to couchDB. Recently, I have dived into it with a quick installation instruction over here:
sudo apt-get update -y
sudo apt-get install g++ -y
sudo apt-get install erlang-base erlang-dev erlang-eunit erlang-nox -y
sudo apt-get install libmozjs185-dev libicu-dev libcurl4-gnutls-dev libtool -y
curl -O http://apache.mirrors.tds.net/couchdb/source/1.5.1/apache-couchdb-1.5.1.tar.gz
tar -zxvf apache-couchdb-1.5.1.tar.gz
cd apache-couchdb-1.5.1
./configure
make
sudo make install
sudo adduser --disabled-login --disabled-password --no-create-home couchdb
sudo chown -R couchdb:couchdb /usr/local/var/log/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/lib/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/run/couchdb
sudo ln -s /usr/local/etc/logrotate.d/couchdb /etc/logrotate.d/couchdb
sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d
sudo update-rc.d couchdb defaults
1. modify /usr/local/etc/couchdb/local.ini
2. change bindAddress to 0.0.0.0
3. reboot
4. remember to go into the config settings and secure server
5. remember to turn on auto compaction
I have followed exactly the guide, except the 4th and 5th steps cause I did not know how to do it. When I ran:
couchdb
I got the following message in the terminal (I am using Ubuntu 14.04 LTS):
Apache CouchDB 1.5.1 (LogLevel=info) is starting.
Error opening log file /usr/local/var/log/couchdb/couch.log: permission denied{"init terminating in do_boot",{{badmatch,{error,{bad_return,{{couch_app,start,[normal,["/usr/local/etc/couchdb/default.ini","/usr/local/etc/couchdb/local.ini"]]},{'EXIT',{{badmatch,{error,{shutdown,{failed_to_start_child,couch_primary_services,{shutdown,{failed_to_start_child,couch_log,{error,"permission denied","/usr/local/var/log/couchdb/couch.log"}}}}}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,269}]}]}}}}}},[{couch,start,0,[{file,"couch.erl"},{line,18}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}
Crash dump was written to: erl_crash.dump
init terminating in do_boot ()
May anyone help me figure out this problem and suggest some solution to fix it? Thank you very much.
You may need to start the couchdb process as the couchdb user, with su couchdb -c ./couchdb (assuming the current directory contains the executable) - double-check the su command options for your system.
Also, check the permissions on /usr/local/var/log/couchdb/couch.log - make sure it is writeable by the couchdb user.
I would like to make a note here for how I fixed this problem in my environment. In my case, the /opt/couchdb/data folder was a symlink to /var/lib/couchdb. No matter what I tried I would get a permission denied error at startup, even though all the files seemed to be owned by user couchdb.
I eventually figured out that the "execute" permission was not set on /var/lib. Without this permission the symlink would not work. If you run into this problem, start by setting chmod -R a+x /var as I did, to prevent this from happening.
Although on CentOS, the "problem" is avoided using service couchdb [start|status|stop|restart].
https://medium.com/#tomiwatech_45998/installing-couchdb-on-ubuntu-17-10-18148e2eb846
Hi there,
this helped me resolve the issue and solved the problem. My ubuntu version is 16.04 and i downloaded couchdb-1.7.0 version.
You can start couchdb using below command
sudo couchdb stop
sudo couchdb start

Mongo: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145

When I try to run mongo in shell in ubuntu or open rockmongo I see this error:
couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:145
What's the reason? I tried to reinstall mongo but this didn't help. When I type sudo apt-get purge mongodb-10gen returned error is
E: Sub-process /usr/bin/dpkg returned an error code (1)
I tried this:
first remove line about mongo in /etc/apt/sources.list
run this commands:
sudo dpkg pr mongofb-10gen
sudo apt-get -f install
sudo apt-get upadte
sudo apt-get upgrade
then sudo apt-get purge mongodb-10gen is successful
at the end:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
add deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen
in /etc/apt/sources.list
sudo apt-get update
sudo apt-get install mongodb-10gen
Then when I try to start mongo i saw the same error. :o
I assume that you followed the steps, outlined here.
Most probably you have a problem with mongo lock (or at least I had it once while installing on ubuntu). I solved it with the following commands:
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongodb restart
P.S. I by myself recently experienced this problem when I was updating my amazon ec2 instance. I have not properly shut down mongo before doing this and this resulted in a problem with mongo lock.
Check your log file of mongodb. you will get to know the exact issue.
tail -f /var/log/mongodb/mongodb.log
The issue may because of "ERROR: Insufficient free space for journal files"
Increase your volume space that will fix your issue.
If you got this after a restart... Make sure that you have over 3GB+ of space free else Mongo Won't start.
even i had the same problem so i deleted the mongod lock file
sudo rm /var/lib/mongodb/mongod.lock
and the restart the server it worked , restarting by command below
sudo service mongodb restart
i got the solution by changing the owner of db directory to 'mongodb'
`sudo chown -R mongodb:mongodb /data/*`
then type 'mongo'
I guess the reason why you cannot connect to mongodb is the insufficient space in the drive on your computer.

Resources