jexec returns: jexec: execlp: /usr/local/bin/zsh: No such file or directory

Joined
Jun 24, 2017
Messages
338
Hey gentlemen, got a weird issue (it happened a few weeks ago when i was rebuilding my NAS...

Anyway, I cant log into my jails. if I use jexec from the console shell, i get:
jexec returns: jexec: execlp: /usr/local/bin/zsh: No such file or directory

If I SSH into the jail, It acts as if I do not have a login/user... no combination of users that ive ever used will let me log in... does there happen to be a default user/login with root privledges that I could use to log into it? (The jail works, i just cant maintain it in any way)
 

blanchet

Guru
Joined
Apr 17, 2018
Messages
516
It means that zsh is not installed in your jail. Try to login with another shell
Code:
jls
jexec YOUR-JAIL-ID /bin/sh


If you are using FreeNAS 11.2 or later, your can use use iocage(8) instead of using jexec(8)
Code:
iocage list
iocage console your-jail-name
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977

tfjad

Dabbler
Joined
Nov 1, 2016
Messages
12
I wonder how the shell could have changed inside your jail... It would be easier to help, if you would have given the whole jexec line you have been trying to run. What FreeNAS version do you have?

Since you are using jexec, I assume this is a legacy i.e warden jail, and NOT iocage jail. The following rather horrible one-liner will reset the 'root' user shell from zsh to /bin/csh in the legacy jail called NAME. Replace NAME with the name of your jail near the start of the line
Code:
jailname=NAME; sed -ri '' 's#(^root:.*)/usr/local/bin/zsh#\1/bin/csh#' `find /mnt -type d -maxdepth 2 -name jails`/$jailname/etc/passwd

To get all the quote marks correctly, I suggest you copy the whole line to the FreeNAS Shell, edit the NAME, and run it.

edit: if you get some errors like "command not found", you are probably in a csh shell. Run first bash or zsh and then try again with that line. Sorry about this oversight.
 
Last edited:
Joined
Jun 24, 2017
Messages
338
I wonder how the shell could have changed inside your jail... It would be easier to help, if you would have given the whole jexec line you have been trying to run. What FreeNAS version do you have?

Since you are using jexec, I assume this is a legacy i.e warden jail, and NOT iocage jail. The following rather horrible one-liner will reset the 'root' user shell from zsh to /bin/csh in the legacy jail called NAME. Replace NAME with the name of your jail near the start of the line
Code:
jailname=NAME; sed -ri '' 's#(^root:.*)/usr/local/bin/zsh#\1/bin/csh#' `find /mnt -type d -maxdepth 2 -name jails`/$jailname/etc/passwd

To get all the quote marks correctly, I suggest you copy the whole line to the FreeNAS Shell, edit the NAME, and run it.

edit: if you get some errors like "command not found", you are probably in a csh shell. Run first bash or zsh and then try again with that line. Sorry about this oversight.


will this effect anything else other than the root user?

iocage commands do work, im just not familiar with them... sorry...

And to answer, I am on 11.2-U7 and i was using "jexec #" with the # being the number of the jail i am trying to work with... in this case, 3.
 
Joined
Jun 24, 2017
Messages
338
THANKS GUYS!!!!

Using the iocage login, I was able to log into the jail and create a user that I can log into with SSH... So, PROGRESS!!!!

Thanks again guys for your help!
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,977
jls (to get my jails numbers...)
"jexec 3" (to log into the jail i want to work with)
Try jexec 3 csh You can specify the shell type when you log into the jail.
 

tfjad

Dabbler
Joined
Nov 1, 2016
Messages
12
will this effect anything else other than the root user?

iocage commands do work, im just not familiar with them... sorry...

And to answer, I am on 11.2-U7 and i was using "jexec #" with the # being the number of the jail i am trying to work with... in this case, 3.
The long command only does that one thing, nothing else. And in your case it would result in a "file not found" type error, since you do have an iocage jail.

I think it is better to use the iocage command with iocage jails. In the following examples, replace NAME with the name of your jail.

To get into the jail's shell on the command line:
Code:
iocage console NAME

or use the FreeNAS UI / Jails, and on the NAME line in the three-dots-menu select Shell

To execute a command in the jail (like jexec):
Code:
iocage exec NAME [your command]

where [your command] can be any command you want to run in jail NAME.

I very much encourage you to use the excellent man help system on the command line. Type man iocage to get help on all things considering iocage.
 
Top