Thursday, 10 October 2019

permissions - MacOS switched root Mongodb data folder to system ownership and it cannot be changed back anymore


The title gives it away, I suppose.


Here's the deal:


MacOS switched my /data/db folder, which is used by MongoDB, which I need to get a ton of work done, to read-only file system. Basically happened overnight.


Running ls -lO /data returns the following: drwxr-xr-x 182 root admin - 5824 Jul 11 17:33 db


Trying to run sudo chmod -R 777 $USER /data returns the following: chmod: Unable to change file mode on /data/db/index-32-577782821146278306.wt: Read-only file system for a total of A LOT of entries.


I presume it's the SIP that's causing this. I tried disabling it in the recovery mode by running csrutil disable. That did disable it, but still didn't let me change my permissions.


I'm all out of ideas as to what could be happening. Perhaps my account is broken?



Answer



I found out the reason for this nonsense. It's Apple.


Basically, what is happening here is that the new version of MacOS, which is Catalina, now has System root folder as read only. So any software that needs to use the root folder for whatever reason is screwed.


My solution was to do the following:



  1. Boot into recovery mode by shutting down the machine and starting it up via Cmd + R + Boot

  2. Once in recovery open up the terminal

  3. Disable SIP using csrutil disable

  4. Restart the machine

  5. When booted into MacOS Catalina open up the terminal

  6. Run sudo mount -uw /


This will give you root access for the current session. It will be reset upon next start up. Though now you can do a lot of things in the root folder, like move your stuff elsewhere.


So what I've done is moved the whole /data folder to /System/Volumes/Data using this command: sudo mv /data /System/Volumes/Data


Apparently that is the preferred place to put all the data. And according to the new way that the root folder works you can have links for these folders so they would act as if they were part of the root folder. That, obviously, didn't work for me. However, I'm still able to run mongod and setting the dbpath as follows:


sudo mongod --dbpath /System/Volumes/Data/data/db


Hope this helps anyone who encounters this asinine decision by Apple. This whole Catalina update is a resounding mess.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...