I deleted all files from /etc accidentally

As the title sais i made a big mistake!
Also commands like sudo now are not recognized.
How to solve that?
I am afraid is a little serious :p
 
Binary executables are not located in /etc, so if message you got trying software like sudo isn't complaint about missing config files but something like
Code:
command not found
, you've also deleted stuff in /usr/local/bin for ports, /bin /usr/bin or /usr/sbin for core utilities.
 
In /usr/src/etc i have the files but sudo is not working to let me copy them back to /etc
On sudo i take: sudo: unknown uid: 1001
 
Also is not responding. I take a question: Who are you?
I rebooted and i tried to use fixit from cd but cannot work because fixit cannot find /etc/fstab
 
Mhh, can you still boot?
If you reach single user mode, you can try this:
# mount -uw /
Then mount the partition where /usr/src resides on.
Go to /usr/src
# make distribution
Create a new /etc/fstab
Copy /var/backups/groups.bak and /var/backups/master.passwd.bak to /etc.
Run tzsetup(8).
Try to re-create /etc/rc.conf.
And the whole rest of /etc
Sorry to tell you that there's no other way to do that manually.


If you don't reach single user mode, you can do the same with the DVD or big USB image.
 
sk8harddiefast said:
returns fstab: /etc/fstab:0: No such file or directory
Create a new /etc/fstab.

Oh, I just realised your / will be read only. Try run the same mount command, but specify the device node too, eg. mount -uw /dev/ad0s1a /
 
sk8harddiefast said:
Ok. I copy back /etc but now on boot i take a mountroot> and is not responding. I cannot write nothing

You get that prompt because your /etc/fstab is empty or non-existant.

I hope you filled /etc the right way and not just copied the stuff. I have no idea why (else) that prompt is unresponsive. You should be able to type a question mark to get a list of your drives, then pick the right drive like so:
[cmd=]ufs:ad1s1a[/cmd]
and you're halfway into single user mode.

If the prompt does remain unresponsive, you indeed have to boot from DVD or USB-stick and edit /etc/fstab by hand or you could mount the harddrive in another system and edit /etc/fstab from there. You could probably even install etc this way (provided they are of the same FreeBSD-version) by setting DESTDIR in your make commands.
 
da1 said:
boot the install CD/DVD and copy the "base" distribution.
The base distribution contains the entire system minus the GENERIC kernel. It would be better to extract it to a third-party location and copy /etc alone using a livefs system.
 
Back
Top