Pretext: this has been asked before and i've tried implementing several solutions from previous posters. The only thing i can seem to get working is running mongo as sudo.
I'm not exactly sure what i'm doing wrong. I'm trying to do a tutorial using mongodb and every time i try to run the software i get back an error that its in a read-only directory. I'm on a mac running OS Sierra, i can force run it with sudo but i know thats wrong. I've been searching for an answer for awhile and i have already adjusted the folder permissions to 775 and nothing, then 777, still nothing.
Any help pointing me in the right direction would be greatly appreciated!
to resolve the "warning soft rlimits to low" check out this link - https://gist.github.com/tamitutor/6a1e41eec0ce021a9718
Lets start over as you are bouncing around on what you are trying.
Open activity monitor and kill any mongod process.
Go to your terminal and type which mongo - lets say it shows you download directory
cd to that directory and you should be in the bin directory
cd /mongo download directory/bin
sudo bash
mkdir -p /data/db
chmod 777 /data
chmod 777 /data/db
ls -ld /data/db this will validate you see the data/db directory as 777
exit
You're back in your mongo bin directory - if you are in /usr/local/bin skip this part.
If you are not in /usr/local/bin you will need to copy the mongo files to /usr/local/bin
sudo bash
ls - make sure you are in the correct directory
cp * /usr/local/bin
exit
which mongo should now show /usr/local/bin
type mongod to start it
open a new terminal and type mongo to connect to the instance
I recommend downloading Robo 3T (formally RoboMongo) to quickly check that you can connect.
If you do those steps, you should have no issues connecting to your local Mongo instance.
Your mongod.conf files should be in /usr/local/etc - check there to confirm you have your local host set.
Should be like net:
bindIp:127.0.0.1
Related
sudo mkdir -p /data/db
i want to create a missing directory fro mongod exit with status code 100. But when i try to create directory it says no such file or directory exit. I have a mac 2015 pro with version 12.02.0. Can someone help me get out of this trouble
I'm trying to save a file called app.js on a folder called js.
Vs Code pop up this:
Failed to save 'app.js': Unable to write file 'vscode-remote://wsl+ubuntu-18.04/js/app.js'
(NoPermissions (FileSystemError): Error: EACCES: permission denied, mkdir '/js')
I tried:
sudo chown -R user /mnt/c/Users/myUser/Documents/myFolder/proyectFolder
but I still can't save this file.
Try this, fixed it for me
sudo chown -R username path
Example:
sudo chown -R emanuel /home/emanuel/test/
In the SSH terminal:
Recommended :
sudo chmod -R 777 folder_name_where_your_file_exists
or
sudo chmod -R 755 folder_name_where_your_file_exists
this works for me
sudo chown -R $USER:$USER /home/
TLDR;
If you're using a docker container, avoid making files from within the container because the owner and group permissions may cause problems with your editor (in my case VS Code)
I was running docker container for a Django project from Windows Terminal and using VS Code to edit my code.
It is a Linux file (since everything in Linux is a file) permission problem that arises because the files don't have proper user and/or group permissions. So VS Code tries to tell us that.
The problem I found only happened when I created files from within my docker container.
I would run docker exec ... bash
make new files using touch /path/to/file from the container bash
then try to edit those files on VS Code (say urls.py) only to get the scary permissions error preventing the file from saving.
I suspect that making files from within the container embellishes those files with different owner and group settings than your system would default to if you just ran the commands locally (not in the container).
Changing the file permissions with chown -hR and chgrp -hR would do the trick but to avoid the error altogether I stopped making files from within the container.
Try activating polling:
This worked for me during I tried using wsl.
The below is for individual file:
sudo chown yourUserNAme filename
For an entire directory it will be (when you write ls to terminal, you should see your directory to execute this command):
sudo chown yourUserNAme dirName
For recursive (i.e files and folders inside a folder):
sudo chown -R yourUserNAme dirName
Note: yourUserNAme is, if you do pwd under any Documents, you will see the path: /home/jhon/Documents. Here user is jhon.
Run VS Code as administrator and it will fix the problem.
https://answers.microsoft.com/en-us/windows/forum/all/error-in-vs-code-destination-directory-and-says/e70dc626-6b12-4791-a960-8b704e57098d
Install the extension Save as Root in Remote SSH in VS code.
While saving press Ctrl + Shift + P.
This open the command palette.
Search Save as Root
It is a Linux user permissions problem.
you should use the command:
sudo chown -R $USER:$USER.
I am trying to run multiple mongod instances on the same centos machine with different config files.
I am getting following error while running the instance as a service:
sudo service mongod1 start
/var/lib/mongo1: boost::filesystem::status: Permission denied: "/var/lib/mongo1/mongod.lock"
I have added the permissions for the /var/lib/mongo1 using:
sudo chmod -R 600 /var/lib/mongo1
I also tried with 700, 755 and 777 at the end but nothing seems to work.
mongod:mongod is the owner of the folder /var/lib/mongo1
Any help is appreciated.
I know this is really late but I was struggling with this for days and just now found the fix. That being said for future users running into this issue the solution if you're using SELinux is to check the context of the default mongodb path against your own to make sure they are the same by executing
ls -dZ /var/lib/mongo/
the output should look something like this
drwxr-xr-x. mongod mongod system_u:object_r:mongod_var_lib_t:s0 /var/lib/mongo/
if it's not then you can copy it by doing
chcon -R --reference=/var/lib/mongo /your/path
the source can be found here
Maybe the lock file is missing? Which might explain why chmod isn't having the desired effect...
Try:
touch /var/mongo1/mongod.lock
chown mongod:mongod
chmod 600 /var/mongo1/mongod.lock
important :
Don't try to restart mongo using sudo as it tries to change the user to root where as /var/lib/mongodb owner is mongod:mongod
Please remember that Directories needs to have execute permission, but the files within the directories do not need to execute permission.
The following 2 commands worked for me
$ sudo chmod -R 770 /var/lib/mongo1
$ sudo find /var/lib/mongo1 -type f -exec chmod 660 {} \;
This will first give everything under /var/lib/mongo1 execute permission, and then return all the normal files to having only read and write, but not execute.
Steps to recreate error:
brew uninstall postgresql
brew prune
brew install postgresql
run postgresql start commands
psql
yields:
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
Suggested fixes I have tried that don't work:
create missing symbolic link:
sudo mkdir /var/pgsql_socket/
sudo ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/
remove postmaster.pid file (same link as above):
rm /usr/local/var/postgres/postmaster.pid
create potentially "cleaned up" directories from upgrade:
mkdir -p /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/
touch /usr/local/var/postgres/{pg_tblspc,pg_twophase,pg_stat_tmp}/.keep
Related GitHub issue
Edit 1:
This article correctly speculates that there are multiple versions of postgres in use, and which pg_ctl must be specified (below). Strangely, there are two directories in /usr/local/var: postgre & postgres. If anybody knows which settings to update to use the proper pg_ctl command directly, I would appreciate it!
/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_ctl -D /usr/local/var/postgre start
I ran into the same issue and after looking at the log file I found one directory was missing:
$ tail /usr/local/var/postgres/server.log
FATAL: could not open directory "pg_tblspc": No such file or directory
Then I did $ mkdir /usr/local/var/postgres/pg_tblspc, restarted PostgreSQL and got:
$ tail /usr/local/var/postgres/server.log
FATAL: could not open directory "pg_replslot": No such file or directory
After redoing the process may times I eneded up creating the following directories and then successfully started PostgreSQL:
/usr/local/var/postgres/pg_tblspc
/usr/local/var/postgres/pg_replslot
/usr/local/var/postgres/pg_twophase
/usr/local/var/postgres/pg_logical
/usr/local/var/postgres/pg_logical/mappings
I hope this helps.
I just updated to Mavericks and trying to get all my required tools and software in place.
My mongodb is not working after installing mongodb through brew.
I did: brew install mongodb --devel
Then, I ran mongod& on terminal. This gives me:
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
I tried creating a directory: mkdir -p /data/db and I got permission denied as the error.
I am referring to this website "http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/" and installing Mongo using Homebrew.
Has anyone faced this issue before? Where do I actually find /data/db directory to give permissions to it? I tried ls -la in my home folder, but couldn't find this directory.
Please ignore. Here is what helped me to solve the problem:
$ sudo mkdir -p /data/db/
$ sudo chown `id -u` /data/db