Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Can't access jails via SSH

Status
Not open for further replies.

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
FreeNAS-9.3-STABLE-201501212031
Supermicro X10SL7-F with Intel Xeon E3-1230 v3 and 32703MB [Crucial] (CT2KIT102472BD160B)
6 X Western Digital Red 3 TB in RAID-Z2 config
------------------------------------------------------------
I'm having trouble accessing any of my jails though SSH. The access jail command always gives the same error.
Everytime I run the command "sudo jexec 4 tcsh" also tried "sudo jexec 4 csh" and "sudo jexec 4 /bin/tcsh"
Code:
ricky@freenas:~ % jls
   JID  IP Address      Hostname                      Path
     4  -               plex                           /mnt/tank/Jails_Dataset/plex

Code:
 jexec: execvp(): tcsh: No such file or directory


I've created a user called ricky who is permitted to use sudo and added myself to the wheel group also.

Now, I've read in some of the other threads that it's trying to use the freenas usb storage possibly, however I've created a dataset to store any created jails and so each jail I create should have it's own dataset underneath it.
Jail root = /mnt/tank/Jails_Dataset
plex = /mnt/tank/Jails_Dataset/plex

I've also tried logging in as root via SSH and executing the commands minus the sudo but still get the same error.

Running the command "echo $shell" tells me running my SSH terminal as csh.
Code:
ricky@freenas:~ %  echo $shell
/bin/csh


I'd be grateful if someone can point me in the right direction. Once I can even access my jails, then I can start configuring by adding users etc and installing programs.
 

Jailer

Not strong, but bad
Joined
Sep 12, 2014
Messages
4,361
Once you're logged in through SSH type su to switch to root. You'll be prompted for the root password and then you can run your commands. And drop the sudo and just use jexec (jail ID number) /bin/tcsh
 

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
Still getting the same error I'm afraid.
Code:
Welcome to FreeNAS
ricky@freenas:~ % su
Password:
[ricky@freenas] /nonexistent# jls
   JID  IP Address      Hostname                      Path
     4  -               plex                           /mnt/tank/Jails_Dataset/plex
[ricky@freenas] /nonexistent# jexec 4 /bin/tcsh
jexec: execvp(): /bin/tcsh: No such file or directory


When creating the superuser, I left the directory to /nonexistent. Is there a specific directory I need to be in. The root account was left as /root.
Same error when I go out of the /nonexistent folder.
 
