Can't start MongoDB on OSX - macos

I'm trying to run MongoDB on OSX and encountering a common problem, Error with exit code 1.
Here's my very simple mongod.conf:
systemLog:
destination: file
logAppend: true
path: ~/Documents/test/mongodb/mongodb.log
storage:
directoryPerDB: true
dbPath: ~/Documents/test/mongodb/mongodb_data
journal:
enabled: true
processManagement:
fork: true # fork and run in background
net:
port: 27017
I 777'd all the folders so there's no way it can be a permissions issue (right? :P)
mac$ ls -lah ~/Documents/test/mongodb/
total 8
drwxr-xr-x 5 mac staff 170B Dec 4 15:34 .
drwxr-xr-x 11 mac staff 374B Dec 4 15:19 ..
-rwxrwxrwx 1 mac staff 301B Dec 4 15:21 mongod.conf
-rwxrwxrwx 1 mac staff 0B Dec 4 15:21 mongodb.log
drwxrwxrwx 2 mac staff 68B Dec 4 15:18 mongodb_data
But it still gets this error code!
mac$ sudo mongod -f ~/Documents/test/mongodb/mongod.conf
about to fork child process, waiting until server is ready for connections.
forked process: 70062
ERROR: child process failed, exited with error number 1
Things I've tried from other questions:
Apparently I shouldn't have to run this as sudo (?), I've tried both sudo and no sudo, same result
Could be a permissions issue (Starting mongod fails unless run as root) - well the mongodb_data directory and the conf and log are all 777 so can that really be the case? I've tried chown on all of them too but no effect.
Remove the pid location in your mongod.conf (done, doesn't have any effect) Starting mongod fork, ERROR: child process failed, exited with error number 1
Also:
mongodb.log has nothing in it after multiple start attempts
mongodb_data/ has nothing in it either (no .lock file or whatever, just empty)
Any ideas?

This is probably error with log file. It's strange that yours is 0 bytes.
Anyway you do not need to make 777 permissions, you do not need to run mongod with sudo on OSX system.
Try to do the following:
mkdir ~/sometest
cd ~/sometest
cp ~/Documents/test/mongodb/mongod.conf .
Replace systemLog path to mongodb.log, replace dbpath to data
mkdir data
Start mongod (mongod -f mongod.conf)

Related

Can't run Yarn on fish shell on MAC Ventura with nvm

in my MAC with Ventura os I can't run yarn on fish shell:
fish: Unknown command: yarn
I tried to run the following command according to the documentation:
set -U fish_user_paths (yarn global bin) $fish_user_paths
After running it, yarn works fine on fish shell.
However after reboot it stops working again.
I tried also to edit the config.fish file with:
if status is-interactive
# Commands to run in interactive sessions can go here
end
set -U fish_user_paths (yarn global bin) $fish_user_paths
But after reboot nothing changes...
In the variables I see:
fish_user_paths /Users/myusername/.yarn/bin
'/Users/myusername/.yarn/bin' '/usr/local/bin' '/System/Cryptexes/App/usr/bin' '/usr/bin' '/bin' '/usr/sbin' '/sbin'
However in the /Users/myusername/.yarn/bin path I see:
~/.y/bin> ls -la
total 0
drwxr-xr-x 3 myusername group 96 Feb 7 15:29 ./
drwxr-xr-x 3 myusername group 96 Feb 7 15:29 ../
lrwxr-xr-x 1 myusername group 59 Feb 7 15:29 create-next-app# -> ../../.config/yarn/global/node_modules/.bin/create-next-app
Can anyone please help?

.jupyter cannot be deleted or written to

My jupyter notebook command stopped working, and I believe it is because my .jupyter directory is behaving strangely.
If I try to delete it, it neither errors or gets deleted.
For example, this works, but should not.
rm -rf .jupyter
cd .jupyter
If I then run,
touch hello.txt
I get touch: hello.txt: Invalid argument
Has anyone run into this and solved it?
More Info
I don't think it's a symlink:
(py36) ➜ ~ ls -halt .jupyter
total 0
drwxr-xr-x+ 389 shleifer staff 13K Jul 5 19:25 ../
drwxr-xr-x 10 shleifer staff 320 Dec 28 2019 ./

How can I run bash in a new container of a docker image?

I am able to run arbitrary shell commands in a container created from docker/whalesay image.
$ docker run docker/whalesay ls -l
total 56
-rw-r--r-- 1 root root 931 May 25 2015 ChangeLog
-rw-r--r-- 1 root root 385 May 25 2015 INSTALL
-rw-r--r-- 1 root root 1116 May 25 2015 LICENSE
-rw-r--r-- 1 root root 445 May 25 2015 MANIFEST
-rw-r--r-- 1 root root 1610 May 25 2015 README
-rw-r--r-- 1 root root 879 May 25 2015 Wrap.pm.diff
drwxr-xr-x 2 root root 4096 May 25 2015 cows
-rwxr-xr-x 1 root root 4129 May 25 2015 cowsay
-rw-r--r-- 1 root root 4690 May 25 2015 cowsay.1
-rw-r--r-- 1 root root 54 May 25 2015 install.pl
-rwxr-xr-x 1 root root 2046 May 25 2015 install.sh
-rw-r--r-- 1 root root 631 May 25 2015 pgp_public_key.txt
$ docker run docker/whalesay lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
However, I am unable to run a shell in a container created from this image.
$ docker run docker/whalesay bash
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7ce600cc9904 docker/whalesay "bash" 5 seconds ago Exited (0) 3 seconds ago loving_mayer
Why did it not work? How can I make it work?
If you docker run without attaching a tty, and only call bash, then bash finds nothing to do, and it exits. That's because by default, a container is non-interactive, and a shell that runs in non-interactive mode expects a script to run. Absent that, it will exit.
To run a disposable new container, you can simply attach a tty and standard input:
docker run --rm -it --entrypoint bash <image-name-or-id>
Or to prevent the above container from being disposed, run it without --rm.
Or to enter a running container, use exec instead:
docker exec -it <container-name-or-id> bash
In comments you asked
Do you know what is the difference between this and docker run -it --entrypoint bash docker/whalesay?
In the two commands above, you are specifying bash as the CMD. In this command, you are specifying bash as the ENTRYPOINT.
Every container is run using a combination of ENTRYPOINT and CMD. If you (or the image) does not specify ENTRYPOINT, the default entrypoint is /bin/sh -c.
So in the earlier two commands, if you run bash as the CMD, and the default ENTRYPOINT is used, then the container will be run using
/bin/sh -c bash
If you specify --entrypoint bash, then instead it runs
bash <command>
Where <command> is the CMD specified in the image (if any is specified).

RHEL Environment Variable Path To Mongo Shell

I have installed mongodb in one of our environments & this has been done using MongoDb Operations Manager. Though i have my PATH variable set correctly i'm unable to connect mongo shell with my user account but able to connect as a sudo. could someone help me if i'm missing anything here.
Details:
[user01#west.company.com#rhel01 /]$ echo $PATH
> /var/lib/mongodb-mms-automation/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/nfs/home/user01/.local/bin:/nfs/home/user01/bin
[user01#west.company.com#rhel01 /]$ mongo
> -bash: mongo: command not found
[user01#west.company.com#rhel01 /]$ sudo -i
[sudo] password for user01#west.company.com:
[root#rhel01 ~]# echo $PATH
> /var/lib/mongodb-mms-automation/bin:/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root#rhel01 ~]# mongo
> MongoDB shell
> version: 3.2.10 connecting to: test
> MongoDB Enterprise MYMONGOREPLSET01:PRIMARY>
Which Mongo Output:
[user01#west.company.com#rhel01 /]$ which mongo
/usr/bin/which: no mongo in (/var/lib/mongodb-mms-automation/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/nfs/home/user01/.local/bin:/nfs/home/user01/bin)
[root#rhel01 ~]# which mongo
/var/lib/mongodb-mms-automation/bin/mongo
Observation:
i just noticed the bin location is set like this ...
[root#rhel01 mongodb-mms-automation]# pwd
/var/lib/mongodb-mms-automation
[root#rhel01 mongodb-mms-automation]# ls -la
total 32
drwxr-xr-x 3 mongod mongod 4096 Mar 30 13:58 .
drwxr-xr-x. 57 root root 4096 Apr 1 03:23 ..
lrwxrwxrwx 1 mongod mongod 67 Nov 4 13:45 bin -> /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin
-rw------- 1 mongod mongod 1024 Mar 27 15:07 keyfile
-rw------- 1 mongod mongod 10686 Mar 30 13:58 mms-cluster-config-backup.json
drwxr-x--- 4 mongod mongod 4096 Nov 4 13:45 mongodb-linux-x86_64-3.2.10-ent
Try this
sudo chmod -R 777 /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin/
add this to path /var/lib/mongodb-mms-automation/mongodb-linux-x86_64-3.2.10-ent/bin

How do I use chmod to change permissions?

I want to enable Remote Connections to MySQL on 1&1
i followed their explanation
https://help.1and1.com/servers-c37684/dedicated-server-linux-c37687/administration-c37694/enable-remote-connections-to-mysql-a781586.html
but the file system is Read-only.
with ls -l ==>
drwxr-xr-x 3 root root 4096 Nov 8 16:43 mysql
inside this folder mysql i have this file
-rw-r--r-- 105 root root 3533 Oct 22 2015 my.cnf
with ls -alt
***drwxr-xr-x 88 root root 4096 Nov 8 16:52 ..
drwxr-xr-x 3 root root 4096 Nov 8 16:43 .
-rw-r--r-- 105 root root 3533 Oct 22 2015 my.cnf***
I want to modify this file with chmod
but i have this error
chmod: changing permissions of 'my.cnf': Read-only file system
How to make a my.cnf writable? and after modification make it readable
Thanks
If a filesystem has been mounted read-only, chmod will not work since it's a write operation too.
sudo mount -o remount,rw '/mnt/yourmounthere'
If the device has a write lock on it (like SD memory cards), you need to turn it off. Hardware locks cannot be disabled by software. Note that the write lock on SD memory cards is located from the sight you see the letters near the up left corner and it looks like a very small switch.
"sudo chmod 777 my.cnf" for change like root user

Resources