How can I fix Ceph error while ceph-deploy - ceph

I am set up a ceph cluster right now and would like to create a cluster.
I've never set up ceph before, but when execute ceph-deploy on user with root rights, not root on / there is no error. After that I read in the manual to set it up in an folder and an user account so I've removed ceph and the keys and started again.
[ceph_deploy][ERROR ] Traceback (most recent call last):
[ceph_deploy][ERROR ] File "/usr/lib/python2.7/site-packages/ceph_deploy/util/decorators.py", line 69, in newfunc
[ceph_deploy][ERROR ] return f(*a, **kw)
[ceph_deploy][ERROR ] File "/usr/lib/python2.7/site-packages/ceph_deploy/cli.py", line 147, in _main
[ceph_deploy][ERROR ] fh = logging.FileHandler('ceph-deploy-{cluster}.log'.format(cluster=args.cluster))
[ceph_deploy][ERROR ] File "/usr/lib64/python2.7/logging/__init__.py", line 902, in __init__
[ceph_deploy][ERROR ] StreamHandler.__init__(self, self._open())
[ceph_deploy][ERROR ] File "/usr/lib64/python2.7/logging/__init__.py", line 925, in _open
[ceph_deploy][ERROR ] stream = open(self.baseFilename, self.mode)
[ceph_deploy][ERROR ] IOError: [Errno 13] Permission denied: '/home/myuser/cluster/ceph-deploy-ceph.log'

please try below command
(chown ceph:ceph /home/myuser/cluster)
IOError: [Errno 13] Permission denied: '/home/myuser/cluster/ceph-deploy-ceph.log'

Its Seems you using user named "myuser" and running the command using root rights. So ceph will asume you as a root user. ceph-deploy would create a deploy log file in current directories. Maybe you run this first ceph-deploy command using root rights, then you run the second ceph-deploy command using a "myuser" user. I think thats the problem. You should change permissions on ~/cluster/ceph-deploy.log file to be write/read on "myuser" user.
Change your directory permissions to "myuser" with sudo chown -R myuser:myuser /home/myuser/cluster
And if you want to restart deploying cluster, please remove all file in yout ~/cluster directories. Then purge ceph packages and purge all data in /var/lib/ceph/ using ceph-deploy purge <node> and ceph-deploy purgedata <node>. Also using ceph-deploy forgetkeys command to remove keys.

As root on the server:
mkdir /home/myuser/cluster/
chown myser. -R /home/myuser/cluster/
And run ceph-deploy again as myuser

If you do not mind, you can also just remove the log and try running the command again.
sudo rm /home/myuser/cluster/ceph-deploy-ceph.log

Related

Permission denied for deploy.sh file in scripts folder

I've getting permission denied upon running scripts/deploy.sh prod in wsl2. Am I supposed to run a chmod command?
I've previously tried to follow this -bash: ./deploy.sh: Permission denied , ERROR: script returned exit code 126 by entering chmod +x scripts/deploy.sh but when I tried running scripts/deploy.sh prod it tells me the file doesn't exist.
Could someone kindly advice? Thank you!
Here's evidence that the file is there:

issues in changing the dbpath in mongodb

i was having problem in starting up my mogodb server..(in ubuntu 16.04 LTS)
i type in the command "monogod" in the terminal and this is what i get.....
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
i understand that this means that the directory /data/db/ does not exist so to resolve it i type in .... mongod --dbpath /data/db/
but once again i get the same error. i've googled the error many times but to no avail
can someone please help.. i am entirely new to this whole thing...
Thank You
"ERROR: dbpath (/data/db) does not exist" means that the directory does not exist.
You need to make the directory.
Try:
mkdir -p /data/db
If you get a "permission denied" error, run:
sudo mkdir -p /data/db
and then type in your administrator/root password.
Read more about creating directories.

Perl script can't unzip to mounted Windows share - permission denied

I have a simple script that is unzipping a file to a mounted Windows share. It is normally launched as a Postfix alias when a new email arrives, but even when I run it as root I get a permission denied error.
The script is doing this:
if ( </tmp/*.zip> ){
unzip '</tmp/*.zip>' => '</mnt/win/#1.txt>'
or die "unzip failed: $UnzipError\n";
}
As root I can copy files to /mnt/win without a problem, but when this script is launched by Postfix it fails with permission denied.
/etc/fstab looks like:
//srvr1/tmp /mnt/win cifs credentials=/root/.smbcredentials,iocharset=iso8859-1,sec=ntlm 0 0
ls -ld looks like:
drwxr-xr-x 2 root root 196608 Jul 15 17:24 /mnt/win
Files produced by the script are nobody/nogroup, but I'm not sure how I change the permissions of /mnt/win to allow nobody/nogroup to read/write.
cmhod -R ugo+RW /mnt/win
Also gives permission denied. Is there a way to change permissions in /etc/fstab to allow nobody/nogroup?
You need to use this command to change the permissions of folder & files inside it.
sudo chmod -R R+X /mnt/win
If you want to change the user of the file as well which is nobody/nogroup rightnow, you can use this commands :
sudo chown -R username.username /mnt/win/
Here you can choose any user's name e.g. mine is mukesh
sudo chown -R mueksh.mukesh /mnt/win/

ckan harvester: "No module named pika" error

On a ckan instance running ok, I installed the harvester extension following this guide: https://github.com/ckan/ckanext-harvest
these are the steps I followed:
. /usr/lib/ckan/default/bin/activate
cd /usr/lib/ckan/default/src/ckan
sudo pip install -e git+https://github.com/okfn/ckanext-harvest.git#stable#egg=ckanext-harvest
cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
sudo pip install -r pip-requirements.txt
This is the content of pip-requirements.txt:
pika==0.9.8
redis==2.10.1
I continue configuring the plugin, everything seems to work ok. I have it running at http://localhost/harvest. Then I create a new source, and when I want to start the gather command I get this error:
$ . /usr/lib/ckan/default/bin/activate
$ cd /usr/lib/ckan/default/src/ckan/src/ckanext-harvest
$ paster --plugin=ckanext-harvest harvester gather_consumer --config=/etc/ckan/default/production.ini
Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in <module>
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/commands/harvester.py", line 125, in command
from ckanext.harvest.queue import get_gather_consumer, gather_callback
File "/usr/lib/ckan/default/src/ckan/src/ckanext-harvest/ckanext/harvest/queue.py", line 5, in <module>
import pika
ImportError: No module named pika
I'm pretty sure there must be something really silly with the virtualenv (python newbie here)
This is because you used sudo pip. Because of how python's virtualenv works, if you want to use sudo to install into the virtualenv, you need to give full path to pip. Something like this would work
sudo /usr/lib/ckan/default/bin/pip -e git+https://github.com/okfn/ckanext-harvest.git#stable#egg=ckanext-harvest
cd /usr/lib/ckan/default/src/ckanext-harvest
sudo /usr/lib/ckan/default/bin/pip install -r pip-requirements.txt

First deploy fails in Capistrano 3 with a /var/www/XXX permission error

I am running the first deploy to a machine via cap staging deploy. As of Cap3, deploy:setup is no longer needed. Yet, strangely, I get a mkdir permissions error:
INFO[cb348f12] Running /usr/bin/env mkdir -pv /var/www/myapp/shared /var/www/myapp/releases on ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com
DEBUG[cb348f12] Command: /usr/bin/env mkdir -pv /var/www/myapp/shared /var/www/myapp/releases
DEBUG[cb348f12] mkdir:
DEBUG[cb348f12] cannot create directory ‘/var/www’
DEBUG[cb348f12] : Permission denied
DEBUG[cb348f12]
DEBUG[cb348f12] mkdir:
DEBUG[cb348f12] cannot create directory ‘/var/www’
DEBUG[cb348f12] : Permission denied
DEBUG[cb348f12]
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host ec2-xx-xx-xx-xx.us-west-2.compute.amazonaws.com: mkdir exit status: 1
Of course, I could go an create and chmod that directory myself, but that's not the point. Cap3 is supposed to take care of that itself. I'm confused why it doesn't do that. I should also note that I had this same setup succeed before with another machine (though that was "production" environment).
Here are some basic settings in my deploy.rb:
set :application, "myapp"
set :user, 'ec2-user'
Instead of creating the following directory structure: /var/www/myapp/shared/var/www/myapp/releases
try: /var/www/myapp/releases
EDIT: Re-reading your question, I found that you already know how to create folder on server and set permission.
Cap3 is supposed to take care of that itself. I'm confused why it
doesn't do that
Nope. Cap3 cannot create a folder on server automatically, if the user provided to Cap3 does not have previledges to create the folder. There is no magic here just unix permissions.
In your case the user your have provided ec2-user does not have permission to create folder in /var which causes the error.
Original answer
Check whether /var/www folder exists on your server. If it does not, then create that folder and set its ownership to ec2-user so that Capistrano can create any other folders as necessary during the deployment.
sudo mkdir -p /var/www
sudo chown ec2-user:ec2-user /var/www
With the above commands run, try deploying again with capistrano. Permission error should now be gone.