Last edited:

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
It results in the same error as above :(
I've restarted, reset to factory defaults, and re-installed the jail but still results in the error.
 

Glorious1

Neophyte Sage
Joined
Nov 23, 2014
Messages
1,019
My first guess would be that those shells are missing, or that the path to them is not included in your default path.
See if they are in /bin. If so, do "echo $PATH" and see if "/bin" is one of the items between colons.

Edit: No, now I see in your output that it did look for /bin/tcsh and didn't find it. So it must not be there!
 
D

dlavigne

Guest
Does sudo jexec 4 /bin/sh work? I'd be very surprised if Bourne isn't installed.
 

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
Thank you everyone for all the replies and helping me trying to troubleshoot this problem.
Code:
ricky@freenas:~ % echo $PATH
/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/nonexistent/bin

Code:
ricky@freenas:~ % sudo jexec 4 /bin/sh
Password:
jexec: execvp(): /bin/sh: No such file or directory

Also tried sudo jexec 4 /bin/sh whilst logging into root also. Same error. Hmm. I did look in my /bin folder and tsch and sh are there. Just not sure why it keeps saying it isn't.

Code:
[ricky@freenas] /bin# ls
./          cp*         expr*       mkdir*      realpath*   stty*
../         csh*        getfacl*    mv*         red*        sync*
[*          date*       hostname*   pax*        rm*         tcsh*
bash@       dd*         kenv*       pgrep*      rmail@      test*
cat*        df*         kill*       pkill*      rmdir*      unlink*
chflags*    domainname* link*       ps*         setfacl*    uuidgen*
chio*       echo*       ln*         pwait*      sh*
chmod*      ed*         ls*         pwd*        sleep*
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,387
Let's back up a bit. How, exactly, did you create this jail?

Showing what's in /bin on your FreeNAS system doesn't really help, because jexec is trying to run /bin/sh (or /bin/csh, or /bin/tcsh) inside your jail. What do you get if you run ls -l /mnt/tank/Jails_Dataset/plex/bin/*sh?
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,387
...alternatively, what happens if you launch the web GUI, go to the jails screen, select your Plex jail, and click the shell button at the bottom of the window? If that comes up, what happens if you do ls /bin/*sh?
 

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
Code:
ricky@freenas:~ % ls -l /mnt/tank/Jails_Dataset/plex/bin/*sh
ls: No match.


Code:
ricky@freenas:~ % ls -l /mnt/tank/Jails_Dataset/plex/
total 26
drwxrwxr-x  3 root  wheel     4 Jan 23 07:08 ./
drwxrwxrwx  6 root  wheel     6 Jan 23 07:08 ../
-r-xr-xr-x  1 root  wheel  1009 Jan 23 07:08 etc*
drwxr-xr-x  3 root  wheel     3 Jan 23 07:08 usr/


It looks as if, the folder isn't even there in the actual jail?

I created the initial jail by first defining the root in the config part as /mnt/tank/Jails_Dataset/
Creating the jail was done by Add jail > advanced mode> Gave an IP and netmask /24, autostart and vimage are both selected and created a name for the actual jail.

When I go to the web GUI and click the shell button for the plex jail (or any other jail I create) the shell appears for a split second and then goes off. Ive tested this on Chrome initially with the same result on Firefox.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,387
Your jail is very, very broken. It should contain an entire FreeBSD root filesystem, but as you see, the only directory present is usr/ (it doesn't even have etc as a directory, which is just bizarre).

Try doing ls -l /mnt/tank/Jails_Dataset/.warden-template-standard/. It should look like this:
Code:
total 195
drwxr-xr-x  17 root  wheel    21 Dec 28 15:14 ./
drwxr-xr-x  22 root  wheel    24 Jan 24 08:02 ../
-rw-r--r--   2 root  wheel   965 Jul 10  2014 .cshrc
-rw-r--r--   2 root  wheel   253 Jul 10  2014 .profile
-r--r--r--   1 root  wheel  6197 Jul 10  2014 COPYRIGHT
drwxr-xr-x   2 root  wheel    46 Jul 10  2014 bin/
drwxr-xr-x   7 root  wheel    40 Jul 10  2014 boot/
dr-xr-xr-x   2 root  wheel     3 Aug 31 18:01 dev/
drwxr-xr-x  21 root  wheel    99 Aug 31 18:01 etc/
drwxr-xr-x   3 root  wheel    49 Jul 10  2014 lib/
drwxr-xr-x   3 root  wheel     5 Aug 31 18:00 libexec/
drwxr-xr-x   2 root  wheel     2 Jul 10  2014 media/
drwxr-xr-x   2 root  wheel     2 Jul 10  2014 mnt/
dr-xr-xr-x   2 root  wheel     2 Jul 10  2014 proc/
drwxr-xr-x   2 root  wheel   144 Jul 10  2014 rescue/
drwxr-xr-x   2 root  wheel     6 Jul 10  2014 root/
drwxr-xr-x   2 root  wheel   132 Jul 10  2014 sbin/
lrwxr-xr-x   1 root  wheel    11 Jul 10  2014 sys@ -> usr/src/sys
drwxrwxrwt   2 root  wheel     2 Aug 31 18:01 tmp/
drwxr-xr-x  15 root  wheel    15 Jul 10  2014 usr/
drwxr-xr-x  24 root  wheel    24 Jul 10  2014 var/
 

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
Code:
ricky@freenas:~ % ls -l /mnt/tank/Jails_Dataset/.warden-template-standard/.
total 195
drwxrwxrwx  17 root  wheel    21 Jan 22 18:19 ./
drwxrwxrwx   6 root  wheel     6 Jan 23 07:08 ../
-rwxrwxrwx   2 root  wheel   965 Jul 11  2014 .cshrc*
-rwxrwxrwx   2 root  wheel   253 Jul 11  2014 .profile*
-rwxrwxrwx   1 root  wheel  6197 Jul 11  2014 COPYRIGHT*
drwxrwxrwx   2 root  wheel    46 Jul 11  2014 bin/
drwxrwxrwx   7 root  wheel    40 Jul 11  2014 boot/
drwxrwxrwx   2 root  wheel     3 Aug 31 23:01 dev/
drwxrwxrwx  21 root  wheel    99 Aug 31 23:01 etc/
drwxrwxrwx   3 root  wheel    49 Jul 11  2014 lib/
drwxrwxrwx   3 root  wheel     5 Aug 31 23:00 libexec/
drwxrwxrwx   2 root  wheel     2 Jul 11  2014 media/
drwxrwxrwx   2 root  wheel     2 Jul 11  2014 mnt/
drwxrwxrwx   2 root  wheel     2 Jul 11  2014 proc/
drwxrwxrwx   2 root  wheel   144 Jul 11  2014 rescue/
drwxrwxrwx   2 root  wheel     6 Jul 11  2014 root/
drwxrwxrwx   2 root  wheel   132 Jul 11  2014 sbin/
lrwxr-xr-x   1 root  wheel    11 Jul 11  2014 sys@ -> usr/src/sys
drwxrwxrwx   2 root  wheel     2 Aug 31 23:01 tmp/
drwxrwxrwx  15 root  wheel    15 Jul 11  2014 usr/
drwxrwxrwx  24 root  wheel    24 Jul 11  2014 var/


It seems that the warden dataset is intact when I compare it to your post.
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,387
The permissions don't look right, but at least all the directories appear to be there. What about du -sh /mnt/tank/Jails_Dataset/.warden-template-standard/ ? Mine gives 2.6 GB.

Edit: also try ls -l /mnt/tank/Jails_Dataset/.warden-template-standard/.zfs/snapshot/clean
 

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
The first command gives a nice 2.6 GB also. The second command you mentioned just gives a no such file/directory error. I haven't set up any periodic snapshots as of yet if that's the reason it's resulting in the error.

Code:
ricky@freenas:~ % ls -l /mnt/tank/Jails_Dataset/.warden-template-standard/.zfs/snapshot/clean
ls: /mnt/tank/Jails_Dataset/.warden-template-standard/.zfs/snapshot/clean: No such file or directory
 

danb35

Wizened Sage
Joined
Aug 16, 2011
Messages
11,387
As I understand it (and I'm pretty hazy on this, so I'd appreciate if anyone who knows better than I could jump in), when you first create a jail with a given template, that template is downloaded, expanded into its own dataset, and a snapshot called "clean" is created. Your jail is then cloned from that snapshot. In your case, the snapshot isn't there, so the cloning doesn't work and there's nothing in your jail.

Here's something that I think might work:
  • Delete your jail
  • At the command line, type 'zfs snapshot tank/Jails_Dataset/.warden-template-standard@clean'
  • Recreate the jail
  • Try 'jexec jailnum csh' again
Since you're creating the snapshot, the jail should be successfully cloned from it, and should have all its normal contents. I have to say I'm guessing here, based on what I've observed when creating a test jail earlier this morning and seeing what's in the system log. I don't think this will hurt anything, but I certainly can't guarantee the outcome.
 

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
It just says the dataset already exists when I try to use the command.
Code:
[ricky@freenas] /nonexistent# zfs snapshot tank/Jails_Dataset/.warden-template-standard@clean
cannot create snapshot 'tank/Jails_Dataset/.warden-template-standard@clean': dataset already exists


I still followed the rest of the commands and still results in "No such file or directory" when using the jexec command.

My FreeNAS configuration was in it's early stages with no sensitive data, so I can easily re-install FreeNAS or even install another version if there's a chance it would fix the problem.
 

ricky_198

Junior Member
Joined
Jan 1, 2015
Messages
18
Managed to get access to jails by doing a complete clean re-install of FreeNAS (using latest stable 201501241715) from the initial installation of the boot USB to actual GUI config.
My thanks goes out to everyone who helped me diagnose the problem. Cheers!
 
Status
Not open for further replies.
Top