# python27 with SEM option (p1003b) in jail and FreeBSD 8.2 -> 9.0



## lahondes (May 7, 2012)

Hi,

*W*hen we upgraded our Freebsd FreeBSD 8.2 to 9.0, we broke one of our python program*s* which use Pyro and depend on posix semaphores.

Now when building python2.7.3 thr*o*u*gh* ports, cho*o*sing the SEM option *i*n *make config* and building, semaphore*s* do not work although they worked on 8.2 with the same settings.

*I*n a jail:

```
# python
Python 2.7.3 (default, May  7 2012, 18:16:58) 
[GCC 4.2.1 20070719  [FreeBSD]] on freebsd9
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing.queues import SimpleQueue
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/multiprocessing/queues.py", line 48, in <module>
    from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition
  File "/usr/local/lib/python2.7/multiprocessing/synchronize.py", line 59, in <module>
    " function, see issue 3770.")
ImportError: This platform lacks a functioning sem_open implementation, therefore, the required
 synchronization primitives needed will not function, see issue 3770.
```

I have in sysctl:

```
security.jail.sysvipc_allowed=1
```

It work*s* out of jails. I have tr*ied* to tweak another jail security parameter:

```
security.jail.param.allow.sysvipc=1
```
but it does not help.

I am also worried by the fact that some of my related sysctl settings do not seem to be taken into account:

/etc/sysctl.conf:

```
p1003_1b.sem_nsems_max=1000
```

`# sysctl p1003_1b.sem_nsems_max`

```
p1003_1b.sem_nsems_max: 0
```

and:

`# sysctl p1003_1b.sem_nsems_max=1000`

```
p1003_1b.sem_nsems_max: 0 -> 0
```

(the-w option give*s* the same result).


----------



## lahondes (May 8, 2012)

*About the rules*

I am really sorry about all the rules I have broken, I did not come across these posts you refer to in the signature at the end of my post. As for the different grammar errors, I do not write often in English and I focused on technical details. I have really tried to remember in the forum registration procedure where I missed these important rules and I could not find them out. I find that a great correction job was done and I am really sorry to have cause all this work. However, as a *Free*BSD Forum newbie, I find the form of the remark a little rude. 

I have been carefully repeating this issue about python, semaphore and jail, which I find quite challenging, at least for me, and I am slightly upset about the 'zero effort' at the end of my own post. Once again, however, I apologize for all the broken rules and I appreciate the seriousness and quality of the forum and will do my best to be up to it.

Raynald


----------



## lahondes (May 8, 2012)

*[solved] thanks to ezjail-admin but be carefull with update -U*

So much for my pride: I have carefully checked my jail again and discovered that the base jail had not been updated using :

[cmd=]ezjail-admin update -u[/cmd]

The -U would not work. I re-read the man page and discovered that -U only works before installing and rebooting. To correct the base jail, I ran:

[cmd=]ezjail-admin install[/cmd]

Which installed a 9.0-RELEASE base jail. The compilation of python with SEM option did work then. 

However, the message given by 

[cmd=]ezjaiil-admin update -u[/cmd]

which says "no update necessary" is quite confusing in fact. 

Apart from that, jails are very satisfying in general and ezjail-admin is a very simple and great system to maintain them.


----------

