LXC: Pas de paquet lxc-dev

Bonjour,

J’aurai besoin des fichiers de développement LXC pour compiler lxc-python2 mais ces derniers ne sont pas disponibles dans les dépots (le paquet lxc-dev a disparu vers wheezy : packages.debian.org/search?keywords=lxc-dev).

J’ai déjà rencontré ce problème avec LXD que j’ai du abandonné à cause de ça, et maintenant Ansible, et globalement à chaque fois que j’essayais d’utiliser l’API de LXC. Ce qui me bloque totalement, n’ayant pas trouvé de contournement possible à ce problème.

Voici l’erreur que je rencontre quand j’essaye de lancer un pip install lxc-python2

[code]sudo pip install lxc-python2
Downloading/unpacking lxc-python2
Downloading lxc-python2-0.1.zip
Running setup.py (path:/tmp/pip-build-FAp5Tc/lxc-python2/setup.py) egg_info for package lxc-python2

Installing collected packages: lxc-python2
Running setup.py install for lxc-python2
building ‘_lxc’ extension
i586-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c lxc.c -o build/temp.linux-i686-2.7/lxc.o
lxc.c:27:30: fatal error: lxc/lxccontainer.h: Aucun fichier ou dossier de ce type
#include <lxc/lxccontainer.h>
^
compilation terminated.
error: command ‘i586-linux-gnu-gcc’ failed with exit status 1
Complete output from command /usr/bin/python -c “import setuptools, tokenize;file=’/tmp/pip-build-FAp5Tc/lxc-python2/setup.py’;exec(compile(getattr(tokenize, ‘open’, open)(file).read().replace(’\r\n’, ‘\n’), file, ‘exec’))” install --record /tmp/pip-12ibpf-record/install-record.txt --single-version-externally-managed --compile:
[/code]

Comme conseillé voici quelques infos sur ma Debian:

uname -a Linux deuxfleurs.fr 3.16.0-4-686-pae #1 SMP Debian 3.16.7-ckt11-1 (2015-05-24) i686 GNU/Linux

cat /etc/debian_version stretch/sid

[code]cat /etc/apt/sources.list
deb http://ftp.fr.debian.org/debian testing main contrib non-free
deb-src http://ftp.fr.debian.org/debian testing main contrib non-free

deb http://ftp.debian.org/debian/ testing-updates main contrib non-free
deb-src http://ftp.debian.org/debian/ testing-updates main contrib non-free

deb http://security.debian.org/ testing/updates main contrib non-free
deb-src http://security.debian.org/ testing/updates main contrib non-free

deb http://nightly.odoo.com/8.0/nightly/deb/ ./[/code]

[code]sudo lxc-checkconfig
Kernel configuration not found at /proc/config.gz; searching…
Kernel configuration found at /boot/config-3.16.0-4-686-pae
— Namespaces —
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled

— Control groups —
Cgroup: enabled
Cgroup clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

— Misc —
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig
[/code]

apt-cache search lxc ampache-common - web-based audio file management system common files autopkgtest - automatic as-installed testing for Debian packages libclxclient-dev - Development file for libclxclient libclxclient3 - X Window System C++ access library debian-handbook - reference book for Debian users and system administrators imvirt - detects several virtualizations imvirt-helper - helper programs to detect several virtualizations libimvirt-perl - Perl module for detecting several virtualizations libvirt-bin - programs for the libvirt library libvirt-clients - programs for the libvirt library libvirt-daemon - programs for the libvirt library libvirt-daemon-system - Libvirt daemon configuration files libvirt-dev - development files for the libvirt library libvirt-doc - documentation for the libvirt library libvirt-sanlock - library for interfacing with different virtualization systems libvirt0 - library for interfacing with different virtualization systems libvirt0-dbg - library for interfacing with different virtualization systems python-libvirt - libvirt Python bindings python3-libvirt - libvirt Python 3 bindings lxc - Linux Containers userspace tools lxc-dbg - Linux Containers userspace tools (debug) lxctl - Utility to manage LXC nova-compute-lxc - OpenStack Compute - compute node (LXC) liboce-ocaf8 - OpenCASCADE Community Edition CAE platform shared library yum-utils - Utilities based around the yum package manager

Merci d’avance pour vos lumières et votre indulgence, je dois certainement passer à côté de quelque chose vu la simplicité de mon problème…

Salut,

Installes donc la version [mono]Wheezy[/mono].

[07:39:45]:~$ apt-cache policy lxc-dev lxc-dev: Installé : (aucun) Candidat : 0.8.0~rc1-8+deb7u2 Table de version : 0.8.0~rc1-8+deb7u2 0 799 http://ftp.fr.debian.org/debian/ wheezy/main amd64 Packages 0.8.0~rc1-4~bpo60+1 0 560 http://backports.debian.org/debian-backports/ squeeze-backports/main amd64 Packages [07:39:53]:~$

