Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Magicly deleted all files in /etc path.

How could these operations even possible delete all my files?


I've tried to clear my postgres files on my macbook, but unluckly removed all my /etc files.

I input "rm" command to remove it but no permission. Then I tried to get the root role, that got my files deleted. Magic "sudo su" command, isn't it.


macosuser@MacBook-Pro 12 % rm /etc/postgres-reg.ini
override rw-r--r-- root/wheel for /etc/postgres-reg.ini? y
rm: /etc/postgres-reg.ini: Permission denied
macosuser@MacBook-Pro 12 % sudo su
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
sh-3.2# rm -rf /etc/postgsymlink-hook: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
res-reg.ini cd /etc/
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

^C
sh-3.2# ls
job-working-directory: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
sh-3.2# pwd
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
pwd: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory


Thanks

Posted on Nov 18, 2020 4:02 PM

Reply
Question marked as Best reply

Posted on Nov 18, 2020 6:28 PM

It's really been deleted. I just curious how this operation can delete all the files in path /etc/, unbelievable.


What operation? The commands shown in the Terminal excerpts you posted didn't do it. They didn't delete anything.


Something preceding those actions resulted in a seriously messed up installation. Restore a TM backup.

Similar questions

5 replies
Question marked as Best reply

Nov 18, 2020 6:28 PM in response to Brucecatcat

It's really been deleted. I just curious how this operation can delete all the files in path /etc/, unbelievable.


What operation? The commands shown in the Terminal excerpts you posted didn't do it. They didn't delete anything.


Something preceding those actions resulted in a seriously messed up installation. Restore a TM backup.

Nov 18, 2020 6:48 PM in response to John Galt

It may caused by the /Library/PostgreSQL/12/uninstall-postgresql.app

First I execute it, which told me I have not removed the data folder(/Library/PostgreSQL/12/data/) .

After I removed it, then I ran uninstall-postgresql.app again.


macosuser@MacBook-Pro 12 % open .
macosuser@MacBook-Pro 12 % ls
data				installation_summary.log
macosuser@MacBook-Pro 12 % ls data 
ls: data: Permission denied
macosuser@MacBook-Pro 12 % sudo su
sh-3.2# rm -rf data
sh-3.2# pwd
/Library/PostgreSQL/12
sh-3.2# ls
sh-3.2# pwd
/Library/PostgreSQL/12
sh-3.2# cd ..
sh-3.2# ls
12
sh-3.2# ls 12/
sh-3.2# cd ..
sh-3.2# rm -rf PostgreSQL/
sh-3.2# 
sh-3.2# exit
exit
macosuser@MacBook-Pro 12 % rm /etc/postgres-reg.ini
override rw-r--r-- root/wheel for /etc/postgres-reg.ini? y
rm: /etc/postgres-reg.ini: Permission denied
macosuser@MacBook-Pro 12 % sudo su
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
sh-3.2# rm -rf /etc/postgsymlink-hook: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory

Nov 18, 2020 7:55 PM in response to Brucecatcat

I think we're trying to diagnose a problem after being dropped into the middle of it, like the blind men describing an elephant with each one touching just one of its parts.


If the /etc/ directory contents are gone I don't know how that happened. I suspect they're not gone though; something else is messed up. Reinstalling macOS should fix it. It's easy enough, and nondestructive.

Magicly deleted all files in /etc path.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.