[lxc-users] upgrade lxc1 to lxc2/lxd

Fajar A. Nugraha list at fajar.net
Tue May 31 04:29:54 UTC 2016


On Mon, May 30, 2016 at 10:41 PM, Andrey Repin <anrdaemon at yandex.ru> wrote:
>
> Greetings, Robert Gierzinger!
>
> > Hi,
>
> > We got new hardware so I wanted to transfer the containers from our old
> > servers using 1.0 and 1.1 to our new hardware.
> > I created tarballs from the rootfs and a dummy metadata.yml. So we have the
> > template "testing", and a "lxc launch testing testing2" brought an error
> > "error: open
> > /var/lib/lxd/containers/testing2/templates/upstart-override.tpl: no such file or directory"


it pretty much says "your metadata.yml refer that file, but your
templates directory in your images does not have that file"

>
> > Previously copying the file to that location results in a "error: The container already exists"


which location?
if should be on templates directory under your image, which will then
be copied by lxd to your container directory

and of course, run "lxc list", in case your container already DOES exist

>
> > We use Ubuntu 14.04 (amd64) and the new hardware Ubuntu 16.04 (amd64).
>

If you want to go the "image" route, see
https://github.com/lxc/lxd/blob/master/doc/image-handling.md
https://insights.ubuntu.com/2016/04/01/lxd-2-0-image-management-512/

You might be able to leave out "template" section from metadata.yml
(haven't tried this), or simply copy templates section from another
metadata.yml (e.g. the trusty image that can be downloaded by lxd)
along with the templates directory (this is what I tested some time
ago).


>
> > Is there a suggested way I haven't found to migrate the containers from 1.X to 2.0?
>

Another method is to launch a privileged lxd container

lxc launch -c  security.privileged=true ...

stop it, delete its rootfs
(/var/lib/lxd/containers/container_name/rootfs/*), and then replace
the content with your original rootfs. Somewhat hackish, but works.


>
> Your mistake is not that you're migrating from oldhost/1.0 to newhost/2.0, but
> that you are trying to migrate from LXC to LXD.
> Install LXC and it'll be a straightforward process.


That can work too, if you don't need lxd's features.

-- 
Fajar


More information about the lxc-users mailing list