[code][07:43:34]:~$ aptitude -s install lxc-dev
Les NOUVEAUX paquets suivants vont être installés :
lxc-dev{b}
0 paquets mis à jour, 1 nouvellement installés, 0 à enlever et 1 non mis à jour.
Il est nécessaire de télécharger 19,6 ko d’archives. Après dépaquetage, 98,3 ko seront utilisés.
Les paquets suivants ont des dépendances non satisfaites :
lxc-dev : Dépend: lxc (= 0.8.0~rc1-8+deb7u2) mais il ne sera pas installé.
Les actions suivantes permettront de résoudre ces dépendances :

 Conserver les paquets suivants dans leur version actuelle :
  1. lxc-dev [Non installé]                                   
    

Accepter cette solution ? [Y/n/q/?] n
Les actions suivantes permettront de résoudre ces dépendances :

 Installer les paquets suivants :      
  1. lxc [0.8.0~rc1-8+deb7u2 (oldstable)]
    

Accepter cette solution ? [Y/n/q/?] y
Les NOUVEAUX paquets suivants vont être installés :
lxc{a} lxc-dev
Les paquets suivants sont RECOMMANDÉS mais ne seront pas installés :
libcap2-bin libcap2-bin:i386
0 paquets mis à jour, 2 nouvellement installés, 0 à enlever et 1 non mis à jour.
Il est nécessaire de télécharger 190 ko d’archives. Après dépaquetage, 827 ko seront utilisés.
Voulez-vous continuer ? [Y/n/?] y
Charger/installer/enlever des paquets.
[07:44:24]:~$[/code]

[07:44:27]:~$ apt-cache policy lxc lxc: Installé : (aucun) Candidat : 1:1.0.7-3 Table de version : 1:1.0.7-3 0 990 http://cdn.debian.net/debian/ sid/main amd64 Packages 870 http://ftp.fr.debian.org/debian/ stretch/main amd64 Packages 1:1.0.6-6 0 950 http://ftp.fr.debian.org/debian/ jessie/main amd64 Packages 1:1.0.6-6~bpo70+2 0 798 http://http.debian.net/debian/ wheezy-backports/main amd64 Packages 0.8.0~rc1-8+deb7u2 0 799 http://ftp.fr.debian.org/debian/ wheezy/main amd64 Packages 0.8.0~rc1-4~bpo60+1 0 560 http://backports.debian.org/debian-backports/ squeeze-backports/main amd64 Packages 0.7.2-1 0 570 http://ftp2.fr.debian.org/debian/ squeeze/main amd64 Packages [07:44:31]:~$

Je n’ai pas encore tout essayé, mais pour l’instant ça me pose quand même 2 gros problèmes :
[ul]
[li] Ansible demande une version de LXC > 1.0[/li]
[li] Debian me dit que lxc-dev a été remplacé par lxc[/li][/ul]

[code]sudo apt-get -t wheezy-backports install lxc-dev
Lecture des listes de paquets… Fait
Construction de l’arbre des dépendances
Lecture des informations d’état… Fait
Package lxc-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
lxc

E: Package ‘lxc-dev’ has no installation candidate
[/code]

Bon là j’essaye avec wheezy backports au lieu de wheezy ou squeeze-backports. Je continue mon investigation…

Passes à [mono]aptitude[/mono] et oublies [mono]apt-get[/mono].

$ aptitude -s install wheezy-backports lxc-dev (...) Acceptez vous cette solution /Y/N/? n

Comment cela ?

$ aptitude show ansible=1.7.2+dfsg-2 (...) Dépend: python (>= 2.7), python (< 2.8), python-paramiko, python-jinja2, python-yaml, python-pkg-resources, python-crypto (>= 2.6), python-httplib2

aptitude show ansible=1.7.2+dfsg-2~bpo70+1 (...) Dépend: python (>= 2.6.6-7~), python (< 2.8), python-paramiko, python-jinja2, python-yaml, python-pkg-resources, python-crypto, python-httplib2

Je note pour aptitude, mais on m’a toujours dit de ne pas utiliser les 2 en parallèle. La migration ne risque-t-elle pas de poser problème ?

(Ce que je veux dire par machine cible/machine hote :
machine cible = le ou les serveurs sur lequel je déploie ma conf
machine hôte = ma machine à moi qui fais tourner Ansible - accessoirement sous Fedora).

Et oui, au temps pour moi, mon Debian est la machine cible et n’a même pas connaissance de Ansible.
Par contre je veux utiliser le module LXC de Ansible qui a pour dépendance sur la machine cible :
[ul]
[li] lxc >= 1.0 # OS package
[/li][li] python >= 2.6 # OS Package
[/li][li] lxc-python2 >= 0.1 # PIP Package from github.com/lxc/python2-lxc[/li][/ul]

docs.ansible.com/lxc_container_module.html

Je suis actuellement en train de voir comment compiler depuis les sources de LXC + faire un joli .deb derrière, mais si une solution plus simple existe, je ne dis pas non… Pas forcément envie de réinventer la roue… (Sinon, il y a LFS, Gentoo ou Arch - just kidding :p)

EDIT

Je reconnais que aptitude est très puissant, en effet j’ai bien pu installer mon LXC en version 0.8, mais toujours le même bug. Et oui, l’API LXC apparait dans sa version 0.9 selon ce site…

stgraber.org/2014/02/05/lxc … h-the-api/

Donc l’option compiler + packager LXC semble de plus en plus être la seule solution imaginable…