# Cannot login to system



## jaymax (Jul 23, 2009)

O/S 6.0

I've had to restore a kernel, untar a backup of the /etc directory to the / and now I can not login.

Any suggestions?


----------



## SirDice (Jul 23, 2009)

Boot to single user mode. After that:

```
# fsck
# mount -u /
# mount -a -t ufs
```
Then you can change the root password.


----------



## jaymax (Jul 23, 2009)

Well, the prob. is more complex apparently. When I rebooted the system, it did not go past the loader stage => Can't load kernel. At that stage I can't find fsck, looked in bin/ and found nothing.
Did a "boot/GENERIC/kernel-2" for a kernel that I had stored away, the system booted up but at the login prompt it failed to respond.

My suspicion is that the etc/passwd file in the etc/ directory was not installed. Is there a way of restoring the original file, as it has other users on it?

Alternately, I have a dump file of the entire disk but restore apparently is not a command option at this level (i.e. loader level), oddly enough dump is. 

Thanks


----------



## graudeejs (Jul 23, 2009)

You can restore password files from your file system dump with restore without restoring entire system. Check restore man page [interactive mode]

You'll need to start from fixit cd or DVD, mount your root, cd to it, and then enter restore in interactive mode..... [I don't remember precisely commands.... I have been using this only twice)


----------



## jaymax (Jul 23, 2009)

Thanks !
Except that with no access to my machine, I have no man access, Fixit does not provide one either. Anyway, I see your approach. Now how do I mount root from this shell? There is no /etc/fstab available, is there a way of getting the raw disk label from Fixit shell, df -k => nothing since / is not mounted. 

A little push start her should get me on my way

Thanks again


----------



## LateNiteTV (Jul 23, 2009)

http://www.freebsd.org/cgi/man.cgi


----------



## graudeejs (Jul 23, 2009)

ls /dev

something that ends with a will be your root
(either ad0s1a, da0s1a or something like that [it depends on configuration, you may not use labels at all])

You can read manpages online
restore(8)


EDIT:
df only shows mounted partitions


----------



## jaymax (Jul 24, 2009)

Thanks!
I naively thought this would be smooth sailing.
It is ad0sa1 as it is an EIDE drive. I tried the following, to no avail:


```
mount /dev/ad0as1 /mnt
mount /dev/ad0as1
mount /ad0as1 /mnt
mount /ad0as1
```

I think my problem might be coming from the fact that there is no kernel present, except for the one loaded from the FIXIT disc, I DON'T KNOW!, sublime ignorance on my part.

When I use the kernel from boot/<another location> I have to do so each time I attempt a run. I cannot mv it to the boot/kernel or boot/GENERIC/kernel directory. That maybe I don't know, is part of my problem.??

Is there a way, while in the loader that I can move a kernel to the boot/GENERIC/kernel directory? 

Thanks!


----------



## SirDice (Jul 24, 2009)

Hmm ad0as1 doesn't look right. It's probably ad0s1a. ad0 - first HD, s1 - first slice, a - first partition.


----------



## jaymax (Jul 25, 2009)

*Solved*

Thanks guys!


----------

