# Single User Mode: Enter full pathname of shell or RETURN for /bin/sh



## Tap (May 29, 2018)

Good Day to everyone,

After replacing one faulty Hard Disk, the FreeNAS system won't boot and giving me error.

From multi user going to single user still the same error:


```
init: NSSWITCH(_nsdispatch): files, passwd_compat, endpwent, not found, and no fallback provided.
Enter full pathname of shell or RETURN for /bin/sh:
```

by typing `/rescue/sh` still not a solution.

by hitting "Enter" still cannot type "`fsck -y`" because it still ask for "Enter full pathname of shell or RETURN for /bin/sh

windscape's answer is that it's to corrupted..

Some resources won't allow me to enter to start a shell session

Need help or solutions that may save the FreeNAS. I cannot lose the data and config inside.

Thank you,
Tap


----------



## Deleted member 54719 (May 29, 2018)

boots to multi-user but not single user?  
only happens after going multi-user and then re-initing to single user?

The symptoms seem to me that for whatever reason the root fs is not mounted in single 
user mode.

Have the disk bus locations changed?  I've notived that freeBSD is picky about boot disk location on the bus changing.


----------



## Tap (May 29, 2018)

Hello tempest766,

It autoboot on multi-user but it will terminate and automatically go to single user

and the error will appear.

I'm sorry I'm not really good in understanding things on the machine.

I don't know what are mounted or not mounted on the machine because it won't allow me to

enter on a shell command.

I haven't changed anything; Replacing the Hard Disk and Rebuild it is the process I done.

Thank you,
Tap


----------



## Deleted member 54719 (May 29, 2018)

can you boot from a USB stick and mount the NAS system disk to inspect the /etc/fstab file?  I'm wondering if it is corrupt.  I can't be much more help without console access.


----------



## SirDice (May 29, 2018)

Tap said:


> the FreeNAS system won't boot and giving me error.


PC-BSD, FreeNAS, NAS4Free, and all other FreeBSD Derivatives



Tap said:


> ```
> init: NSSWITCH(_nsdispatch): files, passwd_compat, endpwent, not found, and no fallback provided.
> ```


I suspect this error is due to a missing or corrupted /etc/nsswitch.conf. A standard FreeBSD one looks like this:

```
#
# nsswitch.conf(5) - name service switch configuration file
# $FreeBSD: stable/11/etc/nsswitch.conf 301711 2016-06-09 01:28:44Z markj $
#
group: compat
group_compat: nis
hosts: files dns
netgroup: compat
networks: files
passwd: compat
passwd_compat: nis
shells: files
services: compat
services_compat: nis
protocols: files
rpc: files
```


----------



## Tap (May 30, 2018)

Thank you for giving me a time,

and I'm sorry if I posted in the wrong thread?

I'm not really understand the machine.. also I don't have experience how to access my machine using other pendrive.

if this path/file is missing /etc/nsswitch.conf

How could I bring it back? Should I create that file and copy&paste that you wrote?

A step by step will be more helpful for me.

PS: I couldn't find anymore solution online.

And another Hard Disk just failed a few hours ago. I almost died waiting for a new hard disk and now I need to wait again for replacement.

Thank you,
Tap


----------



## ShelLuser (May 30, 2018)

Tap said:


> and I'm sorry if I posted in the wrong thread?


Have you actually read the URL? The problem is that you kinda posted in the wrong forum; the FreeBSD forum only deals with FreeBSD and not so much any derivatives such as FreeNAS. For the simple reason that many of those applied specific changes which often makes the whole thing behave differently than a vanilla FreeBSD installation.

So the best place to ask about problems like this would be the FreeNAS forum.



Tap said:


> if this path/file is missing /etc/nsswitch.conf
> 
> how could I bring it back? should I create that file and copy&paste that you wrote?



See? And here is a good example of the problem involved. We know for sure what the default nsswitch.conf on FreeBSD is but for all we know it could be something completely different on FreeNAS. Or as I like to put it: we pretend to know FreeBSD but that doesn't mean we'll know about every OS based on it.

Alas, you say that trying /rescue/sh is not a solution, but what exactly happens when you do so? What error do you get? Because that could lead us to the cause of all this.

Another question: when you boot that thingamagick, does it show you a boot menu of some sort? I'm assuming you can hook up a keyboard and all, so... if it does show you a menu, can you press space to pause or escape to drop down to a boot prompt? If you can try entering lsdev as a command and share the output.

