Discussion:
[lxc-users] upgrade lxc1 to lxc2/lxd
Andrey Repin
2016-05-30 15:41:47 UTC
Permalink
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"
> Previously copying the file to that location results in a "error: The container already exists"
> We use Ubuntu 14.04 (amd64) and the new hardware Ubuntu 16.04 (amd64).

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

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.


--
With best regards,
Andrey Repin
Monday, May 30, 2016 18:39:57

Sorry for my terrible english...
Fajar A. Nugraha
2016-05-31 04:29:54 UTC
Permalink
On Mon, May 30, 2016 at 10:41 PM, Andrey Repin <***@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
Robert Gierzinger
2016-06-01 18:28:54 UTC
Permalink
Thanks for the replies. It works now with lxc2. I will have a deeper look into lxd as soon as I have time ... to see what benefits it has for us.

Best regards,
Robert
___________________________________
Von: lxc-users <lxc-users-***@lists.linuxcontainers.org> im Auftrag von Fajar A. Nugraha <***@fajar.net>
Gesendet: Dienstag, 31. Mai 2016 06:29
An: LXC users mailing-list
Betreff: Re: [lxc-users] upgrade lxc1 to lxc2/lxd

On Mon, May 30, 2016 at 10:41 PM, Andrey Repin <***@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
_______________________________________________
lxc-users mailing list
lxc-***@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-users
Loading...