Unable to start CouchDB - couchdb

Just installed CouchDb using brew on mac mountain lion. Everything went well till I hit the following issue to start the server I do not know erlnag and could not analyze the dump file
`couchdb
Apache CouchDB 1.2.1 (LogLevel=info) is starting.
{"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}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,98}]},{application_master,start_it_old,4,[{file,"application_master.erl"},{line,274}]}]}}}}}},[{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 ()`
Any help much appreciated.
I have left the configurations files as it is

Often this is due to incorrect permissions on various configuration files & directories. It can be caused by running as a sudo / root user for example.
You can try fixing this using the following, but you may need to either create/add yourself to a couchdb group, or use a different user:group combination.
sudo chown -R couchdb:couchdb /etc/couchdb /var/lib/couchdb /var/run/couchdb /var/log/couchdb
sudo chmod -R 770 /etc/couchdb /var/lib/couchdb /var/run/couchdb /var/log/couchdb
sudo find /etc/couchdb /var/lib/couchdb /var/run/couchdb /var/log/couchdb -type f | sudo xargs chmod 660
```
See the chmod section in http://wiki.apache.org/couchdb/Installing_on_OSX for more detail.

I've had this problem when attempting to load a configuration file that doesn't exist, I was starting CouchDB with the -a option to supply additional configuration, and if that file doesn't exist I get an error similar to the one reported:
$ couchdb -a /does/not/exist.ini
{"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,{error,enoent}}},[{couch_server_sup,start_server,1,[{file,"couch_server_sup.erl"},{line,56}]},{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,[]}]}}

sudo apt-get install libicu-dev
Provide Proper permissions

Related

Laravel Permission denied error on Linux Server

I am facing a very strange error with my Laravel application on the production server (Linux). Whenever the users of my application login for the first time in morning, they get a permission denied error which read something like
file_put_contents(/var/www/html/PROJECT/storage/framework/cache/data/0c/e5/0ce52dca12715a327eb4c1b4bff36293ea67c719): Failed to open stream: No such file or directory
To overcome this, the first thing I have to do in the morning is to give permission to the entire project by
sudo chmod -R 777 PROJECT
And then it runs just fine.
This is slowly getting very annoying as it is happening every morning. Why are the permissions getting revoked automatically and is there a permanent solution for this?
Please help me and thank you all in advance
I think your application run some command also. That's why your storage permission is overrated by system user. (by which user cron execute).
The thing is, storage directory should have write access to both system user and webserver(apache/nginx)
BTW, Symfony framework has some nice solution for this kind of situation which also can be application in Laravel Application.
Please look at this:
https://symfony.com/doc/current/setup/file_permissions.html
In your case, this command would be like:
HTTPDUSER=$(ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1)
sudo setfacl -dR -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX /var/www/html/PROJECT/storage
sudo setfacl -R -m u:"$HTTPDUSER":rwX -m u:$(whoami):rwX /var/www/html/PROJECT/storage
You can also achieve above solution if you know know what is your webserver user.
sudo chown -R "$local_user":"$webserver_user" "/var/www/html/PROJECT/storage"
sudo chmod -R 0777 "/var/www/html/PROJECT/storage"
If my opinion, setfacl is better solution if you have setfacl installed in your server.
You can check if your webserver has enough permission to the directory instead of giving 777 to the project as this is your production environment which is not at all recommendable.
Also try php artisan cache:clear

laravel centOS 7 chmod 755/775 permission denied"could not be opened: failed to open stream: Permission denied", only allows if I set to 777

I have linux:
Linux version 3.10.0-693.21.1.el7.x86_64
(builder#kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat
4.8.5-16) (GCC) ) #1 SMP Wed Mar 7 19:03:37 UTC 2018
If I set the permission to 777 on storage, laravel works, but if I set it to 755 or 775 it says:
"The stream or file
"/home/admin/domains/linkshift.eu/public_html/storage/logs/laravel-2018-11-08.log"
could not be opened: failed to open stream: Permission denied"
I have tried searching for an answer, but nothing else worked, I have tried doing
Permissions Issue with Laravel on CentOS
but it still doesn't work
Edit: I also have direct admin installed
Look like the log file is generated using root user and you are running the laravel from a different user. Make sure the log file is written by same user. Or give permission to your user.
sudo chown -R laravel-user:laravel-user /path/to/your/laravel/root/directory
Run these commands after every deploy
chmod -R 775 storage/framework
chmod -R 775 storage/logs
chmod -R 775 bootstrap/cache
Still If not working, It can maybe also because of SELinux.
Check selinux status on terminal:
sestatus
If status is enabled, write command for disable SElinux (not recommended)
setenforce Permissive
or you can do like below.
yum install policycoreutils-python -y # might not be necessary, try the below first
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/your/laravel/root/directory/storage(/.*)?" # add a new httpd read write content to sellinux for the specific folder, -m for modify
semanage fcontext -a -t httpd_sys_rw_content_t "/path/to/your/laravel/root/directory/bootstrap/cache(/.*)?" # same as the above for b/cache
restorecon -Rv /var/www/html/ # this command is very important to, it's like a restart to apply the new rules
Selinux is intended to restrict access even to root users, so only the necessary stuff might be accessed, at least on a generalist overview, it's extra security, disabling it is not a good practise, there are many links to learn Selinux, but for this case it is not even required.
Could you show the result of
ls -l /home/admin/domains/linkshift.eu/public_html/storage/logs
and have you tried
php artisan config:cache
php artisan config:clear
composer dump-autoload -o

Accidentally did chown -R my.user:staff /usr in OS X

I was a happy guy until when, accidentally, I did this command in my Mac Os X (Yosemite 10.10.5) a few moments a go:
$ sudo chown -R my.user:staff usr/
Then, terribly, when I try to use sudo a horrible error occurs:
$ sudo su -
sudo: effective uid is not 0, is sudo installed setuid root?
Any one have any idea about how to solve these and save my life, please?
Obs: I can't open new terminals but I still have two terminals opened, one logged with my.user and other with root.
Maybe if you changed the owner to actually used by you user, you can change without sudo the ownership to root by chown -R root:root /usr?
I found this tutorial and it saved me from ruin:
Open Disk Utility, which is in the Utilities folder of your Applications folder.
Select the startup disk from the list of volumes.
Click the First Aid tab.
To check permissions, click Verify Disk Permissions. To repair permissions, click Repair Disk Permissions.
https://support.apple.com/en-us/HT201560

How to give a directory back its sudo admissions/permissions?

I recently installed LAMP on my Ubuntu 14.04 laptop. But I didn't have full/root access to the files var/www and etc/apache2/sites-enabled/000-default.conf so I did some research to change permissions and admissions to the directory, using this command in the terminal:
sudo chown -R username:group directory
It worked perfectly. But now I can't do any sudo commands in the terminal. I wanted to restart the apache server but here is what it showed me:
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: impossible d'initialiser le greffon de règles
(my computer is in french btw).
What I want to know is how to set it back to sudo. I hope I explained myself good enough. If you need additional info that I didn't state please tell me. I will add it. Thnx.
Seems like you chown'd /etc/sudoers.
Try:
sudo chown root:root /etc/sudoers
Then if you want read/write privileges, see which group the folder /var/www belongs to (probably www-data)
To add yourself to the www-data group, try:
sudo useradd -a -G www-data yourUserName
Also, as a side note; be careful of recursive commands!!! If you're not sure what a command does, test it on a single file before making it recursive. For example:
DO NOT RUN THIS CODE, I DON'T INCLUDE SUDO ON PURPOSE SO YOU DONT HOSE EVERYTHING
rm -r /
Will delete everything inside / (a lot of stuff!)

Linux - how change chmod of /

How can I change chmod of /?
When I run
chmod 755 /
under root, I get
Operation not permitted
Why I need it?
I am installing (logged as root) apt-get install memcached and I get error:
failed to move /initrd.img:Permission denied at /var/lib/dpkg/info/linux-image-3.2.0-26-generic.postinst line 495.
I suppose that your root filesystem is mounted readonly.
You need to check it, for example, creating a file in /root:
# touch /root/hello
Then you will see if it is really so.
If it mounted readonly, you can try to remount it rewrite and see what happened:
# mount -o rw,remount /
Ok, how we've known after the discussion there were an immutable bit on the filesystem.
# lsattr -d /
----i--------e- /
You can remove this bit with chattr -i /. Don't forget to set it back after your operations:
# chattr -i /
# # something
# chattr +i /
Do you have root privileges? Mere mortals (i.e., regular users :-) are not permitted to make these changes
Try to use sudo which gives you super user privileges, as others will mention however this kind of stuff is like witchcraft and if it goes horribly wrong then chances are your system will be "unstable" to say the least.
Apt-get doesn't need to change permissions for / or first degree children. Which command do you
use yum tools for installing it automatically clear all the permission and other installing problems . use this command
1. Login as root
2. change permissions of \
chmod 777 *
3.install bmemcached
* yum install bmemcached**

Resources