It should tell you what disks you have, and it should also list one as type freebsd-boot, indicating that you can boot the whole thing from there. I'm also assuming it'll list a ZFS pool. If you can get this far you got everything you need to tell that system to boot, while also pointing it to the root filesystem.

PS: How many HD's are in that thing to begin with? If you had a RAID consisting of 3 disks, 2 died in the process then you might have a problem on your hand. Depending on how it was setup.


----------



## SirDice (May 30, 2018)

Tap said:


> if this path/file is missing /etc/nsswitch.conf





> The answers you may get are very likely based on FreeBSD; these answers may not apply to your product at all, and people may not even notice that your original question was not about FreeBSD
> Following advice given here (which may not be applicable to your system) may render your system unusable, or altered in a way that causes serious problems
> *These derivative products are all customised in some way, which means, among other things, that their base system, ports/package management, source code, X system, kernel configuration, libraries, disk layout, installation procedure, disk systems, etc. etc. may be very different.*
> Do not blindly follow any advice given here!


----------



## Tap (May 30, 2018)

Good Day to all,

Sorry I posted on the wrong forum. My understanding is FreeBSD and FreeNAS are same.



ShelLuser said:


> Alas, you say that trying /rescue/sh is not a solution, but what exactly happens when you do so? What error do you get? Because that could lead us to the cause of all this.



Still same, It ask for full pathname of shell.



ShelLuser said:


> Another question: when you boot that thingamagick, does it show you a boot menu of some sort? I'm assuming you can hook up a keyboard and all, so... if it does show you a menu, can you press space to pause or escape to drop down to a boot prompt? If you can try entering lsdev as a command and share the output.
> 
> It should tell you what disks you have, and it should also list one as type freebsd-boot, indicating that you can boot the whole thing from there. I'm also assuming it'll list a ZFS pool. If you can get this far you got everything you need to tell that system to boot, while also pointing it to the root filesystem.



I tried pressing the "space bar" and it won't allow me to choose on the three option. I can't really remember what are the options but on my recall the first and second option is FreeBSD and the third is LiveUSB.

It won't allow me to go on other option.



ShelLuser said:


> PS: How many HD's are in that thing to begin with? If you had a RAID consisting of 3 disks, 2 died in the process then you might have a problem on your hand. Depending on how it was setup.



The machine has RAID6 and a total of 66TB. Good timing I finish rebuilding on the first faulty HDD before it the second faulty HDD appear.

And again I'm really sorry I appear on the wrong forum.

Thank you,
Tap


----------



## SirDice (May 30, 2018)

Tap said:


> My understanding is FreeBSD and FreeNAS are same.


FreeNAS is built up using FreeBSD but it is a completely separate project and has nothing to do with the FreeBSD project itself.


----------



## ShelLuser (May 30, 2018)

Tap said:


> I tried pressing the "space bar" and it won't allow me to choose on the three option. I can't really remember what are the options but on my recall the first and second option is FreeBSD and the third is LiveUSB.


Try pressing escape. Space was basically an example, the escape key is the important one. On FreeBSD that will drop you to the boot menu itself (the 'ok>' prompt) and from there you can do many nice things (so many people seem to underestimate that one). Like that `lsdev` command I mentioned earlier.



Tap said:


> And again I'm really sorry I appear on the wrong forum.


It's all good. We're not exactly forbidden to discuss these things (one of the reasons I hold this forum in such high esteem; the rules also keep us users best interest in mind), but it is you who is discouraged to rely too much on information which is presented here. Because what works on FreeBSD could theoretically cause a disaster on FreeNAS; as SirDice said: both aren't fully the same.

Anyway, I'm also running out of ideas here. At this point I'd try to boot using a rescue media and see what you can find out from there. A FreeBSD memstick image I assume, see this link. Boot it, and then you may be able to do some _real_ diagnosing. Start by sharing the output of `gpart show`, optionally followed by letting us know is `zpool import` actually finds any ZFS pools (very important detail!).

If it finds any pools: `#zpool  import -o ro -NfR /mnt <name of your pool>`. Where '<name of...>' should obviously be replaced by the actual name. Probably zroot but that's a wild guess on my end. This command will try to import the pool in readonly mode (safety first!) won't try to mount any filesystems (see previous point) and if it goes well you can finally check the health and status of this pool: `zpool status` and `zfs list`.

If all of that checks out then I'm somewhat convinced that this situation is recoverable. But if you see any errors about a degraded pool (or if the pool doesn't import at all) then you might have a major problem on your hands, probably in the likes of "time to verify your backups".

Hope this can give some ideas. Have to admit that the whole situation looks intriguing to me.


----------

