Sunday, February 24, 2013

Gento como guest LXC en Ubuntu 12.10

LXC / lxc-gentoo:
Mantenimiento básico de packages de Gentoo:



35 comments:

  1. acer| ~/lxc-gentoo$ sudo ./lxc-gentoo create
    What is the name for the container (recommended <=15 chars)? [gentoo]
    What hostname do you wish for this container ? [gentoo]
    What IP address do you wish for this container (enter 'dhcp' to use DHCP) ? [172.20.0.2/24]10.45.45.45/24
    What is the gateway IP address ? [172.20.0.1]10.45.45.1
    Which gentoo architecture should we use in this container ? [amd64]
    Architecture variant (usually '', 'hardened' or 'hardened+nomultilib') ? []
    Type guest root password (enter for none):

    Thanks! Now sit back and relax while your gentoo brews...

    ReplyDelete
  2. Checking for pre-existing cache in /var/cache/lxc/gentoo/amd64_amd64__rootfs...not found.
    Determining path to latest gentoo amd64 stage3 archive...20130130/stage3-amd64-nomultilib-20130130.tar.bz2
    Downloading (~130MB), please wait...done.
    Extracting stage3 archive...done.
    Downloading gentoo portage (software database) snapshot...done.
    Extracting...done.
    Copying filesystem from /var/cache/lxc/gentoo/amd64_amd64__rootfs to ./gentoo...done.
    - writing LXC guest configuration...done.
    - setting hostname...done.
    - setting guest root password..BAD PASSWORD: it is WAY too short
    BAD PASSWORD: is a palindrome
    No password supplied
    chpasswd: (user root) pam_chauthtok() failed, error:
    Authentication token manipulation error
    chpasswd: (line 1, user root) password not changed
    done.
    All done!

    You can run your container with the 'lxc-start -f gentoo.conf -n gentoo'
    For host-side networking setup info, see ./gentoo/etc/conf.d/net

    To enter your container for setup WITHOUT running it, try:
    # mount -t proc proc ./gentoo/proc
    # mount -o bind /dev ./gentoo/dev
    # chroot ./gentoo /bin/bash
    # export PS1="(gentoo) $PS1"
    (gentoo) # <-- you are now in the guest
    ... or, start it on the current console with:
    'lxc-start -f gentoo.conf -n gentoo'
    ... or, start it elsewhere then use 'lxc-console -n gentoo' for a shell

    (Report bugs to https://github.com/globalcitizen/lxc-gentoo/issues )";

    ReplyDelete
  3. Configuracion de red (para reusar bridge de libvirt)
    ----------

    # network interface
    lxc.network.type = veth
    lxc.network.flags = up
    # - name in host (max 15 chars; defaults to 'tun'+random)
    lxc.network.veth.pair = fotografia
    # - name in guest
    lxc.network.name = eth0
    # enable for bridging
    # (eg. 'brctl addbr br0; brctl setfd br0 0; brctl addif br0 eth0')
    lxc.network.link = virbr0
    lxc.network.ipv4 = 192.168.122.97/24
    lxc.network.ipv4.gateway = 192.168.122.1
    #lxc.network.hwaddr = b6:65:81:93:cb:a0

    ReplyDelete
  4. 2do paso (recomendado por comando anterior):

    $ eselect profile set default/linux/amd64/13.0/no-multilib

    ReplyDelete
  5. fotografia ~ # eselect news read 5
    2013-01-23-udev-upgrade
    Title Upgrading udev from 171 (or older) to 197
    Author Samuli Suominen
    Posted 2013-01-23
    Revision 1

    Upgrading udev from 171 (or older) to 197 will require special attention:

    - Remove udev-postmount from runlevels.

    - The need of CONFIG_DEVTMPFS=y in the kernel; need to verify the fstype for
    possible /dev line in /etc/fstab is devtmpfs (and not, for example, tmpfs)

    - The case of predictable network interface names; if the file
    /etc/udev/rules.d/70-persistent-net.rules is being used for renaming
    network interface names to already existing names, then you need to
    read following bug[1] because it's no longer possible. This won't
    be a problem with the new predictable network interface name scheme[2].

    [1] http://bugs.gentoo.org/453494
    [2] http://www.freedesktop.org/wiki/Software/systemd/
    PredictableNetworkInterfaceNames

    - Support for older kernels than 2.6.39 is dropped. If you need older kernel
    we recommend you to look into sys-fs/eudev or use local overlay for keeping
    the old ebuild. Remember to also get the distfiles where the patchsets are.
    The upgrade into current stable version of gentoo-sources is recommended.

    - The case of separate /usr; if it worked for you with 171 it will continue
    to work for you with 197. We still recommend initramfs with separate /usr
    mounting capabilities because you might need packages like sys-apps/kbd
    (keymaps in /usr) or net-wireless/bluez (possible keyboard) in early boot.

    And read every message printed by the emerge of udev and udev-init-scripts
    to ensure the system is in order before booting as this news item might
    not be complete.

    Apologies if this news came too late for you.

    ReplyDelete
  6. Antes de rebuildear todo, seteo flags:

    http://www.gentoo.org/doc/en/gcc-optimization.xml

    ReplyDelete
  7. Que CFLAGS usar? -> http://en.gentoo-wiki.com/wiki/Safe_Cflags

    ReplyDelete
  8. Más opciones (aunque apenas leí la página, parece haber más cosas a afinar!)

    http://en.gentoo-wiki.com/wiki/Safe_LDFLAGS

    ReplyDelete
  9. Algo más antes de rebuild: setear USE flags:

    http://www.gentoo.org/dyn/use-index.xml

    Por ahora voy a probar con:

    USE="bindist mmx sse sse2 X exif gtk qt4 3dnow smp sysvipc"

    ReplyDelete
  10. ¿Como habilitamos -j2 para gcc?

    http://en.gentoo-wiki.com/wiki/Portage_tips

    Vamos a probar con:

    MAKEOPTS="-j3 -l1.95"
    EMERGE_DEFAULT_OPTS="-j2 --load-average=1.85"
    PORTAGE_NICENESS="15"

    ReplyDelete
  11. Largamoooos!

    $ time emerge --update --ask world

    (siguiendo los pasos de http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=2&chap=1)

    ReplyDelete
  12. Luego de '--update --deep world' (y sólo luego) podemos re-ejecutar con '--with-bdeps=y'... y de paso usamos '--newuse' ya que cambiamos USE:

    $ time emerge --update --deep --with-bdeps=y --newuse world

    ReplyDelete
  13. El comando anterior está tardando mucho... cancelo e instalo http://en.gentoo-wiki.com/wiki/Mirrorselect

    $ emerge app-portage/mirrorselect

    ReplyDelete
  14. Para instalar digikam:

    $ emerge --autounmask-write media-gfx/digikam

    y luego:

    $ dispatch-conf

    ReplyDelete
  15. Finalmente inició el emerge de digikam...

    $ cat /etc/portage/make.conf

    (...)

    USE="bindist mmx sse sse2 X exif gtk qt4 3dnow smp sysvipc dbus qt3support python ogg vorbis policykit plasma gudev hwdb consolekit opengl webkit svg declarative sql script"

    (...)


    PERO necesité resolver dependencias circulares configurando:

    $ cat /etc/portage/package.use
    net-libs/libproxy -webkit

    ReplyDelete
  16. Instrucciones para instalar KDE: http://wiki.gentoo.org/wiki/KDE


    > In Gentoo there are various packages that will install a KDE environment:
    > kde-base/kde-meta, the full KDE suite
    > kde-base/kdebase-meta, a basic KDE environment
    > kde-base/kdebase-startkde, a very minimal, effectively unsupported KDE environment (no KDE applications or artwork)

    ReplyDelete
  17. Gnome: http://wiki.gentoo.org/wiki/Gnome

    Gnome 3 no es considerado 'estable', asi que `emerge gnome` instalaria Gnome2.

    Guia para instalar Gnome: http://www.gentoo.org/doc/en/gnome-config.xml

    ReplyDelete
  18. Alternativas de instalación de Gnome:

    1) $ emerge gnome
    2) $ emerge gnome-light

    ReplyDelete
  19. Info sobre cómo instalar Gnome3

    http://www.gentoo.org/proj/en/desktop/gnome/howtos/gnome-3.2-upgrade.xml

    ReplyDelete
  20. FINALMENTE ESTOY USANDO GIMP Y DIGIKAM DE GENTOO! :-D

    Para lograrlo, lo más difícil fue hacer andar aplicaciones X, de Gentoo (virtual, usando LXC) pero que se vean en Ubuntu.

    La forma más fácil (no sé si más segura, ni más eficiente) fue:

    @Ubuntu, editar /etc/lightdm/lightdm.conf y agregar:

    xserver-allow-tcp=true

    @Ubuntu, aceptar conexiones al puerto 6000 desde virtual:

    $ sudo iptables -I INPUT -i virbr0 -p tcp --dport 6000 -j ACCEPT
    $ xhost +

    @Gentoo (LXC), setear variable de entorno:

    $ export DISPLAY=192.168.122.1:0
    $ gimp

    Listo! :-D

    ReplyDelete
  21. @Gentoo: Para que ssh inicie automaticamente:

    $ rc-update add sshd default

    ReplyDelete
  22. Al final, la versión de Gimp "estable" es vieja (2.6)... Para instalar la ultima versión debo habilitar los paquetes de 'testing'.

    http://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=3&chap=3

    para lo cual hay que agregar la siguiente linea en /etc/portage/make.conf:

    ACCEPT_KEYWORDS="~amd64"

    ReplyDelete
  23. Ah, y luego de habilitar los paquetes de testing:

    $ emerge --update --ask --verbose media-gfx/gimp

    ReplyDelete
  24. Probado

    $ emerge -Duav system

    Lo encontré en http://gentoovps.net/gentoo-updating-old-system/

    ReplyDelete
  25. Ojo con los paquetes que terminan asociados a 'world'... Sin querer di 'yes' varias veces, y termine con varios paquetes en 'world'.

    Para verlos:

    $ cat /var/lib/portage/world

    Info:

    http://wiki.gentoo.org/wiki/World

    ReplyDelete
  26. Para eliminar muchos paquetes *SIN* controlar depedencias
    ---------------------------------------------------------

    $ equery list '*' | grep gnome

    // revisar listado

    $ equery list '*' | grep gnome | xargs emerge --ask -C

    ReplyDelete
  27. Unmerge
    -------

    >> Portage will not check if the package you want to remove is
    >> required by another package. It will however warn you
    >> when you want to remove an important package that breaks
    >> your system if you unmerge it.

    Code Listing 3.10: Updating your system

    # emerge --update --ask world

    Code Listing 3.11: Updating your system with dependencies

    # emerge --update --deep world

    Code Listing 3.13: Performing a full update

    # emerge --update --deep --with-bdeps=y --newuse world

    ReplyDelete
  28. openmpi
    -------

    * Messages for package sys-cluster/openmpi-1.6.3:

    * WARNING: use of MPI_THREAD_MULTIPLE is still disabled by
    * default and officially unsupported by upstream.
    * You may stop now and set USE=-mpi-threads
    * OpenMPI has an overwhelming count of configuration options.
    * Don't forget the EXTRA_ECONF environment variable can let you
    * specify configure options if you find them necessary.

    ReplyDelete
  29. Mmmm... ¿habré hecho algo mal?

    lxc-gentoo $ time gmic DSC_0948.JPG -denoise 30,10 -o denoised.jpg
    [gmic]-0./ Start G'MIC parser.
    [gmic]-0./ Input file 'DSC_0948.JPG' at position [0] (1 image 2304x1536x1x3).
    [gmic]-1./ Denoise image [0] using 5x5 patchs, with standard deviations 30,10, lookup size 6 and smoothness 1.
    [gmic]-1./ Output image [0] as file 'denoised.jpg', with quality 100% (1 image 2304x1536x1x3).
    [gmic]-1./ End G'MIC parser.

    real 0m41.496s
    user 0m41.359s
    sys 0m0.112s

    bare-meta-ubuntu $ time gmic DSC_0948.JPG -denoise 30,10 -o denoised2.jpg
    [gmic]-0./ Start G'MIC parser.
    [gmic]-0./ Input file 'DSC_0948.JPG' at position [0] (1 image 2304x1536x1x3).
    [gmic]-1./ Denoise image [0] using 5x5 patchs, with standard deviations 30,10, lookup size 6 and smoothness 1.
    [gmic]-1./ Output image [0] as file 'denoised2.jpg', with quality 100% (1 image 2304x1536x1x3).
    [gmic]-1./ End G'MIC parser.

    real 3m11.560s
    user 3m10.848s
    sys 0m0.164s

    Ya los correré nuevamente...

    ReplyDelete
  30. Recompilar G'MIC en Ubuntu
    --------------------------

    $ apt-get build-dep gmic
    ***ERROR***

    Esto es casionado por paquetes de medibuntu, asi que los desinstalé... ahora 'build-dep' funcionó!

    $ apt-get build-dep gmic
    $ export CFLAGS="-march=native"
    $ export CXXFLAGS="-march=native"
    $ apt-get -b source gmic

    Tomado de:
    - http://askubuntu.com/questions/47906/recompile-all-packages-and-trigger-on-updates
    - http://manpages.ubuntu.com/manpages/natty/en/man1/apt-build.1.html

    ReplyDelete
  31. gcc flags
    ---------

    - http://en.gentoo-wiki.com/wiki/Safe_Cflags
    - http://en.gentoo-wiki.com/wiki/Safe_Cflags/AMD

    Acer Aspire 5542-5241
    ---------------------

    CHOST="x86_64-pc-linux-gnu"
    CFLAGS="-march=amdfam10 -O2 -pipe"
    CXXFLAGS="${CFLAGS}"


    FX8120
    ------

    CFLAGS="-O2 -pipe -march=bdver1 -mno-movbe -mno-fma -mno-bmi -mno-tbm --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=bdver1"
    CXXFLAGS="${CFLAGS}"
    CHOST="x86_64-pc-linux-gnu"

    ReplyDelete
  32. Probando compilar G'MIC con:

    OPT_CFLAGS = -O3 -fno-inline-functions -fno-ipa-cp-clone -fno-unswitch-loops -fno-reorder-blocks -fno-reorder-functions -pipe -march=bdver1 -mno-movbe -mno-fma -mno-bmi -mno-tbm --param l1-cache-size=16 --param l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=bdver1

    ReplyDelete

Note: Only a member of this blog may post a comment.