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

jr.santhoshkumar

Member


Messages: 25

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
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,293
Messages: 29,742

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.
 

sidetone

Daemon

Reaction score: 383
Messages: 1,061

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.
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,293
Messages: 29,742

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.
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,293
Messages: 29,742

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?
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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

sidetone

Daemon

Reaction score: 383
Messages: 1,061

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.
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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 ?
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,293
Messages: 29,742

whether there is a way to add that /etc folder to / , so that it can boot normally.
There are around 2370 files in 34 (sub)directories in /etc/. Only creating the /etc directory isn't going to help much.
 

sidetone

Daemon

Reaction score: 383
Messages: 1,061

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.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,293
Messages: 29,742

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.
 

olli@

Well-Known Member
Developer

Reaction score: 276
Messages: 315

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.
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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
 
OP
OP
J

jr.santhoshkumar

Member


Messages: 25

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
 
Top