# jls Showing Multiple JIDs per Jail



## bsd10 (Jun 3, 2011)

On


```
# uname
FreeBSD 8.1-RELEASE-p4 amd64
```

jls is showing multiple jails for individual jails created with


```
# ezjail-admin create
```

The output is like this:


```
# jls
   JID  IP Address      Hostname                      Path
     1  192.x.x.1       jail1                         /usr/jails/jail1
     2  192.x.x.2       jail2                         /usr/jails/jail2
     3  192.x.x.3       jail3                         /usr/jails/jail3
     4  192.x.x.2       jail2                         /usr/jails/jail2
     7  192.x.x.1       jail1                         /usr/jails/jail1
```

Are multiple instances of jail1 and jail2 running, and if so what is causing this?


----------



## pbd (Jun 3, 2011)

I don't know what is causing it, but you can check whether they are running or not by


```
# jexec 4 hostname
# jexec 7 hostname
```

If it returns their hostname, then they are running.


----------



## bsd10 (Jun 3, 2011)

Yes-they are both running.


----------



## anomie (Jun 3, 2011)

I've not seen that one before -- and I am not sure how you got things into that state. I recommend stopping the duplicated jails (both instances, if needed), and then starting them again.


----------



## bsd10 (Jun 4, 2011)

So this is kind of weird. After running

```
# /usr/local/etc/rc.d/ezjail.sh stop jail2
```

I get

```
# jls
   JID  IP Address      Hostname                      Path
     1  192.x.x.1       jail1                         /usr/jails/jail1
     3  192.x.x.3       jail3                         /usr/jails/jail3
     4  192.x.x.2       jail2                         /usr/jails/jail2
     7  192.x.x.1       jail1                         /usr/jails/jail1
```

Then jexec stops working for jid 4, but the services running on jail2 are still accessible.


----------



## cgigeek (Jul 15, 2011)

I have the same on 8.2 amd64


----------



## fbsd1 (Jul 16, 2011)

You have to use the *ezjail-admin stop* command. You can not mix native jail commands with ezjail. ezjail keeps a internal list of jails started by ezjail and when you  go outside of ezjail-admin to stop a jail ezjail don't know about it.

Check out qjail which is much better than ezjail.


----------



## bsd10 (Jul 18, 2011)

fbsd1 said:
			
		

> You have to use the *ezjail-admin stop* command. You can not mix native jail commands with ezjail. ezjail keeps a internal list of jails started by ezjail and when you  go outside of ezjail-admin to stop a jail ezjail don't know about it.
> 
> Check out qjail which is much better than ezjail.



Multiple jails are being created without issuing a stop command, but I'm using ezjail.sh after the redundant jails are created, which should work fine.

I looked at qjail's sourceforge site, but I couldn't find any documentation. How is it an improvement over ezjail?


----------



## bsd10 (Jul 20, 2011)

Apparently what is happening is that the apache22 stop command is not seeing the pid, so I get the following when I try to stop it:

```
# /usr/local/etc/rc.d/apache22 stop
apache22 not running? (check /var/run/httpd.pid).
```
Even though the pid file is there

```
# cat /var/run/httpd.pid
1379
```

Restarting Apache then creates another jid for the same jail somehow. I tried it twice, so now I have three jids running for the same jail

The quick fix is just to restart the jail instead of the services in it, but I would be interested to see if anyone knows why it is not seeing the pid file and why restarting it creates the second jail.


----------

