Mistakenly /etc folder was deleted, system can't reboot!!!

I tried to copy the content of /etc to other folder, by mistake it was deleted.
Without knowledge I gave reboot command.
System is not booting. It is stoping in
mountroot>

Please help me to boot my system.
Thanks in advance
 
Did you move (rename) the directory instead of copying or did you actually delete it? If you moved/renamed it you can probably restore it back to its original name if you boot from one of the install mediums and use the shell.
 
Many /etc/ files can be copied from the FreeBSD install CD. Then, you'll have to adjust /etc/fstab for it to mount. Continue customizing your /etc/ files.
 
Did you move (rename) the directory instead of copying or did you actually delete it? If you moved/renamed it you can probably restore it back to its original name if you boot from one of the install mediums and use the shell.
I deleted /etc
If I try to do any modification in /
It is telling like read only file system
 
Many /etc/ files can be copied from the FreeBSD install CD. Then, you'll have to adjust /etc/fstab for it to mount. Continue customizing your /etc/ files.
I copied /etc folder to my memstick and
I tried to copy /etc to / in FreeBSD
But it is telling like, file system is mounted in read only mode
I tired to change the mode read write, but it is asking for the file /etc/fstab.
Unfortunately everything was deleted.
 
I actually think you deleted a lot more than just /etc. Without a valid /etc/ the system would still boot the kernel and then get stuck in single user mode. The mountroot prompt shows you're stuck in loader(8) which happens before the kernel is loaded.
 
I actually think you deleted a lot more than just /etc. Without a valid /etc/ the system would still boot the kernel and then get stuck in single user mode, the mountroot prompt shows you're stuck in loader(8).
For clear understanding, I attach a image
Please do the needful
 

Attachments

  • Screenshot from 2019-02-06 18:45:25.png
    Screenshot from 2019-02-06 18:45:25.png
    516.4 KB · Views: 134
  • Screenshot from 2019-02-06 18:45:00.png
    Screenshot from 2019-02-06 18:45:00.png
    538.4 KB · Views: 145
It looks like you have a lot more issues than just a missing /etc. Your root filesystem is /dev/ada0s3a not ada0s3 (that's a slice). As the filesystem is also dirty you'll need to fsck(8) it first. Then mount -u /dev/ada0s3a / should mount it read/write. You can't use mount -u / because that depends on /etc/fstab (which is missing).

You do have backups, right?
 
It looks like you have a lot more issues than just a missing /etc. Your root filesystem is /dev/ada0s3a not ada0s3 (that's a slice). As the filesystem is also dirty you'll need to fsck(8) it first. Then mount -u /dev/ada0s3a / should mount it read/write. You can't use mount -u / because that depends on /etc/fstab (which is missing).
After executing that command,
the output is R/W mount of / denied. Filesystem is not clean
 

Attachments

  • Screenshot from 2019-02-06 19:00:54.png
    Screenshot from 2019-02-06 19:00:54.png
    321.6 KB · Views: 144
I actually think you deleted a lot more than just /etc. Without a valid /etc/ the system would still boot the kernel and then get stuck in single user mode. The mountroot prompt shows you're stuck in loader(8) which happens before the kernel is loaded.
Mine did that when I switched connectors of physical harddrives around. /boot/ stayed the same, but now I realize that the error in this thread is not yet based on /etc/. /etc/ is part of the problem, but the error wasn't at that point yet.

It didn't necessarily have to do with altering the /boot/ directory. If it had to do with switching hard drive cables, labeling partitions for mounting is useful for future use http://www.wonkity.com/~wblock/docs/html/labels.html.
 
Mine did that when I switched connectors of physical harddrives around. /boot/ stayed the same, but now I realize that this error is not yet based on /etc/. /etc/ is part of the problem, but the error wasn't at that point yet.
Are you telling, this error is not only because of the /etc folder got deleted ?
 
The specific error with the mountroot> prompt is either because /boot/ got altered or deleted as SirDice said, or because hardware connectors were switched.
I am sure that I didn't touch /boot/ folder
I think it is because of deletion of /etc folder
whether there is a way to add that /etc folder to / , so that it can boot normally.
 
I am sure that I didn't touch /boot/ folder
I think it is because of deletion of /etc folder
whether there is a way to add that /etc folder to / , so that it can boot normally.
Check your /boot/ directory to be sure. Also, it could have possibly been just from lacking /etc/fstab. Above, I said to copy the /etc/ directory from the FreeBSD install CD, then to manually modify the files, especially /etc/fstab, so it will boot.
 
You can try copying it from the install media. Remove /etc/rc.local though, that actually starts the installer. Then modify /etc/fstab and /etc/rc.conf for your system. Hopefully that's enough to restore some basic functionality.
 
The easiest and fastest way to recover from that situation is to boot FreeBSD from a USB stick, and then restore the /etc directory from your backup.
 
The easiest and fastest way to recover from that situation is to boot FreeBSD from a USB stick, and then restore the /etc directory from your backup.
I tried this method
I am using 12.0 stable version, so it is showing error like it is not matching with latest version
Because of that I have reinstalled again.
Thank you for spending your time for help me
 
You can try copying it from the install media. Remove /etc/rc.local though, that actually starts the installer. Then modify /etc/fstab and /etc/rc.conf for your system. Hopefully that's enough to restore some basic functionality.
Sir, I tried many methods but i end up with some error at last
So, I reinstalled again new memstickimage
Thank you SirDice
 
Back
Top