Page 2 of 13 FirstFirst 123412 ... LastLast
Results 11 to 20 of 130

Thread: Lucid and OpenVZ and/or LXC ?

  1. #11

    Angry users after Hardy Heron

    I see that a lot of tutorials are needed, but... who works on tutorials if LXC can change? Actually it doesn't sound possible to make a stable migrator script to automate the change from OpenVZ to LXC of a container maintaining all the features.

    Me and other people who decided to work with the help of Ubuntu 8.04 openvz-kernels, we feel that we are in an ambush with LXC.

    Is a good news that Ubuntu supports LXC (I hope mature in april 2010), but we are orphaned since Ubuntu 8.10, 9.04 and 9.10 without openvz-kernels, and without any information about the future.

    We received a sweet with OpenVZ in Ubuntu 8.04, and some developers say that the sweet is out, and we are now bound to learn a lot of internal technical details, when we need to devote to manage server systems.

    Before taking off OpenVZ easiness, we need a complete userspace utilities, high level tools and tutorials. And there is no bad to maintain OpenVZ while LXC is maturing.
    Narcis Garcia

  2. #12
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Angry users after Hardy Heron

    Quote Originally Posted by narcisgarcia View Post
    I see that a lot of tutorials are needed, but... who works on tutorials if LXC can change? Actually it doesn't sound possible to make a stable migrator script to automate the change from OpenVZ to LXC of a container maintaining all the features.

    Me and other people who decided to work with the help of Ubuntu 8.04 openvz-kernels, we feel that we are in an ambush with LXC.

    Is a good news that Ubuntu supports LXC (I hope mature in april 2010), but we are orphaned since Ubuntu 8.10, 9.04 and 9.10 without openvz-kernels, and without any information about the future.

    We received a sweet with OpenVZ in Ubuntu 8.04, and some developers say that the sweet is out, and we are now bound to learn a lot of internal technical details, when we need to devote to manage server systems.

    Before taking off OpenVZ easiness, we need a complete userspace utilities, high level tools and tutorials. And there is no bad to maintain OpenVZ while LXC is maturing.
    I agree with what you say, in principle, but in practice it is not so clean.

    The OpenVZ Kernel patch is maintained "upstream", by the openVZ developers.

    The Ubuntu developers then take the openvz patch, from upstream, and the generic kernel, from upstream, and packaged them into the Ubuntu openvz kernel.

    The OpenVZ project , the upstream source, maintains openvz as a large kernel patch and they do not have a stable patch beyond the 2.6.18 Kernel.


    http://wiki.openvz.org/Category:Kernel_download

    There is a 2.6.24, not stable, a few development releases, and a RHEL kernel, which is what is used by Proxmox.

    Ubuntu uses a more recent kernel.

    http://packages.ubuntu.com/search?su...kernel+generic

    Hardy - 2.6.24

    Intrepid - 2.6.27

    ...

    Lucid - 2.6.32

    So what you are asking is for the Ubuntu developers to do is to take over the OpenVZ project and release a patch for the 2.6.32 kernel.

    Not going to happen.

    ============

    The Long term "solution", as has been mentioned in this thread, is LXC.

    If you read the links I gave or look at the OpenVZ mailing lists you will see the technical reasoning for this.

    Basically LXC is in the mainline kernel and is easier to maintain. Many of the OpenVZ developers are contributing to the LXC project and it is very likely the OpenVZ project will either die off due to a lack of development or the developers will move to LXC, which is more likely.

    ============

    The major problem with LXC at this moment is that it is under rapid development and as is often the case, the documentation has (and can) not keep pace.

    Unless you are using a developmental kernel and the lxc tools from git, if you find a bug in LXC, you will be told to upgrade.

    Once the project matures a bit, and lxc (user tools) are at version 1.0 (1.0 is the first planned stable release) documentation will lag.

    ============


    With all of the discussion in mind, if you are already familiar with openzv, it seems rather easy to migrate to LXC.

    Last night I was able to make a Fedora 12 container that now boots properly. I have made minimal effort to downsize the container, but when I package it up, as I would an openvz template, it is 150 Mb in size, which is not bad at all.

    I need to look at Ubuntu Lucid, and the lxc git tools, and write it all into a few blog pages.

    So you now have two people who are working on the details. If all goes will I will add a "How to LXC" thread in the Virtualization forums for the upcoming release of lucid, 10.04, similar to my openvz thread.

    Now I am just learning and so likely to make mistakes, but I should at least be able to get you (and others) started.

    Basically there are several things you need to understand:

    1. How to configure LXC on the host node.

    2. How to make a container. You either bootstrap/chroot , use an openvz template, or use lxc-debian / lxc-fedora. Each option requires some manual configuration, but many of the lxc scripts are bash scripts , so if you are interested, you could modify the scripts and submit them to the lxc project or post them on a personal blog.
    Last edited by bodhi.zazen; January 28th, 2010 at 07:52 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  3. #13

    Without OpenVZ nor LXC

    Since 1 month ago I have a dedicated server with the Ubuntu 10.04 server, focused on play with LXC and to prepare a fast and solid migration of my OpenVZ containers on april.

    What can I do?
    Without any How-To now I don't know the way to begin.
    Narcis Garcia

  4. #14
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Without OpenVZ nor LXC

    Quote Originally Posted by narcisgarcia View Post
    Since 1 month ago I have a dedicated server with the Ubuntu 10.04 server, focused on play with LXC and to prepare a fast and solid migration of my OpenVZ containers on april.

    What can I do?
    Without any How-To now I don't know the way to begin.
    Depends on how much time you have. Keep playing with it, start a thread if you get stuck.

    Otherwise, I am working on documentation, and hope ot work with sweetsinse and others to generate a few Ubuntu wiki pages / blogs / etc.

    At the moment I just made a Fedora 12 "template", the tar.gz is 150 Mb , not bad.

    If I extract it it boots and runs normally.

    Next step for me is to look at my openvz templates and lucid.

    Once I get it up and working, people with more LXC experience can add to it and we can get some documentation going.

    Do you know how to use IRC ?

    I was thinking of registering a channel for lxc, but in the mean time, if you come over to say #ubuntu-beginners I may be able to help you.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  5. #15

    Re: Lucid and OpenVZ and/or LXC ?

    I don't like chat support, I prefer wikis and forums because here you can participate without being online all the time.
    Chat is good when people meets at a concrete time for a concrete question.

    We can work in the already existing wiki page in Ubuntu:
    https://wiki.ubuntu.com/ContainersSpec
    Narcis Garcia

  6. #16
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Lucid and OpenVZ and/or LXC ?

    Starting a few wiki pages would be a great idea. The one you linked is probably not the best to start posting a "how to LXC" on.

    I suggest breaking it into a few pages

    LXC - Overview. What is is ? User case examples.

    LXC - Host configuration
    kernel requiremetns
    apt-get install lxc
    install lxc from git

    LXC - Container configuration /
    options/examples for congig files
    chroot/debootstrap/febootstrap
    migrate openvz containers
    lxc-debian / lxc-fedora
    lxc-console / ssh into containers

    LXC - Application configuration.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  7. #17
    Join Date
    Oct 2007
    Beans
    34

    Re: Lucid and OpenVZ and/or LXC ?

    hooray! you can grab my sources from here:
    Code:
    git clone git://devel.extof.me/vps
    i can't guarantee that will always be up (im doing alot of work with these containers and on these scripts), or that the git repo will be a proper one (when i update it i might break history , for a little while at least), but i should be up most the time, and the url wont change. that url is running in an LXC container created using the tools it's hosting.

    DISCLAIMER as is, these tools are meant for an archlinux host and WILL NOT work for an ubuntu/debian host. this is something i intend to change. in addition, the scripts expect a BTRFS based root filesystem, others (ext3/4/etc) will need to replace btrfsctl commands with "cp -R" and "rm -rf" (i intend to do this in a slick/hacky way... by making a bash function with the same name as btrfsctl when its not available. when its called it will cp/rm instead) right now i am providing these to help others understand how the lxc-* tools work, and present a setup that works for me, and may for you. all the scripts together are less than 1000 lines of bash, so a light read

    FEATURES
    1. uses btrfs to create efficient "forks" of templates into writable domains (vps)
    2. complete, drop in solution (only add two lines to rc.local)
    3. when you enter a vps from the host, the PS1 will reflect that:
      Code:
      cr@ph1 ~ $ vps-enter guest-personal-tony
      
      Type <Ctrl+a q> to exit the console
      
      VPS[guest-personal-tony] cr@extof /srv/git $
      ONLY if you're entering from the host, if you enter via ssh, the VPS[XXX] part is not there (host is on a real tty, everything else is pty)
    4. by default, a dhcp bridge is created so all guests see each other, and have dns/dhcp/internet access
    5. there is more i swear...


    KNOWN CAVEATS/BUGS
    1. at least with arch guests, the dhcp never works/times out the first time a vps is booted; this could have something to do with the bridge. fix by manually restarting network a second time doesnt affect interfaces that are bridged directly to the LAN, i.e. no dhcp
    2. TERM=linux in a container. "export TERM=xterm" to get stuff working nicer in vim/maybe others (home/end keys dont work without)
    3. vps-enter will only let one person in a vps at a time, even if the container is configured with more than one tty. i will update this soon (compare config file to used sockets)
    4. i run misc/check-dev-pts.sh as a cron also. this makes sure that /dev/ptmx never breaks in the event of a rouge udev process (this only happened once, but had i not caught it i would have been locked out of my server. only affects those using the newinstance devpts mount flag on the actual host) i dont know how udev did this from inside a container... im not sure what happened. i dont use udev in containers, they already have the devices they need
    5. i use special entries in the /etc/inittab of containers to handle rebooting/powerdown of containers:
      Code:
      p6::ctrlaltdel:/sbin/init 6
      p0::powerfail:/sbin/init 0
      this lets me send, from the host, a SIGINT to reboot, and a SIGPWR to "power down" (with the help of vps-monitor, more on that below). this trick probably doesnt work with upstart
    6. i havent made an elegant way to edit the configs of an already running domain.
    7. and probably plenty of other things...


    DEVELOPMENT FUTURE
    1. support other hosts than archlinux
    2. add bash completion scripts
    3. support creating containers that are not archlinux based
    4. harden/extend all scripts by using getopts
    5. colorize everything
    6. other things i can't think of ATM


    HOW TO USE

    place the vps folder at /vps

    i create a file, /etc/profile.d/vps.sh, chmod +x it, (i think this will work for ubuntu) and put this in it:
    Code:
    # export VPS_ENV and add vps-* scripts to PATH
    
    export EDITOR=vim
    export VPS_ENV=/vps/usr/lib/common/env
    export PATH="${PATH}:/vps/usr/bin"
    
    # gen the motd
    #/vps/usr/cron/motd
    you dont need the any of it really, except the PATH part if you want to run the commands without their full path. i included the motd script (pretty) i use on my host server if anyone is interested.

    i put this in my /etc/rc.local:
    Code:
    #!/bin/bash
    #
    # /etc/rc.local: Local multi-user startup script.
    #
    
    export VPS_ENV=/vps/usr/lib/common/env
    /vps/usr/misc/vps-init.sh
    vps-init.sh is the bootstrap file for the whole process. start there to understand how everything works, its really not too bad. archlinux has a rc.local.shutdown file where i place the vps-shutdown.sh script... not sure the equiv for ubuntu.

    lastly, i create a way to exec this stuff as a regular user. create a group called vps (this is hard coded for the time being), add the users to it that you want to make/control/stop/see containers, and add this to your sudoers file:
    Code:
    %vps    ALL=(root) NOPASSWD: /vps/usr/bin/vps-*
    when you run the file as a normal user, the script does this:
    Code:
    # exec as VPS_USER if need be
    if [ -n "${VPS_SUDO}" ] && [ -n "${VPS_USER#$(whoami)}" ]; then
        exec ${VPS_SUDO} ${0} $@
    fi
    this may not be the best way, and might have an infinite loop possibility. i tried to drop privileges completely by making a vps user instead of root... but there are several things that need root in the scripts and it was too difficult for the time being. if you dont do this step simply run as root, it will Just Work. any suggestions welcome.

    BREAKDOWN OF FILES

    all the vps-* commands will dispay a usage when invoked with no arguments. i eventually want to use getopts. here is the file hierarchy and what everything does:
    Code:
    vps
    ├── def
    │   ├── exec
    │   │   ├── proc
    │   │   └── sys
    │   └── mnt
    ├── dom
    ├── log
    ├── tpl
    ├── usr
    │   ├── bin
    │   │   ├── vps-create
    │   │   ├── vps-enter
    │   │   ├── vps-ls
    │   │   ├── vps-mkdom
    │   │   ├── vps-mktpl
    │   │   ├── vps-reboot
    │   │   ├── vps-rmdom
    │   │   ├── vps-rmtpl
    │   │   ├── vps-start
    │   │   ├── vps-stop
    │   │   └── vps-tree
    │   ├── conf
    │   │   └── dnsmasq-dhcpbr0.conf
    │   ├── cron
    │   │   └── motd
    │   ├── doc
    │   │   ├── BUGS
    │   │   ├── INSTALL
    │   │   └── TODO
    │   ├── lib
    │   │   ├── common
    │   │   │   ├── color
    │   │   │   ├── env
    │   │   │   └── function
    │   │   ├── exec
    │   │   │   └── vps-monitor
    │   │   └── static
    │   │       ├── autologin
    │   │       ├── bash.bashrc.local
    │   │       ├── rc.conf
    │   │       ├── rc.shutdown
    │   │       ├── rc.single
    │   │       └── rc.sysinit
    │   └── misc
    │       ├── check-dev-pts.sh
    │       ├── start-brctl-dhcpbr0.sh
    │       ├── start-dnsmasq-dhcpbr0.sh
    │       ├── start-iptables-dhcpbr0.sh
    │       ├── start-mount-cgroup.sh
    │       ├── stop-brctl-dhcpbr0.sh
    │       ├── stop-dnsmasq-dhcpbr0.sh
    │       ├── stop-iptables-dhcpbr0.sh
    │       ├── stop-mount-cgroup.sh
    │       ├── vps-init.sh
    │       └── vps-shutdown.sh
    └── var
        └── run
    /vps/def/*
    definition (conf) files for each process (proc) container, or system (sys) container. also mount (mnt) definition files
    /vps/dom
    domains. where all your system containers will be
    /vps/log
    logs. when domains are started, output from the init process is logged here. i will probably extend this to log events from the vps-* scripts too
    /vps/tpl
    templates. system templates that will be forked (BTRFS) or copied (others) to usable domains
    /vps/usr/bin
    • vps-create: define a domain that has been made with vps-mkdom
    • vps-enter: enter a running domain that has a free tty slot
    • vps-ls: show the status of defined domains and/or templates
    • vps-mkdom: create a dom from an existing template
    • vps-mktpl: create a template from a list of predefined packs
    • vps-reboot: send a SIGINT to the init process of a running domain
    • vps-rmdom: delete a dom that isnt running
    • vps-rmtpl: remove a template
    • vps-start: start a dom that has been defined with vps-create, or has been stopped by vps-stop
    • vps-stop: stop a running domain
    • vps-tree: use the tree command to get a view of the folders (this will fail horribly without BTRFS... it uses the -x flag to avoid traversing into dom/tpl directories... useless without that)

    /vps/usr/conf
    config files. right now only for dnsmasq
    /vps/usr/cron
    not really crons, used to be. right now just the motd file i use
    /vps/usr/doc
    self explanatory?
    /vps/usr/lib
    • common: files included by other scripts (function isnt used)
    • exec: executables from other scripts. vps-monitor is the only one right now, its job is to monitor the utmp file in a container and determine if the container should be killed or rebooted based off the runlevel. should still work for upstart. see here for more details: http://www.mail-archive.com/lxc-user.../msg00040.html
    • static: files copied verbatim to containers

    /vps/usr/misc
    i dont like this folder or its name. right now it has all the bootstrap files
    /vps/var/cgroup
    you dont see this in the tree view, but it will be created, and the cgroup filesystem mounted here (i dont make it because git cant track empty folders without at least a .gitignore file... but then when it's mounted git complains that the .gitignore file is no longer there AND wants to place the entire cgroup under revision control... annoying)
    /vps/var/run
    has pidfiles (dnsmasq) and whatnot


    some of this structure is definately going to change as i break things off, esp. once i start adding support for other templates than archlinux.

    as always, comments welcome.
    Last edited by sweetsinse; January 29th, 2010 at 05:00 AM.

  8. #18

    Re: Lucid and OpenVZ and/or LXC ?

    sweetsinse, you are docummenting in the Ubuntu forums a solution for archlinux, that is not a solution for Ubuntu.

    I suggest you post the Arch Linux information here:
    http://bbs.archlinux.org/
    Narcis Garcia

  9. #19

    Re: Lucid and OpenVZ and/or LXC ?

    Narcis Garcia

  10. #20
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: Lucid and OpenVZ and/or LXC ?

    Thank you for starting a wiki page narcisgarcia.

    I got a little farther with a lucid container last night, but it still does not boot. I believe there is a problem with the init / upstart scripts , but the upstart script I wrote did not work either so I am at a loss.

    I added a little to your start =)
    Last edited by bodhi.zazen; January 29th, 2010 at 05:21 PM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

Page 2 of 13 FirstFirst 123412 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •